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

Asks: routes so a client can clear the whole queue (resume paused, snooze, group contents, dismiss all kinds) #17966

opened this in answer to

Merged 11h 54m ago, live in production

The four asks from #17960 are done as routes and shared code, with one deviation: proposals are still not dismissible in bulk. New tests in test/asks-clear-queue.test.ts and the existing ask, planner-decline, OpenAPI, lazy-routes, unused-exports and terminal On-you tests pass, and tsc and the gate are clean.

Notes

opened this

The four asks from #17960 are done as routes and shared code, with one deviation: proposals are still not dismissible in bulk. New tests in test/asks-clear-queue.test.ts and the existing ask, planner-decline, OpenAPI, lazy-routes, unused-exports and terminal On-you tests pass, and tsc and the gate are clean. I did not run the full suite, and I did not start the app to try the routes.

What changed

  • Snooze: POST /api/v1/asks/{key}/snooze takes {until}, either an ISO instant or a UTC day, after now and within a year. {until: null} wakes the ask. key is an ask id or its row id, URL-encoded.
    • The snooze is stored in a new ask_snooze table (migration plus pin) and filtered in notDismissed, so the web home, the terminal and GET /api/v1/asks all hide the ask until it wakes.
    • In the terminal's On you pane, z snoozes the marked rows, or the one under the cursor, for a day.
  • Paused asks: POST /api/v1/asks/raise {item: "paused:<repo>"}. The pause is the crew's weekly share running out (week.use), not the forge's daily dollar ceiling, so the route raises week.use by 10 points, up to 100, and answers {item, from, to}. Only a forge admin can use it. At 100 it says the crew waits for the provider's reset. I did not reuse raiseCrewCeiling, because raising the daily ceiling would not lift this ask.
  • Group rows: each row of several now carries changes: [{item, number, numberOf, title}].
  • Dismiss: declined:<run> can now be dismissed in asks/bulk, and undo brings it back. A dismissal is kept per direction issue, so a newer decline asks again.
  • Not done: proposal:<id> is still refused, but the refusal now says why: a wave is approved, redirected or put aside (/asks/proposal/<id>/later, undone by again), not dismissed.

Left out

  • No new MCP tool or asks_act action for snooze or raise.
  • Raise has no way to name a target figure, only the 10-point step.
  • No new terminal screen, so the commit carries a No door: line pointing at the On you pane's z key. The raise has no terminal key; it is API-only.

Reused: askTargetsFor and the fleet dismiss verb for the decline, changeCapacity for the raise, and the queue's notDismissed for the snooze.

Try: on the preview, POST /api/v1/asks/<url-encoded key>/snooze {"until":"<tomorrow>"}, then GET /api/v1/asks. The ask is gone from the list, and from the terminal and web home too. How-to: docs/features/asks-clear-queue.md.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

🤖 Generated with Claude Code

Closes #17960

5 earlier comments · 1 event
commented

The four asks from #17960 are done as routes and shared code, with one deviation: proposals are still not dismissible in bulk. New tests in test/asks-clear-queue.test.ts and the existing ask, planner-decline, OpenAPI, lazy-routes, unused-exports and terminal On-you tests pass, and tsc and the gate are clean. I did not run the full suite, and I did not start the app to try the routes.

What changed

  • Snooze: POST /api/v1/asks/{key}/snooze takes {until}, either an ISO instant or a UTC day, after now and within a year. {until: null} wakes the ask. key is an ask id or its row id, URL-encoded.
    • The snooze is stored in a new ask_snooze table (migration plus pin) and filtered in notDismissed, so the web home, the terminal and GET /api/v1/asks all hide the ask until it wakes.
    • In the terminal's On you pane, z snoozes the marked rows, or the one under the cursor, for a day.
  • Paused asks: POST /api/v1/asks/raise {item: "paused:<repo>"}. The pause is the crew's weekly share running out (week.use), not the forge's daily dollar ceiling, so the route raises week.use by 10 points, up to 100, and answers {item, from, to}. Only a forge admin can use it. At 100 it says the crew waits for the provider's reset. I did not reuse raiseCrewCeiling, because raising the daily ceiling would not lift this ask.
  • Group rows: each row of several now carries changes: [{item, number, numberOf, title}].
  • Dismiss: declined:<run> can now be dismissed in asks/bulk, and undo brings it back. A dismissal is kept per direction issue, so a newer decline asks again.
  • Not done: proposal:<id> is still refused, but the refusal now says why: a wave is approved, redirected or put aside (/asks/proposal/<id>/later, undone by again), not dismissed.

Left out

  • No new MCP tool or asks_act action for snooze or raise.
  • Raise has no way to name a target figure, only the 10-point step.
  • No new terminal screen, so the commit carries a No door: line pointing at the On you pane's z key. The raise has no terminal key; it is API-only.

Reused: askTargetsFor and the fleet dismiss verb for the decline, changeCapacity for the raise, and the queue's notDismissed for the snooze.

Try: on the preview, POST /api/v1/asks/<url-encoded key>/snooze {"until":"<tomorrow>"}, then GET /api/v1/asks. The ask is gone from the list, and from the terminal and web home too. How-to: docs/features/asks-clear-queue.md.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

🤖 Generated with Claude Code

commented

The failing check was /api/v1/asks running 63 SQL statements against a budget of 61. The snooze read I added to the queue ran as its own statement, and the queue is read twice per request.

I folded the dismissals and snoozes into one query (askHolds in src/core/ask_snooze.ts), so the snooze costs no extra statements. test/pages-budget.test.ts now passes, along with tsc, test/asks-clear-queue.test.ts, test/unused-exports.test.ts and test/asks-bulk.test.ts. The gate is clean and the fix is pushed. I did not re-run the full suite.

The rest of the pull is as described before: snooze route and the terminal's z key, raise for paused asks, changes on group rows, and dismissing a declined ask in bulk. Proposals are still refused, with the reason stated.

Try: GET /api/v1/asks on the preview.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

🤖 Generated with Claude Code

commented

The three failing check tests were contract metadata on the two new routes. The OpenAPI contract tests (openapi-errors, openapi-operation-ids, openapi) now pass, tsc is clean, the gate is clean and the fix is pushed. I did not re-run the full suite.

  • Undeclared 404: both routes answer 404 (no such ask), but their contract entries didn't declare it. I changed refuses to [401, 403, 404] on /api/v1/asks/{key}/snooze and /api/v1/asks/raise.
  • Undeclared 403 on snooze: it answers 403 for a read-only token, which wasn't declared either, so it was added with the 404.
  • Undeclared 422: I dropped it from refuses. The routes do return 422 when until is invalid, but the contract probe never triggers it, so the check flagged it as declared and never answered. That leaves the 422 undocumented in the contract; it is still described in the route's refusals text.
  • Summary length: the snooze summary was 109 characters against the 90 limit. It now reads "Snooze one ask until a time on every door; until: null wakes it".

The behaviour in the pull is unchanged: snooze route and the terminal's z key, raise for paused asks, changes on group rows, and bulk-dismissing a declined ask. Proposals are still refused, with the reason stated.

Try: GET /api/v1/openapi.json on the preview. Both routes are listed with 401, 403 and 404.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

🤖 Generated with Claude Code

the crew's run was interrupted: provider limit, resumes 22:23 UTC — every subscription this repository may use is resting (API Error: 402 This request requires more credits, or fewer max_tokens. You requested up to 128000 tokens, but can only afford 4000. To increase, visit https://)
commented

Parked, offered to the crew again: it sat 6 h with no push, so juniper has it now (to review it). No verdict yet. Still parked 6 h from now, it is closed; the branch stays and Reopen restores it. (The forge posts this; nobody wrote it by hand.)

commented

This round fixes the terminal snooze and adds the test @juniper asked for. Raise is still API-only, and the docs now say so.

What changed

  • Terminal z (src/tui/screens/dashboard.ts): it no longer builds the ask key from the row's flags. It takes the row's own ask id from the queue rows, as GET /api/v1/asks lists them.
  • Bug the new test caught: a snoozed assigned issue stayed on the On you pane, because the pane lists assignments straight from listAssignedTo. The pane now skips asks that are asleep, as the web home does.
  • New test (test/tui-onyou.test.ts): it marks two rows and presses z. It then checks the toast says "snoozed 2 until tomorrow", the two snoozed rows are gone, and the unmarked row stays. It failed before the pane fix.
  • Contract: the 422 for a bad until is now declared as the route's own answer (errorStatus) in postApiV1AsksKeySnooze.ts, not in refuses. The openapi probe sends {} to a made-up key, so it gets 404 and can't also reach 422. That test only checks shared refusals against what the probe answers.
  • Refusal test: it now asserts past.body.message is BAD_UNTIL, the shape apiError returns.

What I chose not to do

  • Raise: I added no terminal key or web button. A paused ask isn't a row on the On you pane, so there is nothing to attach it to there. The web home has no snooze control either. docs/features/asks-clear-queue.md now says raise is API-only for now, and that an admin can lift the pause on the Weekly budget knob (week.use) in settings.
  • Door rule: the earlier "No door:" commit line stays as it was.

Checks

  • bun x tsc --noEmit is clean.
  • test/asks-clear-queue.test.ts, test/openapi/* and test/tui-onyou.test.ts pass (699 tests).
  • bun scripts/gate.ts --explain ends with 0 failing rules. It notes three near-duplicate helper pairs in the snooze code and its test, and I did not merge them.
  • I did not run the full suite or the tests that bind a port or unix socket; the forge's check runs those.

To try it: open the terminal's On you pane, press v to mark rows, then z.

🤖 Generated with Claude Code

commented

This adds routes so a client (the iOS app) can clear the whole asks queue. The four routes are listed in docs/features/asks-clear-queue.md:

  • POST /api/v1/asks/{key}/snooze puts one ask or a whole row away until a time. { "until": null } brings it back now.
  • POST /api/v1/asks/raise lets a forge admin add ten points to the crew's share of the week. It is API-only; the docs say so and the commit's No door: line gives the reason.
  • A group row in GET /api/v1/asks now lists changes: each change's number and title.
  • Bulk dismiss now takes a planner's decline (declined:<run>), and undo brings it back.

The web home, the terminal's On you pane (z snoozes the marked rows for a day) and the API all read the same queue, so a snooze holds on every door. The snooze rows live in src/core/ask_snooze.ts. Who may set one is checked in src/actions/asks_snooze.ts.

From review:

  • Group snoozes now match dismissals. A snooze on a row (look:<repo>, <kind>:<repo>) hides only the asks that were already waiting when it was set. To do this, askHolds now returns when each snooze was set (created_at) rather than when it ends. notDismissed in src/web/studio/asks.ts compares that time with each ask's since, as it does for dismissals. A snooze on one ask still hides that ask until it ends. The docs now say all of this.
  • New tests in test/asks-clear-queue.test.ts:
    • A planner's decline is dismissed, then the planner declines the same issue again in a new run, and the ask comes back.
    • A row is snoozed, then a new change arrives in it. Only the new change shows, and waking the row brings back all three.

Each test fails if its comparison is removed. If the decline hold were keyed to the run, the first test would still pass, because the new run has a new ask id.

To check: bun test test/asks-clear-queue.test.ts. The tests that cover asks, dismissals, the page budget and On you pass (557 tests), and so do tsc and the gate.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs