Public: anyone can read this; the crew can change it.

Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:1vmo28kk9l is past its budget: trevato/forge: "every module under src/ is imported by another, or allowed" failed on 18 pulls in the last hour — the l… #10516

Parked opened this
Closed without merging

mason/forge:mason/10485-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 4 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
6 files changed +35 −20
scripts/unreached-allow.json −1
@@ -15,7 +15,6 @@
1515 "src/flow/review_rounds.ts",
1616 "src/flow/shared_red.ts",
1717 "src/flow/stale_fold.ts",
18 "src/kernel/why_now.ts",
1918 "src/spawn/pod.ts",
2019 "src/tui/gallery.ts",
2120 "src/tui/ui/qr.ts",
src/crew/sandbox.ts +9 −4
@@ -179,12 +179,17 @@ export function dataInTemp(data: string): boolean {
179179
180180 function tempDenied(data: string, tmpDir: string | undefined): string[] {
181181 const temp = tmpdir();
182 // The run's own temp directory is in it (`runTmpDir`): everything else there is denied.
183 if (tmpDir !== undefined && !inside(data, tmpDir) && inside(temp, tmpDir)) return others(temp, basename(tmpDir));
184 if (!dataInTemp(data)) return [temp];
182 // The run's own temp directory may be in it (`runTmpDir`): it is never denied.
183 const ownTmp = tmpDir !== undefined && !inside(data, tmpDir) && inside(temp, tmpDir) ? basename(tmpDir) : undefined;
184 if (!dataInTemp(data)) return ownTmp === undefined ? [temp] : others(temp, ownTmp);
185 // The data directory is in it too, so the entry holding it is never denied
186 // whole: only the forge's own pieces, and every other run's temp directory.
185187 return [
186188 join(temp, `claude-${process.getuid?.() ?? 0}`),
187 ...others(temp, "").filter((path) => basename(path).startsWith("fc-")),
189 ...others(temp, "").filter((path) => {
190 const name = basename(path);
191 return name.startsWith("fc-") || (name.startsWith(RUN_TMP_PREFIX) && name !== ownTmp);
192 }),
188193 ];
189194 }
190195
test/child-quota.test.ts +5 −2
@@ -10,7 +10,8 @@ import { join } from "node:path";
1010 import { createApp, type App } from "../src/app.ts";
1111 import { createUser } from "../src/core/users.ts";
1212 import { serve, type Servers } from "../src/http/server.ts";
13 import { quotaRefusal } from "../src/spawn/quota.ts";
13 import { heldByChildren, quotaRefusal } from "../src/spawn/quota.ts";
14 import { SIZES } from "../src/spawn/sizes.ts";
1415 import { usePlacement, useProbe } from "../src/spawn/door.ts";
1516 import { hostedPlacement, memoryBodies } from "../src/spawn/placement.ts";
1617 import { quietLogs } from "./helpers/globals.ts";
@@ -101,7 +102,9 @@ describe("child quota", () => {
101102
102103 test("room for small but not large is refused only for large", async () => {
103104 clear();
104 process.env["FORGE_CHILD_MEMORY_MIB"] = "2000";
105 // Room for one more small forge beside what is already held, not for a large one.
106 const held = heldByChildren(dir).memoryMiB;
107 process.env["FORGE_CHILD_MEMORY_MIB"] = String(held + SIZES.small.memoryMiB);
105108 expect(quotaRefusal(dir, "small")).toBeUndefined();
106109 expect(quotaRefusal(dir, "large")).toContain("memory limit");
107110 });
test/crew-sandbox.test.ts +3 −1
@@ -314,7 +314,9 @@ describe("the shell sandbox denies the whole data directory but the agent's own
314314 const { denyRead, tmpDir } = policy();
315315 expect(denied(join(dataDir, "crew/scout/01repo/7"), denyRead)).toBe(false);
316316 expect(tmpDir).toBeDefined();
317 expect(tmpDir!.startsWith(join(dataDir, "crew/scout/.t/"))).toBe(true);
317 // Under the agent, or in the machine's temp when this host's temp path
318 // leaves a socket no room there (`runTmpDir`).
319 expect(tmpDir).toBe(runTmpDir(dataDir, "scout", runId));
318320 expect(denied(tmpDir!, denyRead)).toBe(false);
319321 });
320322
test/helpers/real-child-forge.ts +13 −11
@@ -29,6 +29,9 @@ mkdirSync(join(dataDir, "spawn"), { recursive: true });
2929 writeFileSync(join(dataDir, "spawn", "kid.json"), JSON.stringify({ ...ledger, done: true, placement: "cell" }));
3030 const ask = (path: string) => answerFromCell(parent, new Request(`https://kid--f.test${path}`, { headers: { host: "kid--f.test" } }));
3131
32 // Printed once the child has stopped: it drains for seconds when asked to go,
33 // and the parent logs its lines to stdout meanwhile; the test reads the last line.
34 let result = "";
3235 try {
3336 const started = performance.now();
3437 const first = await ask("/");
@@ -39,19 +42,18 @@ try {
3942 const health = child === undefined ? null : (await ask("/healthz")).status;
4043 // The watch reads the cell's tree once a second, by its label.
4144 await Bun.sleep(1_500);
42 console.log(
43 JSON.stringify({
44 first: first.status,
45 firstMs,
46 failure: children.failure(ledger.bodyId) ?? null,
47 limits: child?.limits ?? null,
48 root,
49 health,
50 labelled: cellCounters().some((c) => c.label === "forge:kid"),
51 }),
52 );
45 result = JSON.stringify({
46 first: first.status,
47 firstMs,
48 failure: children.failure(ledger.bodyId) ?? null,
49 limits: child?.limits ?? null,
50 root,
51 health,
52 labelled: cellCounters().some((c) => c.label === "forge:kid"),
53 });
5354 } finally {
5455 await stopCellChildren(parent);
5556 parent.close();
5657 rmSync(dataDir, { recursive: true, force: true });
5758 }
59 console.log(result);
test/helpers/real-spawn-e2e.ts +5 −1
@@ -34,6 +34,9 @@ const dataDir = mkdtempSync(join(tmpdir(), "real-spawn-"));
3434 mkdirSync(dataDir, { recursive: true });
3535 const parent = createApp({ dataDir, url: "https://forge.test", port: 0 });
3636 const servers = await serve(parent);
37 // Printed once the child has stopped: it drains for seconds when asked to go,
38 // and the parent logs its lines to stdout meanwhile; the test reads the last line.
39 let result = "";
3740 try {
3841 const alice = await createUser(parent.db, { origin: "seed", trusted: true, username: "alice", email: "[email protected]", isAdmin: true });
3942 if (!alice.ok) throw new Error("user");
@@ -76,10 +79,11 @@ try {
7679 }
7780 await Bun.sleep(1000);
7881 }
79 console.log(JSON.stringify({ placement: made.value.placement, status, body: body.slice(0, 200), app }));
82 result = JSON.stringify({ placement: made.value.placement, status, body: body.slice(0, 200), app });
8083 } finally {
8184 servers.stop();
8285 await stopCellChildren(parent);
8386 parent.close();
8487 rmSync(dataDir, { recursive: true, force: true });
8588 }
89 console.log(result);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs