Repository navigation
fix(rpc): refuse a write into a sealed session with session_moved_away (#5889) - #5906
Merged
Merged
Conversation
#5889) A prompt, steer or follow_up into a session that is moving or moved is refused at admission with errorCode session_moved_away and errorData.state. Before, a prompt was accepted and failed only when its turn wrote the message, and every refusal carried message text only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #5889 (part 1 of 2: the typed refusal. The copy RPC is part 2).
What
A
prompt,steerorfollow_upinto a session file that is moving or moved (a finished move, or a copy sealed bymove_session revoke, #4004) is refused at admission with:{"type":"response","command":"prompt","success":false,"error":"This session was moved to ...","errorCode":"session_moved_away","errorData":{"state":"moved"}}Before,
steer/follow_upwere refused with message text only. Apromptwas accepted (success:true), and the write guard refused it only later, when the turn persisted the user message. A client branching on codes could not tell the session was read-only.How
SessionManager.getOwnership()exposes the write guard's own incremental fold (SessionWriteGuard.ownership, formerly the privatecurrent). This is the same verdict every persisted write is checked against, so the admission check and the write path cannot disagree.handleClientInputchecks it at the start of a NEW admission and throws the guard'sSessionMovedAwayError. The refusal spread maps that error toerrorCode+errorData.state. A replay of an already admitted id is answered as before.docs/rpc.md: the "Sealed session" refusal.Tests
test/suite/regressions/5889-session-moved-away-prompt-code.test.ts, on the real in-process host with the faux provider. A hosted session gets thesession_movedentry a revoke appends, thenprompt/follow_up/steermust answersession_moved_awaywithstate: "moved"and leave the file byte-identical.errorCode;promptansweredsuccess:true).promptstill failed withsuccess:true.errorData.stateto"moving"fails the test.Summary by cubic
Fixes RPC refusals for writes into a sealed session:
prompt,steer, andfollow_upsent into a session file that is moving or moved (including after amove_sessionrevoke) are now refused at admission witherrorCode: "session_moved_away"anderrorData.state. Before,promptwas accepted (success: true) and failed only later when its turn wrote the message, whilesteerandfollow_upwere refused with text only.Bug Fixes
stateis"moving"while a move is in flight and"moved"once it finished or was revoked, and the file stays readable and untouched.docs/rpc.mdand a regression test over the in-process host.Written for commit d5a07a1. Summary will update on new commits.