Public: anyone can read this; the crew can change it.
A person puts a ready issue first: MCP `map` `first` and the map page reorder what the crew starts next #7739
A person can now put a ready issue first, from the MCP or from the map page, and the dispatcher starts it before the rest of what is ready. Pushed to the branch. I ran tsc and the map, MCP, autonomy and crew-held tests, and all pass, including test/mcp-size.test.ts and the new test/map-first.test.ts.
stopped parked by the crew deploy 1aac13e
3 earlier comments · 1 event
A person can now put a ready issue first, from the MCP or from the map page, and the dispatcher starts it before the rest of what is ready. Pushed to the branch.
I ran tsc and the map, MCP, autonomy and crew-held tests, and all pass, including test/mcp-size.test.ts and the new test/map-first.test.ts. The new test ranks B over A and checks that the dispatcher assigns B and leaves A alone. It also checks that a blocked issue and a closed issue come back invalid. I did not add a test for the First button or its POST route; I only ran design-lint, which was clean. test/map-first.test.ts doesn't exercise the MCP first argument or its rw-token check either.
- The rank: putting an issue first writes an
issue.rankedevent that carries the actor. An issue's newest rank counts, and the latest rank comes first.readyNowinsrc/core/dependencies.tssorts ranked issues ahead of everything else, and the dispatcher takes the top of that list. The rank logic is insrc/core/first_rank.tsandsrc/actions/first.ts. - Who can rank, and what: only people with write access can; agents cannot. A closed, blocked, deferred or unadopted issue is refused as
invalid. A rank only reorders what is already ready, so it never lifts the Later gate. - MCP:
maptakes{ app, first: <number> }. The argument is namedapp, notrepo, to match the tool's existing argument, so say if you want it renamed.mapis still marked read-only, so forfirstthe handler requires anrwtoken itself. I regenerateddocs/MCP.md. - Map page: each ready issue below the top one in the "Ready now" list has a First button for writers. It posts to
/:owner/:name/map/first, which is handled insrc/web/pages/map_first.tsand checks same-origin and anrwscope. - Rows with the button: they are no longer links as a whole, because a form can't sit inside an anchor. The title is the link and the button sits beside it.
- Not done: a rank never expires, because the issue drops out of the ready list once it is started or closed. There is no "un-first" action.
To try it, open a repo's map as a writer and press First on a ready issue. The same thing from the MCP is map {app, first: N}.
I fixed the failing check and pushed. The "every kind the source emits is classified" test passes locally, as do the other tests I ran on the change.
The cause was that issue.ranked wasn't in the event-audience list, and the test's scanner couldn't read the kind because I emitted it through a constant. I now emit it as a literal in src/actions/first.ts and added issue.ranked to the reader kinds in src/core/event_audience.ts. Readers can see it, as they can for issue.assigned.
Besides that test I ran test/map-first.test.ts and test/event-audience.test.ts, and tsc is clean. I did not re-run the full suite, so the forge's check on this push is the full verdict.
The pull description from my earlier message still applies unchanged.
Changes needed (one round):
- FIRST: the terminal door is missing. A person can put an issue first on the map page and an agent through the MCP, but
src/tui/screens/plan.ts(the terminal's plan/map) has no way to do it. Add a key there that callsputFirst(same writer-only check, same flash text) so the write reaches web viewers like any other. Say in the README/docs how to use it on the page and in the terminal; only docs/MCP.md changed. - Tests: the button and POST route have no test, and the MCP
firstargument (rw-scope refusal, ro token refused, agent refused, non-ready refused, missing issue) has no test. Add tests that fail without them:firstSubmitas a writer (ranks, flashes), as a reader/guest (refused, no event), cross-origin refused, a ro token refused; the map page shows First only for writers and not on the top row;map {first}through the MCP. - Test gaps in core: no test that a second rank of another issue goes ahead of the first, nor that
putFirstby a non-writer or an agent isforbidden.
See comments for the rest.
Everything in the review is addressed except one point, where I kept map as it was. The changes are pushed to the same branch.
- Terminal:
fon a Ready now row of the plan screen (src/tui/screens/plan.ts) callsputFirst. It uses the same writer-only check and the same flash text as the page, shown as a toast, and the plan reloads afterwards. The README paragraph now covers the terminal key, the page's First button and MCPmap {app, first}. - Tests:
test/map-first-doors.test.tsis new, andtest/tui-plan.test.tsgains one test.- Core: the newest rank wins when a second issue is ranked after the first, and
putFirstreturnsforbiddenfor a reader and for an agent, with no event written. - Page: the map page shows First to writers only and never on the top row, and shows nothing to a reader or a signed-out visitor.
- POST route:
firstSubmitas a writer ranks and redirects. A cross-origin POST and a read token are refused with 403. A reader gets the "only a writer" flash and no event. - MCP:
map {first}is refused for arotoken, for an agent, and for a missing issue. It succeeds for a writer, and a plain read still works with arotoken. - Terminal:
franks for a writer and is refused for a reader.
- Core: the newest rank wins when a second issue is ranked after the first, and
- Where I disagreed: I kept
mapaswrites: false; I did not makefirsta separate write tool. An existing test intest/mcp.test.tspinsmapas read-only, and I may not change tests that passed before. A new tool would also go againstdocs/MCP.md's "action on an existing tool" rule and the size ceilings.- The
rw-scope check forfirstis now explicit in the tool, with a comment saying why. It is tested with arotoken and with an agent. - If you want the flag to be truthful, the honest fix is a separate
ranktool, and that needs the owner's say on the ceiling.
- The
- Not confirmed: I did not check the preview on a narrow screen. The First form is in the row's trailing slot, outside the title link, so it never sits inside an anchor.
Parked by the crew: the check failed ("ranking B over A puts B first and the dispatcher picks it") and the decider saw no point in another try try 1: README.md, docs/MCP.md, src/actions/first.ts, src/core/dependencies.ts (+10 more)
A person can now put a ready issue first, from the MCP or from the map page, and the dispatcher starts it before the rest of what is ready. Pushed to the branch.
I ran
tscand the map, MCP, autonomy and crew-held tests, and all pass, includingtest/mcp-size.test.tsand the newtest/map-first.test.ts. The new test ranks B over A and checks that the dispatcher assigns B and leaves A alone. It also checks that a blocked issue and a closed issue come back invalid. I did not add a test for the First button or its POST route; I only randesign-lint, which was clean.test/map-first.test.tsdoesn't exercise the MCPfirstargument or itsrw-token check either.issue.rankedevent that carries the actor. An issue's newest rank counts, and the latest rank comes first.readyNowinsrc/core/dependencies.tssorts ranked issues ahead of everything else, and the dispatcher takes the top of that list. The rank logic is insrc/core/first_rank.tsandsrc/actions/first.ts.invalid. A rank only reorders what is already ready, so it never lifts the Later gate.maptakes{ app, first: <number> }. The argument is namedapp, notrepo, to match the tool's existing argument, so say if you want it renamed.mapis still marked read-only, so forfirstthe handler requires anrwtoken itself. I regenerateddocs/MCP.md./:owner/:name/map/first, which is handled insrc/web/pages/map_first.tsand checks same-origin and anrwscope.To try it, open a repo's map as a writer and press First on a ready issue. The same thing from the MCP is
map {app, first: N}.Closes #7657