fix(app): drain a queue whose agent stopped running unobserved - #2994
Closed
lxsolutions wants to merge 1 commit into
Closed
lxsolutions wants to merge 1 commit into
lxsolutions wants to merge 1 commit into
Conversation
Queued messages only go out on `onAgentStoppedRunning`, which fires on a running -> not-running transition in the directory replica. An agent that finished its turn while this client was disconnected, backgrounded, or had not yet loaded the directory has no transition left to observe once the app catches up: `reconcileAgentDirectory` only reports an agent whose previous known status was `running`. The queue then sits until the user sends it by hand. Re-check the queues against current state once the directory bootstrap has settled, and send for any agent that is holding one and is not running. Related to getpaseo#2991 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lxsolutions
force-pushed
the
fix/2991-drain-stranded-queue
branch
from
August 8, 2026 06:40
268e865 to
c9e3e1b
Compare
11 tasks
Collaborator
|
Closing in favor of the implementation merged in #4160. |
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.
Linked issue
Related to #2991
Deliberately not
Closes— see Not covered below. This fixes a real path that produces exactly the reported symptom, but #2991 has no logs, so I can't prove it is the path the reporter hit.Type of change
Reasoning
A queued message is only sent by
onAgentStoppedRunning, which fires from the directory replica on a running -> not-running transition.reconcileAgentDirectorycomputes that set by comparing the incoming snapshot against the previously known status:So the send depends on this client having personally watched the agent go from running to idle. If the turn ended while the app was disconnected, backgrounded, or had not yet loaded the directory, the agent is simply already idle by the time the app catches up. There is no transition left to observe, nothing calls
drainQueuedAgentMessage, and the message sits in the queue until the user presses send by hand — which is the reported behaviour.The queue is durable state, but the only thing that moves it is a one-shot in-memory edge. This adds the missing level check: once the directory bootstrap has settled and the app's view of agent status is current, re-check the queues and send for any agent holding one that is not running.
Goals
Non-goals
result.status === "failed"still only logs). Worth doing, but it is a separate failure mode from the one here.QA
67 = the 65 that existed plus the 2 added here:
drains a queue whose agent stopped running unobserved— agent seeded as alreadyidlewith a non-empty queue, no transition ever observed. Fails onmain(nothing sends), passes here.leaves a queue alone while its agent is still running— the guard in the other direction, so the sweep can't send into a live turn.npm run typecheck --workspace packages/appreports one error, insrc/components/draggable-list.native.tsx(122,7)— areact-native-draggable-flatlistprop typing issue. It reproduces identically on a clean checkout ofmainwith these changes stashed, so it is pre-existing and unrelated. No new type errors.Platforms: logic change in
HostRuntimeStore, no UI. Covered by the app unit suite, which is platform-agnostic. Not separately exercised on iOS, Android, web, or Electron.Not covered: