Repository navigation
fix(chat): report the sender's refusal when clearing Claude's restored copy is stopped - #1798
Conversation
…d copy is stopped
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Preserve authorization refusal during draft clearing server/core/composer.ts, server/submit.contract.test.ts, changelog.d/claude-clear-refusal.md |
freeClaudeBox now routes Esc write failures through a refusal handler that preserves an authorization error. The contract test checks the observe-mode race, cancelled key write, read_only result, and skipped agent.prompt call. The changelog describes the updated not-sent message. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related issues
- Issue 1546 concerns same-release changelog entries for Claude Code refusal behavior; this change adds such an entry.
Possibly related PRs
- devswha/ovis#1796: Both changes preserve live sender authorization refusals in writes from
server/core/composer.ts. - devswha/ovis#1792: Both changes preserve sender authorization refusals during chat submission.
- devswha/ovis#1791: Both changes address sender authorization during composer writes, including Claude draft-clear keys.
Merge Risk: 
Minimal · up to 1dcbb
-
The refusal is reported without sending the message, and queued messages are retained. No merge-blocking issue is established.
Pre-merge checks: 
5
-
Full details: Description check
-
Explanation
The description explains the problem, resulting behavior, affected code paths, regression test, changelog entry, and validation results. It uses "Summary" and "Verification" instead of the template's "Change" and "Validation" headings, but it provides the required information.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 unsupported.)
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
Merge pass: this touches queued delivery and observe permissions, so this comment records the review. A gate reviewer on a different model than the author's found no blocking issues. Tests: all pass. That's 91 What the reviewer checked:
Not checked by hand: keeping the draft in the browser. The reviewer read that code but didn't exercise it manually. All required checks are green and no review thread is open. |
…stopped before anything is typed (#1799) ## Summary - `server/core/composer.ts`, the OpenCode `@skill` typing in `submitText`: every write already passed the sender's check as herdr's write guard. Two problems remained. - The check dropped the refusal. - `typed` was set as soon as the check before a write passed, before herdr was reached. - What a sender revoked or switched to watching while the first piece was on its way got: `submit_partial`, "Part of the message was typed into OpenCode's input, but sending was not confirmed... Check the terminal", even though nothing was typed. - Now: - `typed` is set only once herdr's guard lets a write through: the skill writes go through a `SkillAttachIo` that marks it. - The check records its refusal (`read_only`, `device_revoked`, or `submit_timeout`). - A send that typed nothing fails with that refusal. Once something is typed, `submit_partial` stays as before. - The same pattern as #1796 and #1798. - `server/opencode-first-message.contract.test.ts`: `answers a sender that switched to observe while its @skill was on its way with its own refusal, typing nothing`. - It uses the file's verified OpenCode 2.0.32 stand-in. The sender's connection switches to observe right before `@effect` reaches the isolated test herdr, and the real RPC then asks the guard. - It expects `read_only`, and that no write went through and the stand-in received nothing. - The file's pane and connection setup moved into `openCodePane` and `connect`, shared with the first-message cases. - `changelog.d/opencode-skill-refusal.md`. ## Verification - On main the new test fails: the submit answers `submit_partial`. It passes with this change. - `server/opencode-first-message.contract.test.ts` 5/5, `server/submit.contract.test.ts` 88/88. - Unit tests in `server/core`, `server/opencode-skill-attach.test.ts`, `server/opencode-native.test.ts` and `server/conventions.test.ts`: 145/145. - Typecheck, `bun run check fast`. Not changed here: queued delivery types skills through its own guard in `server/core/pending.ts` (open PR #1795 touches that file).
Summary
server/core/composer.tsfreeClaudeBox: the two Esc presses that clear Claude Code's restored copy of the chat's last message already pass the sender'sauthorizeas herdr's write guard, but the guard dropped the refusal. A sender revoked or switched to watching while an Esc was on its way got herdr'scancelled("herdr pane.send_keys was not sent"). The guard now records the sender's refusal, and both Esc writes fail with it:read_onlyordevice_revoked. Nothing more is written either way.freeClaudeBoxserves immediate chat sends and queued delivery (server/core/pending.ts, unchanged here). In queued delivery, a launched agent's first message whose page is still open now treats such a lapse like one just before the Esc: its code (read_only,input_not_ready,pending_lease_lost,disconnected) is a first-message retry code (FIRST_MESSAGE_RETRY_CODES), so the message stays queued instead of being held ascancelled. Other queued messages are held as before, now with the sender's code.server/submit.contract.test.ts, next to the existing restored-copy case:answers a sender that switched to observe while an Esc for Claude's restored copy was on its way with its own refusal. In this test the sender's connection switches to observe while herdr is reached for the first Esc, and the guard is asked as herdrRpc asks it. The test expectsread_only, no Esc written and no prompt sent.changelog.d/claude-clear-refusal.md.Verification
cancelled. It passes with this change.server/submit.contract.test.ts88/88,server/pending-input.contract.test.ts85/85,server/coreunit tests 91/91.bun run check fast.OpenCode's skill typing still reports such a refusal as
cancelled(its typing callback swallows it); it writes nothing either, and is not changed here.