You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[lifecycle-RSK] RSK-10: Route stream, ask, and turn-field writes through events #1804
Design doc: docs/architecture/task-lifecycle-target-architecture.md (not yet on main)
Ticket plan: docs/architecture/task-lifecycle-run-state-kernel-tickets.md (not yet on main)
Context
The stream and ask regions and the turn fields need their writes routed before #1805 flips their reads. didToolFailInCurrentTurn alone has 54 writes in src/core/tools, so this may exceed 1 SP.
Developer Notes
streamStarted where the stream starts (Task.ts:3269). streamEnded in the finally block (Task.ts:3756).
streamCleanupFinished in abortStream, where it sets didFinishAbortingStream (Task.ts:3225).
turnStarted at the per-request reset block (Task.ts:3228-3245).
askSettled with the same askTs in a finally block, so every blocking exit drives it: the abort throw (Task.ts:1679), the superseded throw (Task.ts:1689), and the return (Task.ts:1714). A stale askTs is a no-op (race R-6).
completionAccepted on the accept path in AttemptCompletionTool.ts. Pass the askTs of the completion ask. Task#ask does not return askTs today, so add it to the result object that ask returns as an optional field. Existing callers (about 40 call sites in 22 files, the 3 result types in AutoApprovalHandler.ts, and the test mocks) need no change, because they ignore the new field. Drive completionAccepted right after ask returns, before any other await. That ask has already settled, so the guard reads lastCompletionAskTs, not the ask region.
Route the turn-field writes: isWaitingForFirstChunk (4), didRejectTool (10), didAlreadyUseTool (2), didToolFailInCurrentTurn (54), and didCompleteReadingStream (2).
resumeAfterDelegation resets (Task.ts:2884-2886): delete them. The new instance already has the defaults.
If the change exceeds 1 SP, split per region and keep this issue as the tracker.
Confirm the comparison shows zero untagged divergence and zero untagged rejections on nightly.
Exit criteria: every stream, ask, and turn-field write goes through a helper. The fields stay authoritative. Tests pass.
Reversibility: reads are unchanged, so behavior is unchanged.
Tracking
docs/architecture/task-lifecycle-target-architecture.md(not yet onmain)docs/architecture/task-lifecycle-run-state-kernel-tickets.md(not yet onmain)Context
The stream and ask regions and the turn fields need their writes routed before #1805 flips their reads.
didToolFailInCurrentTurnalone has 54 writes insrc/core/tools, so this may exceed 1 SP.Developer Notes
streamStartedwhere the stream starts (Task.ts:3269).streamEndedin thefinallyblock (Task.ts:3756).streamCleanupFinishedinabortStream, where it setsdidFinishAbortingStream(Task.ts:3225).turnStartedat the per-request reset block (Task.ts:3228-3245).askStartedinTask#askwhere a blocking ask setslastMessageTs(Task.ts:1529, 1550, 1568), after the abort check from [lifecycle-RSK] RSK-20: Check abort before an ask posts #1803. Carry thataskTs. This is the ask identity that the Bug: Multiple execute_command tool calls in single request only ask permission for first command #998 fix needs (PR-6). Do not drive it for a partial ask, which throws at once (Task.ts:1499, 1507).askSettledwith the sameaskTsin afinallyblock, so every blocking exit drives it: the abort throw (Task.ts:1679), the superseded throw (Task.ts:1689), and the return (Task.ts:1714). A staleaskTsis a no-op (race R-6).completionAcceptedon the accept path inAttemptCompletionTool.ts. Pass theaskTsof the completion ask.Task#askdoes not returnaskTstoday, so add it to the result object thataskreturns as an optional field. Existing callers (about 40 call sites in 22 files, the 3 result types inAutoApprovalHandler.ts, and the test mocks) need no change, because they ignore the new field. DrivecompletionAcceptedright afteraskreturns, before any other await. That ask has already settled, so the guard readslastCompletionAskTs, not the ask region.isWaitingForFirstChunk(4),didRejectTool(10),didAlreadyUseTool(2),didToolFailInCurrentTurn(54), anddidCompleteReadingStream(2).resumeAfterDelegationresets (Task.ts:2884-2886): delete them. The new instance already has the defaults.Exit criteria: every stream, ask, and turn-field write goes through a helper. The fields stay authoritative. Tests pass.
Reversibility: reads are unchanged, so behavior is unchanged.