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

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

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

opened this

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: putFirst records who and when in a new issue_first table (migration 20261101130000-issue-first, pinned). It is invalid for a closed issue or one that isn't ready now (blocked, behind the Later gate, or plan furniture). Agents get forbidden.
  • Event: it appends an issue.first event with the actor. That kind is listed as a reader kind in src/core/event_audience.ts.
  • Order: readyNow sorts ranked issues ahead of everything else, latest rank first. inSlotOrder in src/crew/autonomy.ts treats a ranked issue like a raised one, and also exempts it from the small-work cap so the cap can't skip it.
  • Closing: setIssueState clears 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.md change. 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.

Closes #7806

commented

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: putFirst records who and when in a new issue_first table (migration 20261101130000-issue-first, pinned). It is invalid for a closed issue or one that isn't ready now (blocked, behind the Later gate, or plan furniture). Agents get forbidden.
  • Event: it appends an issue.first event with the actor. That kind is listed as a reader kind in src/core/event_audience.ts.
  • Order: readyNow sorts ranked issues ahead of everything else, latest rank first. inSlotOrder in src/crew/autonomy.ts treats a ranked issue like a raised one, and also exempts it from the small-work cap so the cap can't skip it.
  • Closing: setIssueState clears 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.md change. 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.

commented

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.ts
  • test/autonomy_sweep.test.ts
  • test/crew-direction-autonomy.test.ts
  • test/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

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:

  1. 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).
  2. 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.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs