Repository navigation
fix(session): drain accepted work before lifecycle retirement - #65
Merged
Merged
Conversation
This was referenced Oct 14, 2026
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.
Disconnect, chat close, inactivity and capacity retirement currently enter the same cancellation path as Stop. A provider returning a tool call after FINISH therefore stores it as cancelled and can leave a document partially edited. Cancelled calls also omit terminal live events, and existing clients reload them as processing.
This change keeps lifecycle retirement pending until the turn and all accepted queued/control/background work have drained. Resume/reopen invalidates pending finish checks; lifecycle controls accept only the owning plugin or the session itself. Stop stays reachable while retirement is pending and retains its existing supervised cancellation behavior.
All live children count toward capacity until EXIT, preventing deferred retirement from creating unlimited children. An auto-started plugin with no sessions exits through normal ticker cleanup on shutdown.
Cancelled public tools emit FUNCTION_ERROR only after durable settlement. Recorded intent types keep private/delegation details out of public events. History retains cancelled in storage and projects status=error with outcome=cancelled for existing clients. UI files are unchanged.
Validation:
Companion: wippyai/framework#179
The companion Framework Relay PR replaces idle hub cancellation with cooperative retirement. Deploy both changes for protection beyond Relay's hub inactivity timeout. Existing provider/turn limits and explicit service cancellation/recovery remain in force. The test lock records the published Agent/LLM versions selected by the standard test command; no unpublished behavior/fallback dependencies are added.