Repository navigation
feat(run-state): add the turn sub-machine (#1800) - #2127
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
Review statusThanks for contributing. This comment tracks the review sequence and the next action. Current step: The required review sequence passed. Remaining merge requirements apply. Review-state labels are managed by this workflow; do not edit them manually. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Related GitHub Issue
Closes: #1800
Description
This PR adds the turn sub-machine to the run-state kernel (RSK-09). Nothing is wired. #1804 and #1805 route the writes and flip the reads.
A turn is one request iteration of the loop. The new
turnregion holds the five within-turn fields:TaskfieldwaitingForFirstChunkisWaitingForFirstChunkfirstChunkAwaitStarted,firstChunkAwaitEndedtoolRejecteddidRejectTooltoolRejectedtoolUseddidAlreadyUseTooltoolUsedtoolFaileddidToolFailInCurrentTurntoolFailedstreamReadCompletedidCompleteReadingStreamstreamReadCompletedDesign choices:
turnStartedmaps to the per-request reset block. It clears four fields and keepswaitingForFirstChunk, because the legacy block does not clearisWaitingForFirstChunk. If the chunk loop breaks on the first chunk, the flag stays true. The kernel keeps this behavior, so the later read flip does not change graceful-abort timing.stream.tag.The design doc now lists the
Turntype, the seven events, a transition row for each, and the name mapping.Reviewers must check the
turnStartedchoice that keepswaitingForFirstChunk.Test Procedure
pnpm --dir src exec vitest run core/task/run-state core/task/__tests__/Task.run-shadow.spec.ts.pnpm --dir src run check-types.pnpm --dir src exec eslint --max-warnings=0 core/task/run-state.The new tests cover:
turnStartedresets four fields and keepswaitingForFirstChunkPre-Submission Checklist
Documentation Updates
docs/architecture/task-lifecycle-target-architecture.mdis updated in this PR.Additional Notes
Exit criteria from the issue: the turn sub-machine compiles and is tested. Nothing is wired.
🤖 Generated with Claude Code