Repository navigation
fix(coding-agent): cancel prompts before agent start - #143
Merged
Issacboy123 merged 5 commits intoAug 29, 2026
Merged
Issacboy123 merged 5 commits into
Issacboy123 merged 5 commits into
Conversation
Pepps233
approved these changes
Aug 29, 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.
Summary
AgentSession.prompt()could not be cancelled reliably during asynchronous preflight, allowing overlapping work or a user/provider turn to begin after cancellation. This PR adds an optional prompt signal with synchronous lifecycle reservation, pre-start cancellation through authentication and compaction, and handoff to existing abort settlement afteragent_start.Reasoning
The prompt boundary is the narrowest place that owns admission, preflight, and active-run settlement. Reserving there closes overlap races without changing established queueing for unsignaled prompts. Pre-start cancellation preserves the caller's exact reason, while post-start cancellation reuses the session abort path so persistence and event semantics still have one terminal outcome. A rollback-capable compaction append is necessary because cancellation may arrive after persistence but before post-save extension notification completes.
Changes
PromptOptions.signaland synchronous reservations covering prompt preflight through settlement.Testing
node ../../node_modules/vitest/dist/cli.js --run test/suite/agent-session-prompt.test.ts test/session-manager/compaction-rollback.test.tsnode ../../node_modules/vitest/dist/cli.js --run test/suite/agent-session-prompt.test.ts test/suite/subagent-services.test.ts test/suite/subagent-registration.test.ts test/suite/subagent-coordination.test.ts test/suite/subagent-parent-messaging.test.ts test/subagent-controller.test.tsnpm run buildnpm run check