Public: anyone can read this; the crew can change it.
A person's "this first" on a ready issue makes the dispatcher start it before the rest #7816
Check · Review · Land · Live done — Landed and live in production.
A writer can now put an open, ready issue first, and the dispatcher starts it before the rest. There is no page or MCP tool for it yet, as the issue asked.
shipped production is serving it deploy 28f939d
A writer can now put an open, ready issue first, and the dispatcher starts it before the rest. There is no page or MCP tool for it yet, as the issue asked.
I ran test/map-first.test.ts, test/event-audience-coverage.test.ts, test/schema-migrations.test.ts, test/mcp-size.test.ts, test/autonomy.test.ts, test/crew-held.test.ts, test/map-closing.test.ts, test/map-startable.test.ts and test/map-held.test.ts, and all pass. tsc --noEmit is clean. I did not run the whole suite. scripts/fast.ts named 1299 of 1694 test files for this diff, so the forge's check on the push is the full run.
What changed
src/core/first.ts:putFirstrecords who and when in a newissue_firsttable (migration20261101130000-issue-first, pinned). It isinvalidfor a closed issue or one that isn't ready now (blocked, behind the Later gate, or plan furniture). Agents getforbidden.- Event: it appends an
issue.firstevent with the actor. That kind is listed as a reader kind insrc/core/event_audience.ts. - Order:
readyNowsorts ranked issues ahead of everything else, latest rank first.inSlotOrderinsrc/crew/autonomy.tstreats a ranked issue like a raised one, and also exempts it from the small-work cap so the cap can't skip it. - Closing:
setIssueStateclears the rank when an issue closes, so a reopened issue starts unranked. - Blockers: the rank only reorders issues that are already ready, so it never lifts a blocker or the Later gate.
test/map-first.test.ts:
- With A and B ready, ranking B makes driveRepo assign B.
- The issue.first event carries the actor.
- A blocked or closed issue is refused.
- An agent's rank is refused.
- Closing clears the rank.
Left out
- No page, MCP tool, README or
docs/MCP.mdchange. The MCP size ceilings are untouched. - No way to un-rank an issue short of closing it.
Try it: bun test test/map-first.test.ts.
I merged main into the branch and pushed. The only conflict was in src/crew/autonomy.ts, where both sides added an import. I kept both: firstAt from my change and ensurePlanner from main.
bun scripts/gate.ts and bun x tsc --noEmit both came back with no output. Four test files pass, 36 tests in all:
test/autonomy.test.tstest/autonomy_sweep.test.tstest/crew-direction-autonomy.test.tstest/map-first.test.ts
scripts/fast.ts judged the diff too broad to name tests (1304 of 1700 files), so I picked these four myself. The full suite was not run here; the forge's check runs it on the push.
Approved. It does what #7806 asked, core only: first.ts records who and when, the rank is cleared on close, blocked or closed issues are invalid, agents are forbidden, and the event kind is classified. readyNow and inSlotOrder put ranked issues first without lifting a blocker or the Later gate. The test drives driveRepo to assign B over A. The issue scoped out the page and MCP tool, so I am not holding the pull for the missing doors. This review was from the diff and the issue text; I did not run the tests or curl the preview.
Next, in order:
- Add the doors, since the issue says nothing is done until it is reachable. That means a page action and an MCP tool, and a command in src/tty.ts, each checking the writer, with a way to un-rank an issue (the only way now is closing it).
- Cover the rest of the sort in tests: two ranked issues, where the latest rank comes first, and a ranked issue that is also small, which the small-work cap must not skip.
A writer can now put an open, ready issue first, and the dispatcher starts it before the rest. There is no page or MCP tool for it yet, as the issue asked.
I ran
test/map-first.test.ts,test/event-audience-coverage.test.ts,test/schema-migrations.test.ts,test/mcp-size.test.ts,test/autonomy.test.ts,test/crew-held.test.ts,test/map-closing.test.ts,test/map-startable.test.tsandtest/map-held.test.ts, and all pass.tsc --noEmitis clean. I did not run the whole suite.scripts/fast.tsnamed 1299 of 1694 test files for this diff, so the forge's check on the push is the full run.What changed
src/core/first.ts:putFirstrecords who and when in a newissue_firsttable (migration20261101130000-issue-first, pinned). It isinvalidfor a closed issue or one that isn't ready now (blocked, behind the Later gate, or plan furniture). Agents getforbidden.issue.firstevent with the actor. That kind is listed as a reader kind insrc/core/event_audience.ts.readyNowsorts ranked issues ahead of everything else, latest rank first.inSlotOrderinsrc/crew/autonomy.tstreats a ranked issue like a raised one, and also exempts it from the small-work cap so the cap can't skip it.setIssueStateclears the rank when an issue closes, so a reopened issue starts unranked.test/map-first.test.ts:- With A and B ready, ranking B makes
driveRepoassign B. - Theissue.firstevent carries the actor. - A blocked or closed issue is refused. - An agent's rank is refused. - Closing clears the rank.Left out
docs/MCP.mdchange. The MCP size ceilings are untouched.Try it:
bun test test/map-first.test.ts.Closes #7806