Repository navigation
fix(terminal-input): check the sender before typed text and its Enter are written - #1796
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
|
Merge pass: this touches observe permissions, so this comment records the review. A gate reviewer on a different model than the author's found no blocking issues. This closes the follow-up raised in #1792's review. What was checked:
CI: the first Integration run failed one test,
Notes:
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.ts: the typing that endssubmitTextnow writes the text and its Enter with the sender's liveauthorizeas herdr's write guard. fix(terminal-input): send a long input-line line to the pane's agent as its prompt #1791 and fix(chat): check the sender before a chat message's prompt is written #1792 already do this for bothagentPromptcalls. herdr asks the guard once connected, right before each write.authorize()check before the Enter already does.read_onlyordevice_revoked), not herdr'scancelled.agent.promptanswersagent_not_found,agent_not_ready, oragent_blockedonly by a Codex queue), and mirrored panes.server/core/typed-send-guard.test.ts:read_only;read_only.server/submit.contract.test.ts, next to the observe cases of fix(terminal-input): send a long input-line line to the pane's agent as its prompt #1791 and fix(chat): check the sender before a chat message's prompt is written #1792:types nothing of an input line for a sender that switched to observe while herdr was being reached. A shell recorder pane is used, andpaneSendTextis held before it reaches the isolated test herdr. The sender switches to observe, then the real RPC runs. The test expectsread_only, and that the recorder receives only another client's later line.paneSendTextandpaneSendKeyscalls now expect the guard as well (input-line-send,chat-prompt-guardandoutcome-deliverytests).changelog.d/typed-send-sender-guard.md.Verification
server/coreunit tests 91/91,server/submit.contract.test.ts87/87 (including the existingstill sends the Enter after the sender is gone),src/lib/compose.test.ts51/51.bun run check fast.Queued and held messages (
dispatchPendingText) already pass a guard to their paste, Enter and Escape writes. Claude's draft-clear keys and OpenCode's skill typing pass one as well. A refusal there writes nothing but is reported ascancelled; this PR does not change those two paths.