Repository navigation
fix(app): derive waiting steer presentation from execution state - #53880
Merged
Merged
Conversation
A prompt sent while the Session is idle is admitted as a pending steer and was styled as waiting until the server delivered it. Derive whether a pending steer is actually waiting from execution state instead: an idle boundary promotes every pending steer, so a steer waits only once the current execution has delivered input, or when it outlived an execution that ended without delivering it.
3 of 6 tasks
A starting steer keeps normal styling but is still undelivered, so it keeps Move to queue and Delete instead of Revert.
2 of 6 tasks
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.
Issue for this PR
Alternative to #53758, which fixes the same gray pending flash on desktop. Credit to @usrnk1 for identifying the problem and the failure/interrupt recovery case.
Type of change
What does this PR do?
A prompt sent while a Session is idle is stored as a pending
steeruntil the runner promotes it. Before this change, the timeline styled every pending steer as waiting: gray, with queue/delete actions. As a result, normal sends flashed gray until delivery.#53758 fixes this with a client-side
immediaterecord keyed by inbox ID. The client sets it at admission and has to clear it at six separate points. This PR derives the same presentation from state the client already has, so no new client state is needed.data.session.pending.status(sessionID, inboxID)reports where a pending user prompt stands:starting: promoted at the next idle boundary. Either the Session is idle and the prompt is newer than the latestidlemarker, or it is running and the current execution has not delivered input yet.steering: the current execution already delivered user input (a delivered user message appears after the latestidlemarker), so the prompt waits for the next step boundary.stranded: the Session is idle and the prompt predates the latestidlemarker. It outlived an execution that failed or was interrupted before delivering it.queued:delivery: "queue".SessionUserActions.pendingnow takes this status. Gray styling and the "Pending" label apply only tosteeringandstranded. Every undelivered steer, including astartingone, keeps Move to queue / Delete instead of Revert.strandedis kept separate so the UI can later treat it differently, for example by offering a resend.Compared with #53758:
Known limitations:
startingwhile the runner handles that control first. Those steers are still delivered in the same execution: a move continues the drain at the destination without settling it. They are delayed, not stranded.How did you verify your code works?
packages/client/test/solid-pending-status.test.tscovers eight cases: idle send through delivery, a mid-turn steer including queue↔steer changes, rapid follow-ups, stranded steers after failed and interrupted starts, a later execution, a remote idle prompt, and a queued prompt.bun test test/solid-pending-status.test.ts test/solid-inbox-race.test.tsinpackages/client: 14 tests pass.e2e/regression/session-queue.spec.ts(29 tests) passes locally. The Move to queue / Delete case now covers bothsteeringandstartingsteers and asserts the waiting styling for each.bun typecheckpasses inpackages/client,packages/session-uiandpackages/app.oxlintandprettier --checkare clean on the changed files.Requested by: @Brendonovich (Brendan via Slack)