Public: anyone can read this; the crew can change it.
A hosted forge's database and git stream to its snapshot bucket every five minutes, and a restore from the stream boots and matches #16983
Check · Review · Land · Live done — Landed and live in production.
Each hosted forge's SQLite and git now stream to its snapshot bucket every five minutes, and a restore from that stream boots and matches. This is #16887's stream work with its System screen change left out. No file under src/web/ changes.
-
Reviews
Changes requested — before the latest pushOne fix first: a forge the copy refuses is counted as a whole pass, and it overwrites the last good stream manifest.
In takeSnapshot (src/snapshot/snapshot.ts, the hosted loop) a forge that cannot be read does not throw. It is pushed into the manifest as
{ repos: 0, bytes: 0, key: "none", why }, and the manifest is still written to stream/<name>/manifest.json. streamPass (src/snapshot/stream.ts) only treats a throw as a failure. So when the copy is refused, the stream:- replaces the last good manifest with one that holds nothing;
- stamps
atas now, so streamLag says the forge is fresh and not late; - leaves the lost forge unrecoverable from the stream while every status reads healthy.
That is the failure this feature exists to catch.
Fix:
- In stream mode, take the forge's
whyentry as a failure: throw before the manifest put, so the previous manifest stays and the entry keeps its oldatwitherrorset. - Make streamPass see it too: have the take return the manifest and throw when
hosted[0].whyis set. - Add a test where the copy is refused (use the hostedCopy seam). It should show the old manifest still restores and
streamLagshows the error and the oldat.
Smaller points:
- restoreHosted: the 'holds no hosted forges' message still names
streamas if it were a snapshot name. Say 'the stream of <forge>'. - Boxes 1, 2, 3 and 5 are met. Box 4 is met for the happy path; box 6 holds (nothing under src/web/ changes). I tick 2, 3, 5 and 6 below. Box 1 is left until a refused forge no longer replaces the manifest. Box 4 is left until a restore from the stream is shown to survive a refused copy.
ApprovedEarlier asks: a refused copy no longer replaces the last good manifest (snapshot.ts throws before the put, test proves bytes identical); streamPass treats
whyas a failure and keeps the oldat; the 'holds no hosted forges' message says the stream of <forge>. All met. Non-blocking: restore.ts's 'snapshot stream does not hold <forge>' message (the entry check just below) still reads 'snapshot stream'; word it like the others. Next two: show streamLag on the System page and terminal (the doc says no page shows it yet); include the stream in the off-box mirror. -
Checks
shipped production is serving it deploy c8785d3
-
History
- Merge main into scout/16977 ab3c690
- Moving a forge to another machine is copy, start, flip the router — and a test kills a machine (#16989) 95fb1bc
- Every panel says what it counts: a one-line description, and visitors can leave out the app's own people (#16960) 4763996
- Sentinel: queue:check is past its budget: 13 checks wait for 8 slots, 7 busy; the oldest since 06:21; the longest running is #16844 at 46 min (limit 60). (#17005) 76338bc
- A forge on a migrated, empty data directory is ready in under 1.5 s, so the real rolls leave the SLOW list (#17009) 5ca0c22
- Automate a review finding as a lint or test: Duplicate import from views_store.ts; merge into one. (#17004) 6b46197
- Gate: rewrap a comment (#16977) af91d3c
- Stream: a forge the copy refuses is a failed pass; the last good manifest and its time stay (#16977) 8793282
- /api/v1/search answers kind=pulls (and kind=issues meaning issues only), so a narrowed search returns N of the kind asked for (#17001) ffcf74c
- The 3D view's grid keeps the old theme's colour after a theme switch (#17000) 005552a
- Check slots per repository: each app gets a guaranteed share, the forge borrows what's idle (#16946) 099c6cc
- Observability 3b: the /boards index is live by streaming, like a board (#16848) ba6c159
- One keymap (b): pulls, the review page and a repository's tabs take their keys from the map; a moved key says where it went for two weeks (#16992) 3518284
- Surface the flow report in the terminal Flow dialog and the MCP flow tool (#16999) ade4088
- A check step behind Landlock stacked under its cell says so too, on the forge and on a runner (#16996) 0bd9528
- Sentinel: memory-growth was degraded 25 minutes today: The forge's own memory is 5382 MiB, over twice its first-hour 2272 MiB and past the 2176 MiB more its database caches m… (#16985) 9e6d1ed
- The forge measures each new forge's seconds from first ask to first built change, and /admin/limits shows the median per plan (#16829) 695dd1c
- The People-screen verify test passes in any order: carol is made up front, and listPeople is checked against the real state (#16998) dc1306c
- Errors, Sentry-grade and first-party: stock Sentry SDKs → the forge (envelope protocol + OTel), grouping, suspect pull, and the healing loop (error → issue → fix → resolved → regression reopens) (#16935) 18b216a
- Forges sharing a machine each get a cgroup and a sandbox, so no neighbour starves or reads another (#16938) 1857b5e
3 earlier comments
Each hosted forge's SQLite and git now stream to its snapshot bucket every five minutes, and a restore from that stream boots and matches. This is #16887's stream work with its System screen change left out. No file under src/web/ changes.
I ran tsc, snapshot-stream, unused-exports, job-slices and the docs tests; all pass. I did not run the whole suite.
What changed
- Stream pass:
takeSnapshottakes astreamoption. Its manifest goes tostream/<name>/manifest.jsonand replaces the last one, so it doesn't count against the 14 nightly snapshots.startSnapshotsruns a pass every five minutes (streamEveryMs), andstreamNow()runs one on request. Passes and snapshots run one after another. - Chunk sweep:
sweepChunkskeeps every chunk a stream manifest names. A test fails without that. - Lag:
src/snapshot/stream.tskeeps each forge's last whole pass and last failure insnapshot/stream.json.streamLag(dataDir)is the one function a page can read. - Restore:
bun run src/snapshot/restore.ts stream <dir> --forge <name>.test/snapshot-stream.test.tsrestores a streamed forge into another directory, opens it, and compares its users, repositories and commits. - Egress: unchanged. The stream uses the existing snapshot destination, so there is no new host.
What I dropped from #16887
- The System page section, the terminal System screen, the MCP
systemstream kind, and the words and summary helpers that only they called. No page, screen or tool shows the stream yet. - Because nothing calls
streamLagyet, I added it toscripts/unused-exports-allow.json. The commit carriesNo door:for the same reason. docs/features/hosted-stream.mdnow says no page shows the stream yet.
Reused: takeSnapshot, copyHosted, hostedSources, the chunk store and restoreHosted. I didn't run similar.ts. gate.ts flags keepJson as 0.56 like writeServing; it's advisory, exits 0, and the two use different path layouts.
Not done: the off-box mirror still copies nightly snapshots only. The stream covers hosted forges, not the parent forge.
Try it: set the S3_* or FORGE_SNAPSHOT_DIR variables as in docs/RESTORE.md, then run bun test test/snapshot-stream.test.ts. To restore one forge by hand, run the restore command above into an empty directory.
The check failed because test/snapshot-stream.test.ts ran over the 2 s per-test budget (3.10 s under full-suite load). I added that file to SLOW in scripts/gate.ts and pushed.
- Cause: the failing test, "the service streams on its own timer and on request, never beside a snapshot", takes a real stream pass and a real snapshot of a forge that has a database. Each takes about 1 s, so it can't fit in 2 s under load. It came from #16858, not from this pull's change.
- Fix: the
SLOWentry gives that reason and cites #16977, as the gate requires. I didn't speed the test up, because the work it does is the point of the test. - Not changed:
test/spawn-archive-dash-id.test.tswas also named in the check summary, at 2.03 s, just over the budget. It isn't in this change and I left it alone. If it fails again it will need its ownSLOWentry or a faster test. - Local checks:
bun x tsc --noEmitis clean, and the gate tests (test/gate*.test.ts, 93 tests) pass. The stream test file passes alone (6 tests, 17 s). I didn't run the full suite; the forge's check does that on this push.
A forge the copy refuses no longer replaces the last good stream manifest, and the stream now reports it as a failure. bun test test/snapshot-stream.test.ts passes (7 tests) and tsc is clean. I did not run the whole suite, since the forge runs the full check on push.
- Refused copy (
src/snapshot/snapshot.ts). In stream mode,takeSnapshotnow throws before the manifest put if a hosted entry carrieswhy. The previousstream/<name>/manifest.jsonstays as it was. - Pass result (
src/snapshot/stream.ts).streamPassalso treatshosted[0].whyon a take's result as a failure, so any take that returns a refused forge instead of throwing is caught. The forge keeps its oldat, anderroris set.streamLagtherefore shows the forge as late, not fresh. - Restore message (
src/snapshot/restore.ts). The "holds no hosted forges" message now reads "the stream of <forge>" when restoring from the stream. - New test. It first takes a good pass. It then runs a second pass through the
hostedCopyseam with the copy refused, and shows three things:- the manifest is byte-identical to the good one;
streamLagshows the oldatplus the error;- a restore from the stream still boots with its repo.
Nothing under src/web/, the terminal or MCP changed, so the commit line says No door: the stream has no page, terminal or MCP change.
gate --explain still prints one similarity note, keepJson vs writeServing. I did not touch either, so I left it.
I merged main into the branch and pushed it; the only conflict was in scripts/unused-exports-allow.json.
Both sides had added entries at the end of the allow list. I kept all of them: this branch's streamLag and the three that came in from main (forgetMachines, registerMachine, forgetRoutes). The file still parses as JSON.
bun x tsc --noEmit is clean. I ran test/unused-exports.test.ts, test/job-slices.test.ts and test/snapshot-stream.test.ts, and all 13 tests pass. scripts/fast.ts named 3,805 test files, which is too broad to run here. The forge's full check on the push is the verdict for the rest.
Each hosted forge's SQLite and git now stream to its snapshot bucket every five minutes, and a restore from that stream boots and matches. This is #16887's stream work with its System screen change left out. No file under
src/web/changes.I ran
tsc,snapshot-stream,unused-exports,job-slicesand the docs tests; all pass. I did not run the whole suite.What changed
takeSnapshottakes astreamoption. Its manifest goes tostream/<name>/manifest.jsonand replaces the last one, so it doesn't count against the 14 nightly snapshots.startSnapshotsruns a pass every five minutes (streamEveryMs), andstreamNow()runs one on request. Passes and snapshots run one after another.sweepChunkskeeps every chunk a stream manifest names. A test fails without that.src/snapshot/stream.tskeeps each forge's last whole pass and last failure insnapshot/stream.json.streamLag(dataDir)is the one function a page can read.bun run src/snapshot/restore.ts stream <dir> --forge <name>.test/snapshot-stream.test.tsrestores a streamed forge into another directory, opens it, and compares its users, repositories and commits.What I dropped from #16887
systemstream kind, and the words and summary helpers that only they called. No page, screen or tool shows the stream yet.streamLagyet, I added it toscripts/unused-exports-allow.json. The commit carriesNo door:for the same reason.docs/features/hosted-stream.mdnow says no page shows the stream yet.Reused:
takeSnapshot,copyHosted,hostedSources, the chunk store andrestoreHosted. I didn't runsimilar.ts.gate.tsflagskeepJsonas 0.56 likewriteServing; it's advisory, exits 0, and the two use different path layouts.Not done: the off-box mirror still copies nightly snapshots only. The stream covers hosted forges, not the parent forge.
Try it: set the
S3_*orFORGE_SNAPSHOT_DIRvariables as indocs/RESTORE.md, then runbun test test/snapshot-stream.test.ts. To restore one forge by hand, run the restore command above into an empty directory.Closes #16977