Repository navigation
Conversation
…es no background work Bug: The previous provider is still running background agents or commands, and switching would end them.
…ders An ACP wake latched continuationRequested and kept its wake buffer until the continuation run started. When Stop cancelled that run while it was still queued, as it is behind a usage limit, nothing released the latch, so hasPendingBackgroundWork stayed true and every provider switch or fresh session was refused until the server restarted. The request now passes onRunEndedWithoutStarting, as the Claude and OpenCode adapters do, and drops the wake traffic the unstarted run would have drained. Bug: The previous provider is still running background agents or commands, and switching would end them.
Contributor
|
Closing: spoukyii already has 3 or more open PRs here, which is the limit for contributors who are not vouched. Once one of them is merged or closed, open this again. See the open PR limit. |
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.
Problem
An Antigravity thread can stop accepting provider or model switches until the server restarts. Each send is refused with "The previous provider is still running background agents or commands, and switching would end them. Wait for them to finish, or press Stop, then send the message again." Pressing Stop does not clear it, and neither does the
agyprocess exiting.How I hit it: a background task delegated from an Antigravity thread finished while the account was at its usage limit. The ACP adapter offered a continuation run for the wake, and that run sat queued behind the limit ("Usage limit reached, retry manually"). I tried to switch the thread to a Claude instance and got the refusal. Stop cancelled the queued run (it ended
cancelledwith nostartedAt), but every later switch was still refused (server trace:message.dispatchfailures at 17:50:19, 17:50:22, 17:50:23,thread.stopat 17:51:08, and another failure at 17:52:21).Expected: once the queued continuation is cancelled, nothing is owed, so the switch goes through.
Change
offerContinuationRuninpackages/provider-acp/src/server/adapter.tslatchescontinuationRequestedand keeps its wake buffer until the continuation run starts.hasPendingBackgroundWorkreports both. A run cancelled while still queued never starts, and the ACP request had noonRunEndedWithoutStarting, so nothing released the latch.ProviderContinuationServicealready calls that hook when the dispatched run ends withstartedAt === null, and the Claude and OpenCode adapters already pass it.The ACP request now passes
onRunEndedWithoutStarting. For the current generation it bumps the generation, clearscontinuationRequested, and drops the wake buffer and the offered wake reports, which is what a started continuation does when it drains them. Background tasks the agent still reports as running keep blocking the switch, as before.This covers every ACP flavour with post-settle continuation (Antigravity, Grok, registry agents).
Scope
A small fix for an obvious leak in an existing contract: the ACP adapter was the one continuation offerer without the never-started hook. No issue filed. #36596 is related but separate. It makes Stop reach work only the adapter's probe sees, and it does not change the ACP adapter.
Verification
AntigravityAdapterV2.test.ts, "leaves no background work when the continuation run ends without starting": a finished daemon wakes the thread, the continuation is dispatched, andhasPendingBackgroundWorkis true. The test then ends the run without starting it and expectshasPendingBackgroundWorkto be false. Onmainit fails witha cancelled queued continuation must release its wake: expected undefined to not equal undefined. With the fix it passes.AntigravityAdapterV2.test.ts,AcpAdapterV2.test.ts,AcpRegistryAdapterV2.test.ts, theProviderContinuationServicetests andBackgroundWorkStop.integration.test.ts: 264 passed.packages/provider-grok: 86 passed, 9 skipped.provider-acpandservertypecheck clean;vp fmt --checkandvp lintclean on the changed files.agyhitting a usage limit. The test drives the adapter with the mock agent the other Antigravity wake tests use.Bug: The previous provider is still running background agents or commands, and switching would end them.
Written with Claude Opus 5.5 in Claude Code, run from T3 Code.