Repository navigation
chat: rewind through the terminal for every agent - #1577
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
…nd remove dead registry paths (#1890) Fixes #1582 Fixes #1437 Two follow-ups grouped because both touch `server/prompt.ts`: one commit per issue. ## #1582 (rewind follow-ups) - **State file:** the server removes `claude-rewinds.json` from its state directory on start. Only the unreleased Chat rewind (#1500) wrote it, and nothing has read it since #1577. A failure is logged, and the server still starts. - **List-screen fixture:** the recorded rewind message list (`claude-rewind-2.1.304-select-banana-40.txt`, deleted in #1577) is back. - `dialogs/claude.test.ts` checks it holds Chat sends without offering a card. - `core/claude-rewind-send.test.ts` refuses a send on it and types nothing. - **Comment:** `PaneTerminal.css`'s banner comment now names Claude Code too. - **Inlining:** `chatOwnedInput` only returned `lastChatSubmitted`, so its two callers now call that directly. ## #1437 (dialog reader registry) 1. **Reader order is pinned.** `registry.test.ts` lists, per agent, the order its screen is offered to the readers. Swapping two priorities now fails a test (mutation-checked: `claude-question` priority 10 to 25 fails). The snapshot comment now cites `3df0824e`, #1435's base. 2. **The commit key comes from the chosen answer.** `InteractionPlan.commit(answer)` and `terminalFallback(answer)` read the chosen answer's own key sequence, so the loop executes the plan for the answer it validated. Mutating back to `sequences[0]` fails the new test. 3. **Dead paths removed:** - `InteractionPlan.identity`. - `ReaderContext.fallback`: nothing set it, so the three fallback readers never parsed anything. They now only lend their answer behaviour (`reread`), and `parseFallbackPrompt` still draws those cards. - `modelListWaits`: the fallback card's model-list guard calls `registry.waits`, the same Claude-model, Claude-effort and Codex-model check. Tests call it directly. 4. **Parsers run less often.** - `parsePrompt` returns at the first reader that reads the screen instead of running every reader. - A parser several readers share runs once per read pass, through `onePerPass` keyed by the screen and that pass's context object: Claude's approval, Hermes' clarify, pi's dialog and OmO's forms. The other parsers run at most once each, because the pass stops at the first reader that reads the screen. `ReaderContext` is readonly, so a caller cannot change the context mid-pass and get a cached result. 5. **New interaction-plan test:** a move goes out, then the asking ends, and nothing more is sent. - The `picker-asking-before-commit.md` fragment from the issue comment was already folded into 0.4.13 (#1640), so there is no fragment left to drop. ## Verification - `bun test` of the five changed test files: 96 pass. `server/prompt.test.ts`, `server/dialogs`, `server/core`, `outcome`, `pane-routes` and `conversation`: 828 pass, 0 fail. - **Mutation checks:** each of these makes the new tests fail: - swapping a reader priority; - committing from `sequences[0]`; - dropping the start-up removal; - removing the memo's cache hit. - `bun run typecheck`: passes on each commit. - Code review: `omo-native-code-reviewer` approved with no HIGH or MEDIUM findings; its readonly-context LOW is the third commit. Codex (gpt-6.1-sol, xhigh) found no HIGH, MEDIUM or LOW: the early return matched the old eager evaluation in 1,760 comparisons over 80 fixtures, and `registry.waits` matched the removed condition. - `bun run check fast` (through `dori heavy`) on c707e82: `status: success`, with a clean tree and every step ok (typecheck, build, unit tests, generated types and themes, workflow syntax). --------- Co-authored-by: mp <mp@local>
User-facing change
Claude Code messages now offer Rewind in terminal, just like grok and
Antigravity. The action sends nothing, preserves the composer's draft and opens
the same pane's terminal with the existing hint to run the agent's own
/rewind.The user chooses and confirms the rewind in the terminal.
The maintainer's preview returned two HTTP 409 responses after about 3.4 seconds
on Claude Code 2.1.306, while the fixtures covered through 2.1.305. Dialog wording
changes kept breaking the screen-reading walk. This applies the maintainer's
rule: when a feature cannot work reliably from Chat, hand it to the real terminal
rather than forcing it into Chat.
Removed
POST /api/pane/rewind, its shared request/response types, demo response andmachine proxy allowlist entry. Local and machine-prefixed requests now return
404.
artificial transcript overlay, obsolete fixtures and tests, and unused
translations in every locale.
git tag --containsreturned no tags for the merge commits of feat(chat): rewind to an earlier message, and the chat follows #1500 (
c43dffdd) and fix: close the final verification gaps of the agent command capabilities plan #1543(
31bf25fe); both are after v0.4.12. The rewritten fragment describes only theterminal handoff and the retained send protection.
Kept and why
in the terminal once the agent records its new branch. Claude Code records
that branch on the next prompt or command; the bridge no longer invents an
immediate restore based on dialog wording.
these still prevent Chat text from landing in a terminal-opened rewind dialog's
text field. Only the screen parsing and fixtures needed by those guards remain.
Rewind screens no longer produce Chat cards.
them. Their existing browser regression remains green.
/rewindas terminal-only ratherthan advertising the deleted Chat dialog responder.
Scope of related issues
Refs #1189, #1483 and #1507.
restore Chat control with a terminal handoff.
no longer planned by this implementation.
left to survive a terminal cancellation.
This PR does not close those issues.
Validation
HERDR_TEST_MODE=unit bun test --timeout 60000 src/lib/rewindAction.test.ts server/conversation.test.ts server/dialogs/claude.test.ts server/dialogs/registry.test.ts server/core/claude-rewind-send.test.ts server/skills/claude.test.ts server/machines.test.ts: exit 0.bun run check fast: exit 0; workflow syntax, generated types/themes,typecheck, production build, and 5,753 passing / 0 failing / 8 skipped
unit tests in 411 files. Source fingerprint unchanged through the run.
REWIND_QA_EVIDENCE=/tmp/rewind-terminal-only-evidence bun scripts/rewind-browser-qa.ts:exit 0; 12 combinations (Claude Code/grok/Antigravity, 1440/390 px,
dark/light), verifying no terminal input or HTTP mutation, the same pane's
terminal and hint, preserved draft after returning to Chat, and no page errors.
All 24 Chat/terminal captures were inspected. Controls, contrast, mobile
layout, and light/dark coverage pass; the existing terminal hint is readable
and dismissible.
bun scripts/restored-draft-demo-regression.ts: exit 0, all five existingshared draft-recovery scenarios pass.
TMPDIR="$(mktemp -d /tmp/rewind-contracts.XXXXXX)" bun run check run bun test --timeout 15000 server/api.contract.test.ts server/route-envelope.contract.test.ts server/pending-input.contract.test.ts:exit 0, 230 passing / 0 failing contracts, including local and
machine-prefixed rewind-route 404s and the retained rewind-field send guard.
git diff --cached --check: exit 0.Browser QA uses owned demo fixtures and disposable loopback servers, not a live
user session. Contract checks use
bun run check runand its disposable herdrsession, config, state directory and ephemeral server ports.
An initial direct unit invocation timed out in an unrelated Devin cache test;
the documented unit mode and the final fast run both pass. A contract run using
the shared
/tmpreturned 229 passes and one unrelated workspace file-discoveryfailure. The exact file-discovery failure also reproduces on unmodified
ee2daec0(exit 1). The bounded file inventory inserver/files.tsdoes notfind that test's file in this crowded shared temporary directory. No test or
product code was changed to hide it; the final contract run uses a dedicated
TMPDIR.Independent
codex exec -m gpt-6-astrareview: exit 0, APPROVE, noblocking findings. The native child reviewer could not launch because this
session is already at the harness's subagent nesting limit. The Codex reviewer
inspected six captures available at its run; the remaining 18 were subsequently
checked directly. No extra CodeRabbit review was requested.