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

Parked opened this
Closed without merging

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.

Notes

stopped parked by the crew deploy 1aac13e

opened this

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.ranked event that carries the actor. An issue's newest rank counts, and the latest rank comes first. readyNow in src/core/dependencies.ts sorts ranked issues ahead of everything else, and the dispatcher takes the top of that list. The rank logic is in src/core/first_rank.ts and src/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: map takes { app, first: <number> }. The argument is named app, not repo, to match the tool's existing argument, so say if you want it renamed. map is still marked read-only, so for first the handler requires an rw token itself. I regenerated docs/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 in src/web/pages/map_first.ts and checks same-origin and an rw scope.
  • 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}.

Closes #7657

3 earlier comments · 1 event
commented

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.ranked event that carries the actor. An issue's newest rank counts, and the latest rank comes first. readyNow in src/core/dependencies.ts sorts ranked issues ahead of everything else, and the dispatcher takes the top of that list. The rank logic is in src/core/first_rank.ts and src/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: map takes { app, first: <number> }. The argument is named app, not repo, to match the tool's existing argument, so say if you want it renamed. map is still marked read-only, so for first the handler requires an rw token itself. I regenerated docs/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 in src/web/pages/map_first.ts and checks same-origin and an rw scope.
  • 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}.

commented

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 requested — before the latest push

Changes needed (one round):

  1. 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 calls putFirst (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.
  2. Tests: the button and POST route have no test, and the MCP first argument (rw-scope refusal, ro token refused, agent refused, non-ready refused, missing issue) has no test. Add tests that fail without them: firstSubmit as 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.
  3. Test gaps in core: no test that a second rank of another issue goes ahead of the first, nor that putFirst by a non-writer or an agent is forbidden.

See comments for the rest.

commented

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: f on a Ready now row of the plan screen (src/tui/screens/plan.ts) calls putFirst. 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 MCP map {app, first}.
  • Tests: test/map-first-doors.test.ts is new, and test/tui-plan.test.ts gains one test.
    • Core: the newest rank wins when a second issue is ranked after the first, and putFirst returns forbidden for 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: firstSubmit as 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 a ro token, for an agent, and for a missing issue. It succeeds for a writer, and a plain read still works with a ro token.
    • Terminal: f ranks for a writer and is refused for a reader.
  • Where I disagreed: I kept map as writes: false; I did not make first a separate write tool. An existing test in test/mcp.test.ts pins map as read-only, and I may not change tests that passed before. A new tool would also go against docs/MCP.md's "action on an existing tool" rule and the size ceilings.
    • The rw-scope check for first is now explicit in the tool, with a comment saying why. It is tested with a ro token and with an agent.
    • If you want the flag to be truthful, the honest fix is a separate rank tool, and that needs the owner's say on the ceiling.
  • 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.
commented

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)

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs