fix(responses): notice an unreadable MESSAGE reply, not just NEW_TASK - #3116
Conversation
#3021: after an adapter_eof, a delegated subagent's MESSAGE reply reached the parent conversation as a raw gAAAA... payload instead of plaintext or a structured error. hasUnreadableEncryptedAgentTask decides "unreadable" by stripping the routing envelope and asking whether any plaintext survives. AGENT_MESSAGE_ROUTING_ENVELOPE matched only NEW_TASK, so a MESSAGE header was never stripped and counted as surviving text -- a reply whose entire body was one Fernet token measured as READABLE and was forwarded verbatim. Measured on dev before the change, with a structurally valid Fernet token: NEW_TASK -> true (detected) MESSAGE -> false (#3021's case, forwarded) and after: NEW_TASK -> true MESSAGE -> true This is the DETECTION half only. Recovery stays NEW_TASK-only, deliberately: recoverEncryptedAgentTask decrypts, and decrypting a MESSAGE on the parent's behalf would build a plaintext oracle out of a payload the parent's session may have no entitlement to read. Widening the strip only lets the proxy notice that what it is about to forward is unreadable ciphertext, which is what the report asks for -- fail closed rather than paste the token. Mutation-checked: reverting the pattern to NEW_TASK-only fails exactly the two new MESSAGE tests (21 pass / 2 fail). The control test -- a MESSAGE reply that carries real text alongside a token -- stays readable in both directions, so this does not turn every agent reply into a blocked one. Closes #3021.
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe unreadable encrypted-task detector now recognizes ChangesEncrypted MESSAGE detection
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized change prevents ciphertext-only MESSAGE replies from being forwarded as raw payloads while preserving readable replies and existing recovery behavior; no actionable merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The changes address issue Full details: Out of Scope Changes checkExplanation The changes are limited to encrypted-payload detection in src/server/responses/encrypted-payload.ts and regression tests in tests/v2-agent-message-failfast.test.ts. No unrelated production behavior or unrelated files are included.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
리뷰 · 우선순위 68 / 80설명 이 PR은 이슈 #3021을 지금 #3021이 말한 장면은 이렇습니다. Codex App이 로컬 프록시를 타고 네이티브 OpenAI Responses로 부모 작업을 돌리다가, 위임한 자식 에이전트가 있습니다. 부모 턴이 지금 체크아웃의 고치는 범위는 그 정규식 하나입니다. 테스트는 라인 tests/v2-agent-message-failfast.test.ts 138-167 - CXC 테스트만 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
|
Administrator bypass and security-review record\n\nOwner authorization was explicit in Codex session 01a05a34-1e3a-73f2-8607-15e517cbec11 on 2026-09-01 KST. Exact head: 2c33031. Current exact-head check rollup: 0 failing, 0 pending. Independent security review PASS: detection widens fail-closed handling to MESSAGE while decryption/recovery remains NEW_TASK-only, so it does not create a decryption oracle. Using the maintain/admin pull_request bypass documented in MAINTAINERS.md because the author cannot approve their own PR. The bypass is recorded; it does not waive CI or security review. |
Summary
Closes #3021. After an
adapter_eof, a delegated subagent'sMESSAGEreply reached the parent conversation as a rawgAAAA...payload instead of plaintext or a structured error.hasUnreadableEncryptedAgentTaskdecides "unreadable" by stripping the routing envelope and asking whether any plaintext survives.AGENT_MESSAGE_ROUTING_ENVELOPEmatched onlyNEW_TASK, so aMESSAGEheader was never stripped and counted as surviving text — a reply whose entire body was one Fernet token measured as readable and was forwarded verbatim.Measured on
devwith a structurally valid Fernet token, before the change:and after:
Detection, not recovery
This widens the envelope pattern used by the unreadability check.
recoverEncryptedAgentTaskstaysNEW_TASK-only, and that boundary is the point.Recovery decrypts. Decrypting a
MESSAGEon the parent's behalf would build a plaintext oracle out of a payload the parent's session may have no entitlement to read — the reporter's own expected behavior says decryption should happen "only in the owning account/session context". Letting the proxy notice that what it is about to forward is unreadable ciphertext is a different and much smaller thing, and it is the half the report actually asks for: fail closed with a structured error rather than paste the token.The reporter withheld the ciphertext, correctly. None was needed —
structurallyValidFernetTokensalready existed, so the defect was reproducible from the wire shape alone.Verification
Mutation: reverting the pattern to
NEW_TASK-only gives 21 pass / 2 fail —blocks a MESSAGE reply envelope followed only by a Fernet payloadandblocks a MESSAGE envelope carried inside the encrypted slot itself. Restored to 23/0.The third new test is the control: a
MESSAGEreply that carries real text alongside a token stays readable in both directions. Widening the envelope must not turn every agent reply into a blocked one, only the ones with nothing left after the header comes off.tests/agent-task-recovery.test.tsis included to show the recovery path is unchanged.Checklist
bun x tsc --noEmitcleanTriaged in the 2026-08-31 non-priority-70 bug round.
Summary by CodeRabbit
Bug Fixes
MESSAGErouting headers.Tests