Public: anyone can read this; the crew can change it.
Merge queue: show which open pulls touch the same files #17176
Merged 36h 47m ago, live in production
The queue page, a terminal screen and the flow MCP tool now show which open pulls collide, and one order to land them in. Tests for the new module, the terminal queue screen, the dead-code check and the page budget pass, and tsc is clean. I did not run the whole suite.
-
Reviews
Changes requested — before the latest pushChanges needed, in one round. (1) First: the queue page now waits on git for every viewer, guests included. Each load spawns 2
refTipprocesses per open pull (up to 60), then up to 400 ms ofdiffandmerge-treeon a cold cache, and a spawn already started can run to its 20 s timeout. That breaks the direction's snappy page and gives anonymous traffic a way to burn CPU. Read only cached results on the page and fill the cache off the request, or use the storedheadOidandbaseOidinstead of live tips. The queue page's first paint must not wait on git. (2) The tests cover only the pure function andcollisionRows. Add tests that fail without the change for:viewerCollisionsleaving out a sealed pull the viewer may not read, theflowkind: collisionstool (including a private repository read by a guest), the terminal screen, and the 30-pull and 400 ms bounds. (3)titleinCollisionInputis never read. Remove it, and the trailing blank line at the end ofpull_collisions.ts. (4) The localkeephelper duplicates the one inreview_evidence.ts. Reuse that one so there is one way to do it. (5) When a pass is cut short, the page and the terminal present a partialorderas if it were complete and never mentionskipped. Say so in one plain line. I could not exercise the page on the preview: the URL I tried answered 404 after 8 s.ApprovedEarlier asks, all met: the queue page reads only kept readings and fills the cache off the request (one pass per repository, at most one every 5 s, bounded map); stored oids replace live refTip; partial readings say so in one plain line on the page, the terminal and
flow; cleanup done (sharedkeepNewest); tests now cover the 30-pull cap, the 400 ms budget, cachedOnly, sealed pulls, the flow tool, the terminal screen and the page. Security holds: sealed pulls are filtered per viewer before pairs, order and sentences, private repos are refused to guests, and git args are oid- and path-validated with no shell. Both doors are present (palette screen,docs/features/queue-collisions.md, no README growth).Non-blocking: (1) in
collisionRows(src/web/pages/queue.ts), when the reading is only partial (cold cache, or a lone fork pull) the section shows 'Order to land in, fewest conflicts first: .' with an empty list and an empty card. Hide the order line whenc.orderis empty, and skiplistCardwhen there are no pairs. (2)keepNewestevicts the oldest entry even when the key already exists; wheninto.has(key)just set. (3) Principle 1: the muted order sentence and the partial note say the same thing twice on a cold load; one line would do. -
Checks
shipped production is serving it deploy 5fa2c54
-
History
- Queue collisions: one bounded map of refill passes, no module-level Set written by requests (#17037) 98a5da0
- Queue collisions: the page reads the kept reading and fills it off the request, stored oids, a partial line, tests on every surface (#17037) ecfbf76
- Queue collisions: the screen and how-to in their own files, the page's two reads in its budget (#17037) b513783
- Queue: show which open pulls collide, and an order to land in (#17037) 67f4e3b
- One keymap: not now is p in the terminal's Next up too, and /system's sort buttons carry S (#17153) c1c75da
- Pinned dependencies are matched against a local mirror of OSV advisories, and a vulnerable one is a finding (#17082) b8b9c7a
- Edges: firewalls for DigitalOcean and Hetzner as an infra kind, with plan steps and drift (#17092) 2214c84
- One keymap (d): /next, the space and /system take their keys from the map; no page chooses a key of its own (#17138) f70698f
- Talk on a phone: the conversation's controls within thumb reach, in a bottom bar (#17078) 54e86c1
- Errors: suspect pull — name the commit that likely caused an error group (#17134) 0b81c07
- Talk workspace W1: workspace bar (repo ▸ branch, status) and a hot-reloading dev cell per workspace (#17135) 725400b
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:3ko5kkr59w is past its budget: trevato/forge: "a restart with a job on a runner > a job a live forge still waits on is never taken back: only one its … (#17145) 7519da6
- The breaker parks a green pull over runs that correctly declined to push to a person's branch (#17132) 72437d6
- A clear crew status line: "paused at its ceiling" with a Raise button (#17136) 9fc068b
- Data: managed Postgres on DigitalOcean as an infra kind (#17128) f35086a
- Registry: updates arrive as pulls (#17127) 6d41254
- Errors: OpenTelemetry intake alongside the Sentry envelope (#17137) a94022b
- Hosted child forges on a host with Landlock and no bubblewrap are not held by the floor (#17133) a164ff4
- The runs API says where a running check executes: runner:<name>, or forge (#17139) 723f969
- Terminal Capacity screen: say what N checks or crew runs take of the machine (the bridge's room line, slotRoom) (#17124) 9185139
2 earlier comments
The queue page, a terminal screen and the flow MCP tool now show which open pulls collide, and one order to land them in. Tests for the new module, the terminal queue screen, the dead-code check and the page budget pass, and tsc is clean. I did not run the whole suite. One unrelated MCP test, "a writer's update names the agent and queues its run", failed in my run and also fails without my change. The preview has not been tried.
What changed
src/core/pull_collisions.tsfinds, for every pair of open pulls that change a common file, whethergit merge-tree --write-treeconflicts between their two heads, and in which files. Live branch tips are used, with no checkout.- It returns the colliding pairs and an order to land in: fewest conflicts first, then the oldest.
- A pair that shares files but merges cleanly is reported as "both change X; git merges them".
- The queue page (
/<owner>/<name>/queue) has a "Pulls that collide" section that appears only when pulls collide. It names each pair, links the pulls and gives the order. - The terminal has a palette entry, "Pulls that collide", while a repository is open (
src/tui/screens/collisions.ts). - The
flowMCP tool takes{ kind: collisions, repo }and returns{ pairs, order, skipped, says }. - A sealed pull the viewer may not read is left out of all three.
- The how-to is
docs/features/queue-collisions.md.
Bounds
- Pairs are tried only where the two pulls share a changed file.
- A pass stops starting new reads after 400 ms and answers what it has, and results are cached by commit pair so the next load fills in the rest.
- Only the first 30 open pulls are read. A fork's pull is skipped, because its head is not in this repository.
Left out
- Nothing is sent when pulls collide: no comment on the pull and no notification.
- The order is a sort, not a search for the best order.
Changes to existing files
queuePageis now async. I changedtest/planner-ceiling.test.tsto await it, since it called the sync form.- The queue page's statement budget goes from 64 to 66, for the open-pulls read. The reason is in
test/budgets/pages/owner-name-queue.json.
Reuse
- I reused
runGitCapture,isSafeOid,isSafeTreePath,refTip,repoDir,listOpenPulls,mayViewandlistCard. - The gate's similarity notes are unresolved. My
keephelper resembles one inreview_evidence.ts. My test'sgitandbranchhelpers resembletest/combined-git.test.ts.
To try
- Open
/<owner>/<name>/queuewith two open pulls that edit the same line, and look for "#A collides with #B in file". - In the terminal, open the palette and choose "Pulls that collide".
- Call
flowwith{ kind: collisions, repo }.
[
{"go": "/<owner>/<name>/queue", "look": "With two open pulls editing one line, a 'Pulls that collide' section", "expect": "A row '#A collides with #B in <file>' marked conflict, links to both pulls, and a land-in order"},
{"go": "/<owner>/<name>/queue", "look": "With no overlapping pulls", "expect": "No collisions section"}
]The queue page no longer waits on git, and the other four review points are addressed.
What changed
- First paint (1):
/queueanswers from the readings earlier passes kept (viewerCollisions(…, cachedOnly)) and starts no git process. If the reading is partial,warmCollisionsfills the cache after the response is sent. That fill runs one pass at a time per repository and at most once every 5 s, so anonymous traffic cannot stack work. - Stored oids (1): the live
refTipspawns are gone. Readings use each pull's storedheadOidandbaseOid. The terminal screen and theflowtool still read live, since both need a signed-in viewer. - Partial readings (5): a pass cut short by the 30-pull limit, the 400 ms budget or a cold cache is now flagged on
Collisions(partial).partialLinewords it in one line, for example "Left out of this reading: #9. The order may change." or "Some pairs are not read yet. The order may change." The page, the terminal screen and theflowtool'ssaysall show it.docs/features/queue-collisions.mddescribes it. - Cleanup (3, 4): I removed the unused
titleand the trailing blank line. The cache trimming now comes from a small sharedsrc/core/bounded.ts(keepNewest), used by bothpull_collisions.tsandreview_evidence.ts. Thatkeepwas private and typed to its own cache, so I made a generic one incore/instead of importingweb/studiofromcore. - Tests (2):
test/pull-collisions.test.tsnow covers the 30-pull limit, the 400 ms budget,cachedOnlyand the partial line on the page.- The new
test/queue-collisions-surfaces.test.tscovers:- a sealed pull left out for a viewer who may not read it;
- the
flowtool, including a guest refused on a private repository; - the terminal screen;
- the page showing the partial line cold and the pairs once the cache is filled.
tsc, the gate (no failures), bun scripts/design-lint.ts and the two collision test files pass. unused-exports also passes; its output names two unrelated src/spawn exports as no longer dead. I did not run the full suite, and I did not exercise the preview, since you saw a 404 there.
Left out: a first visit to a busy repository shows the partial line until the background fill finishes, which is the cost of not waiting on git. The terminal and the flow tool still run git inside their own request, within the 400 ms budget.
[
{"go": "/alice/lib/queue (a repository with two or more open pulls that edit the same lines, first load after a restart)", "look": "the Pulls that collide section", "expect": "answers at once with a line 'Some pairs are not read yet. The order may change.' or 'Left out of this reading: …'"},
{"go": "reload the same page a moment later", "look": "the Pulls that collide section", "expect": "the pair sentences ('#1 collides with #3 in code.txt') and the order, with no partial line"}
]The check failed because src/core/pull_collisions.ts added two module-level collections, filling and filledAt, that request code writes to. I replaced them with one bounded map, passes, which records for each repository when its last refill pass started and whether one is running. I pushed the fix as 98a5da095.
- Why it passes:
passesis written throughkeepNewest, capped at 2000 entries, like the existingtouchedandmergedcaches. The module-state test accepts that pattern. - Behaviour:
warmCollisionsstill runs one pass at a time per repository and at most one every 5 seconds. - Checks run:
test/module-state.test.tsand the two collision test files passed (13 tests in the collision files).bun x tsc --noEmitprinted nothing.bun scripts/gate.ts --fixprinted only "one implementation?" similarity notes for test helpers and changed no files. I did not run the full suite, and I did not rundesign-lintbecause nothing insrc/web/changed. - Not done: the helper-similarity notes are about test code from earlier commits, which I left alone.
- Door rule: the commit line says
No door:, since this is internal state only with no page, action, route or tool change.
This was a fix to the failing check on the existing pull, so the pull description is unchanged.
The queue page, a terminal screen and the
flowMCP tool now show which open pulls collide, and one order to land them in. Tests for the new module, the terminal queue screen, the dead-code check and the page budget pass, andtscis clean. I did not run the whole suite. One unrelated MCP test, "a writer's update names the agent and queues its run", failed in my run and also fails without my change. The preview has not been tried.What changed
src/core/pull_collisions.tsfinds, for every pair of open pulls that change a common file, whethergit merge-tree --write-treeconflicts between their two heads, and in which files. Live branch tips are used, with no checkout./<owner>/<name>/queue) has a "Pulls that collide" section that appears only when pulls collide. It names each pair, links the pulls and gives the order.src/tui/screens/collisions.ts).flowMCP tool takes{ kind: collisions, repo }and returns{ pairs, order, skipped, says }.docs/features/queue-collisions.md.Bounds
Left out
Changes to existing files
queuePageis now async. I changedtest/planner-ceiling.test.tsto await it, since it called the sync form.test/budgets/pages/owner-name-queue.json.Reuse
runGitCapture,isSafeOid,isSafeTreePath,refTip,repoDir,listOpenPulls,mayViewandlistCard.keephelper resembles one inreview_evidence.ts. My test'sgitandbranchhelpers resembletest/combined-git.test.ts.To try
/<owner>/<name>/queuewith two open pulls that edit the same line, and look for "#A collides with #B in file".flowwith{ kind: collisions, repo }.Closes #17037