Repository navigation
[lifecycle-RSK] RSK-10: Route stream, ask, and turn-field writes through events #1804
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Tracking
- Epic: [lifecycle-RSK] Run-state kernel #1790
- Size: 1 SP (split if it grows)
- Blocked by: [lifecycle-RSK] RSK-09: Add the turn sub-machine #1800, [lifecycle-RSK] RSK-04: Add the run field, write helpers, and the projection #1794, [lifecycle-RSK] RSK-20: Check abort before an ask posts #1803
- Design doc:
docs/architecture/task-lifecycle-target-architecture.md(not yet onmain) - Ticket plan:
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. didToolFailInCurrentTurn alone has 54 writes in src/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. - Route the turn-field writes:
isWaitingForFirstChunk(4),didRejectTool(10),didAlreadyUseTool(2),didToolFailInCurrentTurn(54), anddidCompleteReadingStream(2). -
resumeAfterDelegationresets (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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity