refactor(sessions): remove dead _approvalTurnState breadcrumb - #1508
Closed
Aaronontheweb wants to merge 2 commits into
Closed
refactor(sessions): remove dead _approvalTurnState breadcrumb#1508Aaronontheweb wants to merge 2 commits into
Aaronontheweb wants to merge 2 commits into
Conversation
The _approvalTurnState field and its five-subtype ApprovalTurnState hierarchy were write-only: a full-repo grep confirmed no subtype payload was ever read to make a behavioral decision, and no test referenced them. Every reference was a self-referential read (used only to build the next breadcrumb value) or a pure write; the only live side effect was a _currentTurnContext write piggybacked inside the mutators. Remove the field and the hierarchy, preserving every _currentTurnContext write (load-bearing, especially the recovery-time restore in ApplyToolApprovalRequested). ClearApprovalTurnState becomes ClearCurrentTurnContext. Removing the breadcrumb also exposed two dead calls: MarkApprovalRedrive only re-set _currentTurnContext one line after it was already set, and MarkApprovalRunningAfterRedrive was a no-op on the normal tool-completion path. No persisted state changes (the field was transient and never serialized); event/snapshot shapes are untouched.
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.
Removes the dead
_approvalTurnStatebreadcrumb from the session actor. Pure dead-code deletion — no behavior change, no persisted-state change.What it was
_approvalTurnStateand its five-subtypeApprovalTurnStatehierarchy were write-only. A full-repo grep confirmed:Context,PendingCallIds,Recovered,CallId,Reason) was ever read to make a behavioral decision.INoSerializationVerificationNeeded, absent from snapshot/events).The only live side effect inside its mutators was a
_currentTurnContextwrite piggybacked alongside the breadcrumb.What changed
_approvalTurnStatefield and theApprovalTurnStaterecord hierarchy fromToolApprovalState.cs, preserving every_currentTurnContextwrite — these are load-bearing, especially the recovery-time restore inApplyToolApprovalRequested.ClearApprovalTurnState→ClearCurrentTurnContext(body is now just_currentTurnContext = null).MarkApprovalRedriveonly re-set_currentTurnContextone line after it was already set, andMarkApprovalRunningAfterRedrivewas a no-op on the normal tool-completion path.Net:
LlmSessionActor.cs−58 lines,ToolApprovalState.cs−18 lines.Verification
Netclaw.Actors.TestsSessions suite green — includingApprovalRehydrationTests(the primary net for the preserved_currentTurnContextrestore path) andCompactionIntegrationTests.dotnet slopwatch analyze: no new violations. Copyright headers present.History
Supersedes #1502, which paired this removal with a
CurrentTurnScopeextraction. That extraction was dropped — it added a layer of indirection (a new type + a_turn.hop at ~40 sites) without improving type safety, coherence, or simplification, so only the unambiguous dead-code removal is carried forward here.