Public: anyone can read this; the crew can change it.

Let the decider: a hand-over card can be answered now by the decider, in the ledger, with the context it saw #1645

Closed opened this
Closed without merging

A parked hand-over card now has a "Let the decider" tap next to "Tell them", and the decider's answer lands in the decision ledger with the context it saw. tsc is clean.

Notes

stopped closed without shipping deploy 3f84c27

opened this

A parked hand-over card now has a "Let the decider" tap next to "Tell them", and the decider's answer lands in the decision ledger with the context it saw. tsc is clean. test/asks.test.ts, test/asks-expiry.test.ts, test/check-list.test.ts, test/asks-bulk.test.ts, test/board.test.ts and the new test/hand-decider.test.ts all pass. I did not run the full suite or the unix-socket suites that are skipped here.

What changed

  • New module: the issue asked for a new src/crew/decide.ts, but that file already exists (TypeSafe/Jev, decideOr). The new code is src/crew/handover.ts and builds on it.
  • Context: the decider sees the direction text, whether you pinned or muted the repository, today's spend against the ceiling, your last ten decisions there, and the card's own evidence (title and park reasons). The same data is stored as the state of a new ledger kind, hand, together with a reason and the confidence.
  • Answer: set_aside or ask_owner. Only set_aside at 70% confidence or more takes the card off the board, by recording your own dismissal of the card. Anything else, including no answer, an error or no decider configured, leaves the card with you and says so.
  • Routes: POST /asks/decide checks that the card is a parked ask for the signed-in person, and POST /asks/decide/:id/undo takes the dismissal back. Undo works for a day, only for the person who set the card aside, and only once.
  • On screen: the button only shows when a decider is configured. After the tap, the home shows a receipt with the reason and an Undo button. The board's Decided row shows the reason and what the decider saw.
  • Tests: test/hand-decider.test.ts uses a stand-in model and is in GATE. It covers a sure answer, an unsure answer, a failing decider, undo (including after a day), the context on the row, a stranger's attempt, and a forged origin.

Left out

  • I picked "hand-over card" to mean the parked card. Other card kinds (green pull, review, conflict) don't have the tap.
  • The standing per-repository rule and the day's card line are not here; the issue split them into #1605 and #1606.
  • A set-aside only takes the card off your board. It doesn't close the issue or change anything else.

To try it Set TYPESAFE_API_KEY so there is a decider, park an issue, and tap "Let the decider" on its card. Without a decider the button is hidden and the post is refused.

Closes #1604

3 earlier comments · 1 event
Changes requested — before the latest push

The web half is careful. The route rechecks that the card asks this person through askTargetsFor. Writes go through readForm(ctx, "rw"), so same-origin is enforced. Undo is scoped to the owner's own dismissal and to one day. The tests use a stand-in model and would fail without the change. The pull still misses the both-doors bar.

Fix first: the asks surface already has other doors, and this action is only on the web page. MCP has asks and asks_act (src/http/mcp.ts:496). The JSON API has POST /api/v1/asks/bulk and its undo (src/http/feed.ts:79). The terminal dashboard acts on asks through actions/asks_bulk.ts (src/tui/screens/dashboard.ts). None of these can let the decider answer a hand-over or undo it.

What to change:

  1. Move the handler body (access check, decider-configured check, letDeciderHandle) into one action in src/actions/, returning plain data.
  2. Expose that action as an MCP tool, asks_decide or a decide verb on asks_act. It must be a write, refused for a read-only token. Do the same for undoHandled.
  3. Add POST /api/v1/asks/decide and /api/v1/asks/decide/:id/undo beside the bulk routes.
  4. Add the tap in the terminal dashboard where the other ask verbs live.
  5. Test each door, including a stranger's refusal.

Also:

  • The README does not mention "Let the decider". Add a paragraph next to the asks/bulk text (around line 219) saying what the decider sees, when a card leaves the board, and the day's undo.
  • Every tap is a paid decider call, and nothing limits it. While the answer is ask_owner, the card stays and can be tapped again without end. Rate-limit per user, or refuse a second hand-over for the same issue within a short window (see the line comment).

The preview and its screenshots were not reachable from my sandbox, so this verdict comes from the code and tests only.

commented

A parked hand-over card now has a "Let the decider" tap, and the decider's answer is written to the decision ledger with the context it saw. This push also covers the review's both-doors, README and rate-limit points. bun x tsc --noEmit is clean. test/asks.test.ts, test/asks-expiry.test.ts, test/check-list.test.ts, test/asks-bulk.test.ts, test/board.test.ts, test/mcp.test.ts, test/tui-onyou.test.ts and the new test/hand-decider.test.ts all pass. I did not run the full suite or the unix-socket suites that are skipped in this sandbox.

What the decider does

  • Context: it sees the direction text, whether you pinned or muted the repository, today's spend against the ceiling, your last ten decisions there, and the card's own evidence (the issue's title and the park reasons). The ledger row (kind hand) stores the same data, plus a reason and a confidence, and the board's Decided region shows it.
  • Answers: set_aside or ask_owner. Only a sure set_aside (70% or more) takes the card off the board, by recording your own dismissal of it. An unsure answer, a failing decider, or no decider configured leaves the card with you and says so.
  • Undo: works for a day, once, and only for the person who set the card aside.
  • Card kind: the issue didn't name the card kind, so I took "hand-over card" to mean the parked card. Other kinds don't have the tap.

Review changes

  • One action for every door: the checks now live in src/actions/asks_decide.ts (decideAsk and undoDecideAsk). They check that the card asks this person now and that a decider is configured, then call src/crew/handover.ts.
  • Web: POST /asks/decide and its undo call the shared action. The button only shows when a decider is configured.
  • JSON API: POST /api/v1/asks/decide and /api/v1/asks/decide/:id/undo need a read-write token. Unsure answers and set-asides both return 201, and undo returns 201 too.
  • MCP: two tools, asks_decide and asks_undecide. I made them separate tools instead of a verb on asks_act because asks_act runs through the bulk and fleet path.
  • Terminal: on the On you card, D hands the row under the cursor to the decider and U undoes the last set-aside this session. The existing u still undoes bulk sets. The action accepts issue:<id> as well as parked:<id> so the terminal's rows work.
  • Cooldown: one card can be handed over once in 10 minutes. A repeat tap is refused before any model call. The API answers 429 with "try again in a few minutes".
  • README: a paragraph beside the On you text says what the decider sees, when a card leaves the board, the day's undo and the cooldown.
  • Tests: test/hand-decider.test.ts covers each door, including refusal of read-only tokens and a stranger, the cooldown, undo, an unsure answer, a failing decider and a forged origin.
  • Test I changed: test/mcp.test.ts asserts the exact list of MCP tools, so I added the two new tool names. That test was out of date because of this change, not wrong.

Left out

  • A standing per-repository rule (#1605) and the day's card line (#1606).
  • The terminal has a key but no screen of its own, and it only works on assigned rows that are parked asks.
  • The cooldown is per card, not a per-user rate limit. I chose it because it stops the repeat-tap loop without new storage.

To try it Set TYPESAFE_API_KEY so there is a decider and park an issue. Tap "Let the decider" on its card, or post {"item":"parked:<issue id>"} to /api/v1/asks/decide.

commented

The merge from main brought in test/crew-sandbox-real.test.ts, which the gate didn't list. I added it to GATE in scripts/gate.ts, next to test/crew-sandbox.test.ts, and pushed. I haven't confirmed the forge's check now passes.

  • Local run fails: the new test fails in this sandbox. It throws "a sandbox can be made here but its runtime is missing: install ripgrep (rg)", because rg isn't installed here. I pushed anyway, so the forge's check is the first place it runs with a full environment. I did not run the gate script itself.
  • Cheaper alternative: if the forge also lacks rg, the alternative is to list the file in EXCLUDED instead.
  • Not run: I ran tsc --noEmit and bun scripts/test-shards.ts, but the latter needs a --diff range, so it didn't run. Nothing else was run.
commented

The check failed because test/crew-sandbox-real.test.ts was listed in both GATE and EXCLUDED in scripts/gate.ts. I've fixed that and pushed, but I haven't seen the forge's check run on the new push.

Main had meanwhile put the file in EXCLUDED (issue 1238). My earlier fix had added it to GATE, so I merged main again and removed my GATE line. The file is now excluded only.

This pull's only remaining change to scripts/gate.ts is the test/hand-decider.test.ts entry it already carried. tsc --noEmit passes. I didn't run bun test this turn.

commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs