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

The planner can be paused until the open chapter closes #13286

Merged opened this

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

Merged

The planner can now be paused until the open chapter closes, from the queue page, the terminal and the MCP. The new tests, the existing growth and next-growth tests and tsc pass. I did not run the full suite or try the queue page in a browser.

Notes

shipped production is serving it deploy 59903fa

opened this

The planner can now be paused until the open chapter closes, from the queue page, the terminal and the MCP. The new tests, the existing growth and next-growth tests and tsc pass. I did not run the full suite or try the queue page in a browser.

  • How it works: a fourth pause mode, chapter, goes through the same switch the other three do (setPlannerSwitch). The pause is stored as a planner_pause row at a fixed far-future time (CHAPTER_UNTIL), plus the open chapter's id in forge_setting. pausedUntil reads it as lifted once that chapter is no longer open, so shipping or closing a chapter ends it. actions/chapters.ts close is untouched. Any other pause, or switching the planner on, clears the link to the chapter.
  • Where you reach it:

- Queue page: an "until the open chapter closes" option in the pause select. - Terminal: the h key on the queue screen. - MCP: system {kind:"growth", action:"pause", chapter:true}, which previews first and acts on confirm:true.

  • No open chapter: the choice is refused with "There is no open chapter to wait for." and nothing changes.
  • Docs: docs/features/growth.md now says chapters exist and the chapter Not-done line is gone. The issue named a growth.md with a Not-done line; the file is docs/features/growth.md.
  • Tests: test/planner-pause-chapter.test.ts covers the refusal, the form word, the pause holding while the chapter is open (even a year on), the lift at close, and the terminal key. The test closes the chapter by setting its state directly, not through close(), which needs git.

Differences from the issue:

  • Terminal key: the issue asked for c, but c already sets the ceiling on that screen, so I used h.
  • No separate HTTP route: the page's form post to /queue/planner takes mode=chapter. I did not add one.

Not done:

  • Chapter close undone: if a close is taken back within the minute, the chapter is open again and the pause applies again.
  • Lift event: no planner.resumed event is recorded when the pause lifts on its own.

Try it: open a chapter, then on /<owner>/<repo>/queue as the owner choose "until the open chapter closes" and press Pause the planner. The page should read "The planner is paused until the open chapter closes."

The pre-push hook required a "Try:" commit message, so the branch ends with an empty commit carrying it.

🤖 Generated with Claude Code

Closes #13108

3 earlier comments · 1 event
commented

The planner can now be paused until the open chapter closes, from the queue page, the terminal and the MCP. The new tests, the existing growth and next-growth tests and tsc pass. I did not run the full suite or try the queue page in a browser.

  • How it works: a fourth pause mode, chapter, goes through the same switch the other three do (setPlannerSwitch). The pause is stored as a planner_pause row at a fixed far-future time (CHAPTER_UNTIL), plus the open chapter's id in forge_setting. pausedUntil reads it as lifted once that chapter is no longer open, so shipping or closing a chapter ends it. actions/chapters.ts close is untouched. Any other pause, or switching the planner on, clears the link to the chapter.
  • Where you reach it:

- Queue page: an "until the open chapter closes" option in the pause select. - Terminal: the h key on the queue screen. - MCP: system {kind:"growth", action:"pause", chapter:true}, which previews first and acts on confirm:true.

  • No open chapter: the choice is refused with "There is no open chapter to wait for." and nothing changes.
  • Docs: docs/features/growth.md now says chapters exist and the chapter Not-done line is gone. The issue named a growth.md with a Not-done line; the file is docs/features/growth.md.
  • Tests: test/planner-pause-chapter.test.ts covers the refusal, the form word, the pause holding while the chapter is open (even a year on), the lift at close, and the terminal key. The test closes the chapter by setting its state directly, not through close(), which needs git.

Differences from the issue:

  • Terminal key: the issue asked for c, but c already sets the ceiling on that screen, so I used h.
  • No separate HTTP route: the page's form post to /queue/planner takes mode=chapter. I did not add one.

Not done:

  • Chapter close undone: if a close is taken back within the minute, the chapter is open again and the pause applies again.
  • Lift event: no planner.resumed event is recorded when the pause lifts on its own.

Try it: open a chapter, then on /<owner>/<repo>/queue as the owner choose "until the open chapter closes" and press Pause the planner. The page should read "The planner is paused until the open chapter closes."

The pre-push hook required a "Try:" commit message, so the branch ends with an empty commit carrying it.

🤖 Generated with Claude Code

commented

The planner can now be paused until the open chapter closes. It is refused in one sentence when no chapter is open, held while one is open, and lifted when the chapter closes. This push only fixes the failed gate.

This push

  • test/planner-pause-chapter.test.ts no longer casts to as never. It builds the Session and Ctx as as unknown as, the way test/schedules-doors.test.ts does, and gives the key press a full KeyEvent.
  • The "before/after looks" rule asks for a Looks: line or a No look: line in a commit message. The commit carries No look: because this push changes no page. The earlier commit a4292b143 has a Try: line but neither, and the rule's wording suggests it only checks messages the pull adds. src/web/pages/queue.ts changed earlier in this pull, so if the forge still wants a before/after picture of the queue page, the pull needs a Looks: <path> line. forge.json lists no queue page in app.looks, and I did not add one.

bun scripts/gate.ts --fix passes, tsc --noEmit is clean, and test/planner-pause-chapter.test.ts passes (4 tests). I did not run the wider suite; the forge's check does that on push.

Try it

  1. Open /alice/shop/queue as the owner.
  2. With a chapter open, pick "until the open chapter closes".
  3. In the terminal's queue screen, press h. With no chapter open, it toasts "There is no open chapter to wait for."
Changes requested — before the latest push

No high security finding; the switch is gated by maySwitch, the chapter id is read from the db, and nothing is built from user text. Changes needed, all in tests and the MCP door. Fix first: the MCP chapter argument is not in the tool inputSchema, so a client that validates against the schema cannot send it. Then add tests for the page form (mode=chapter post and the select option), the MCP preview and confirm path, and the claim in the last test name. The terminal key assertion is vacuous.

commented

I fixed the MCP schema gap and added the missing tests, and the branch is pushed. test/planner-pause-chapter.test.ts, test/growth.test.ts and test/mcp-write-scope.test.ts pass, tsc --noEmit is clean, and gate.ts --fix changed nothing.

  • MCP schema: the system tool's inputSchema now has chapter: { type: "boolean" }, so clients that validate against the schema can send it. A test reads the schema to confirm.
  • MCP path: one new test covers chapter: true end to end, over /mcp:

- No chapter open: refused with "no open chapter". - Chapter open: the call without confirm previews and changes nothing; with confirm it pauses. - Bad combinations: chapter with resume, with until, as false, or as a string are all rejected.

  • Page form: two new tests cover it:

- Select option: the queue page shows the "until the open chapter closes" option to the owner. - mode=chapter post: it is refused with no chapter open, pauses with one open, and the pause lifts when the chapter closes.

  • Plain-pause test: the old last test is split in two. One now opens a chapter, pauses with owner, closes the chapter and expects the pause still held. The other covers the terminal key.
  • Terminal key: the vacuous assertion is replaced. The test now checks that the h binding is listed as "pause until the chapter closes". Pressing h toasts the refusal with no chapter open. With one open it pauses and toasts "The planner is paused until the open chapter closes."

I did not run the full suite; the forge runs it on the push.

commented

The one failure my change caused was the docs/MCP.md tool-table test. Adding chapter to the system tool's schema made the table stale. I regenerated it with bun scripts/mcp-table.ts, committed it and pushed. test/mcp-table.test.ts now passes.

  • Idle previews: test/apps-idle.test.ts, which holds "previews of idle pulls sleep", passes when I run it alone. The first-pass check had it failing, and my change doesn't touch preview sleeping, so I'm treating it as flakiness under load.
  • Concurrent runs: I did not run "a fresh account's second run waits queued…". It failed at 120 s (a timeout), which is also not something this change reaches. If it fails again on the next check, it needs a look.
Approved

Approving. The earlier asks (MCP schema carries chapter, tests for page/MCP/terminal, regenerated MCP table, no vacuous assertions) are met in this head. Security: the switch still goes through setPlannerSwitch with the owner check; chapter input is validated as a strict boolean; the page option is a select inside the existing post form, so it works without JavaScript. The terminal binding is h, not c, because c already sets the ceiling; that is a sensible, documented deviation. The how-to is in docs/features/growth.md, not README. Non-blocking: no planner.resumed event is recorded when the pause lifts on its own (the builder named this as not done). Note: this clone does not have commit 45fdcfda5299, so I judged the full head rather than the incremental diff.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs