Skip to content

test(interactive): a sealed session refuses input on the control endpoint (#6074) - #6077

Draft
code-yeongyu wants to merge 1 commit into
mainfrom
fix/6074-interactive-sealed-session-refusal
Draft

code-yeongyu wants to merge 1 commit into
mainfrom
fix/6074-interactive-sealed-session-refusal

Conversation

@code-yeongyu

@code-yeongyu code-yeongyu commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

Part of #6074. This PR carries the RED test only; the fix lands after the security design gate on #6074 is approved by a non-author reviewer.

What

prompt, steer and follow_up sent to a TUI session's control endpoint whose session file is sealed (moved away, or a copy revoked with move_session revoke, #4004) must answer the same typed refusal the RPC host sends since #5906, before any turn starts:

{"type":"response","command":"prompt","success":false,"error":"This session was moved to ...","errorCode":"session_moved_away","errorData":{"state":"moved"}}

The test pins both halves of that contract: the typed refusal, and that no turn starts (agent_start stays empty) while the session file stays byte-identical.

Why

packages/coding-agent/src/modes/interactive/session-control-rpc-commands.ts admits input through the session's external admission with no ownership check, so the endpoint answered started and the write guard refused the message only later, when the turn tried to persist it. Three consequences:

  • A client branching on codes could not tell the session was read-only, so a desktop thread could offer an editor for input that is thrown away (desktop app item 4049, tracked internally).
  • A turn started on a session that cannot be written, spending a provider call and surfacing a transcript_write_failed.
  • The answer claimed the input had landed.

Tests

packages/coding-agent/test/suite/regressions/6074-interactive-sealed-session-refusal.test.ts

RED on main (9613617994^): 3 of 4 failed, each on the refusal assertion:

AssertionError: expected { id: 'sealed-prompt', …(4) } to match object { command: 'prompt', …(3) }
-   "errorCode": "session_moved_away",
-   "errorData": { "state": "moved" },
-   "success": false,
+   "success": true,

The fourth case (a session this process still owns admits a prompt and starts its turn) passes, so the failure is the seal, not the fixture.


Summary by cubic

Adds a RED test proving the interactive control endpoint must refuse input into a sealed session before any turn starts.

A session whose file was moved away (or revoked via move_session revoke) is read-only, but the endpoint currently admits prompt, steer, and follow_up, answers started, and only the write guard refuses the message later when the turn tries to persist it. The test pins the typed session_moved_away refusal and that no agent_start event fires and the session file stays byte-identical.

Written for commit 9613617. Summary will update on new commits.

View guided diff Turn on auto-fix

…oint (#6074)

A session file that was moved away, or a copy sealed by move_session
revoke, is read-only here. The interactive control endpoint admits
prompt, steer and follow_up into it with no ownership check, answers
started, and only the write guard refuses the message later, once the
turn tries to persist it.

This is the RED test for the fix: the endpoint must answer the same
typed session_moved_away refusal the RPC host sends since #5906, before
any turn starts, and must leave the file byte-identical.

RED at main: 3 of 4 failed, each on the refusal assertion
(success was true, errorCode absent). The open-session case passes, so
the failure is the seal, not the fixture.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant