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
mason/forge:mason/10485-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 4 commits fork
6 files
changed +35
−20
scripts/unreached-allow.json −1
| @@ -15,7 +15,6 @@ | ||
| 15 | 15 | "src/flow/review_rounds.ts", |
| 16 | 16 | "src/flow/shared_red.ts", |
| 17 | 17 | "src/flow/stale_fold.ts", |
| 18 | "src/kernel/why_now.ts", | |
| 19 | 18 | "src/spawn/pod.ts", |
| 20 | 19 | "src/tui/gallery.ts", |
| 21 | 20 | "src/tui/ui/qr.ts", |
src/crew/sandbox.ts +9 −4
| @@ -179,12 +179,17 @@ export function dataInTemp(data: string): boolean { | ||
| 179 | 179 | |
| 180 | 180 | function tempDenied(data: string, tmpDir: string | undefined): string[] { |
| 181 | 181 | 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. | |
| 185 | 187 | return [ |
| 186 | 188 | 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 | }), | |
| 188 | 193 | ]; |
| 189 | 194 | } |
| 190 | 195 |
test/child-quota.test.ts +5 −2
| @@ -10,7 +10,8 @@ import { join } from "node:path"; | ||
| 10 | 10 | import { createApp, type App } from "../src/app.ts"; |
| 11 | 11 | import { createUser } from "../src/core/users.ts"; |
| 12 | 12 | 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"; | |
| 14 | 15 | import { usePlacement, useProbe } from "../src/spawn/door.ts"; |
| 15 | 16 | import { hostedPlacement, memoryBodies } from "../src/spawn/placement.ts"; |
| 16 | 17 | import { quietLogs } from "./helpers/globals.ts"; |
| @@ -101,7 +102,9 @@ describe("child quota", () => { | ||
| 101 | 102 | |
| 102 | 103 | test("room for small but not large is refused only for large", async () => { |
| 103 | 104 | 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); | |
| 105 | 108 | expect(quotaRefusal(dir, "small")).toBeUndefined(); |
| 106 | 109 | expect(quotaRefusal(dir, "large")).toContain("memory limit"); |
| 107 | 110 | }); |
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 | ||
| 314 | 314 | const { denyRead, tmpDir } = policy(); |
| 315 | 315 | expect(denied(join(dataDir, "crew/scout/01repo/7"), denyRead)).toBe(false); |
| 316 | 316 | 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)); | |
| 318 | 320 | expect(denied(tmpDir!, denyRead)).toBe(false); |
| 319 | 321 | }); |
| 320 | 322 |
test/helpers/real-child-forge.ts +13 −11
| @@ -29,6 +29,9 @@ mkdirSync(join(dataDir, "spawn"), { recursive: true }); | ||
| 29 | 29 | writeFileSync(join(dataDir, "spawn", "kid.json"), JSON.stringify({ ...ledger, done: true, placement: "cell" })); |
| 30 | 30 | const ask = (path: string) => answerFromCell(parent, new Request(`https://kid--f.test${path}`, { headers: { host: "kid--f.test" } })); |
| 31 | 31 | |
| 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 = ""; | |
| 32 | 35 | try { |
| 33 | 36 | const started = performance.now(); |
| 34 | 37 | const first = await ask("/"); |
| @@ -39,19 +42,18 @@ try { | ||
| 39 | 42 | const health = child === undefined ? null : (await ask("/healthz")).status; |
| 40 | 43 | // The watch reads the cell's tree once a second, by its label. |
| 41 | 44 | 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 | }); | |
| 53 | 54 | } finally { |
| 54 | 55 | await stopCellChildren(parent); |
| 55 | 56 | parent.close(); |
| 56 | 57 | rmSync(dataDir, { recursive: true, force: true }); |
| 57 | 58 | } |
| 59 | console.log(result); |
test/helpers/real-spawn-e2e.ts +5 −1
| @@ -34,6 +34,9 @@ const dataDir = mkdtempSync(join(tmpdir(), "real-spawn-")); | ||
| 34 | 34 | mkdirSync(dataDir, { recursive: true }); |
| 35 | 35 | const parent = createApp({ dataDir, url: "https://forge.test", port: 0 }); |
| 36 | 36 | 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 = ""; | |
| 37 | 40 | try { |
| 38 | 41 | const alice = await createUser(parent.db, { origin: "seed", trusted: true, username: "alice", email: "[email protected]", isAdmin: true }); |
| 39 | 42 | if (!alice.ok) throw new Error("user"); |
| @@ -76,10 +79,11 @@ try { | ||
| 76 | 79 | } |
| 77 | 80 | await Bun.sleep(1000); |
| 78 | 81 | } |
| 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 }); | |
| 80 | 83 | } finally { |
| 81 | 84 | servers.stop(); |
| 82 | 85 | await stopCellChildren(parent); |
| 83 | 86 | parent.close(); |
| 84 | 87 | rmSync(dataDir, { recursive: true, force: true }); |
| 85 | 88 | } |
| 89 | console.log(result); |
new above
offline