fix(desktop): arm the turn progress timer at submit instead of waiting for message.start - #86923
Merged
Merged
Conversation
…g for message.start The progress box's timer (turnStartedAt) was only seeded by the backend's message.start event, so the submit RPC -> gateway accept -> WS round trip (seconds under load) showed no timer at all. Seed the per-session clock in seedOptimistic at Enter-time; message.start now keeps an existing seed (?? Date.now()) so backend-originated turns still arm there, the active- session mirror reuses the seeded value instead of snapping to accept-time, and the abort/failure paths retire the seed with the turn. Adds a console.debug submit->accept latency probe at message.start.
Contributor
૮ >ﻌ< ა ci reviewran on 39ee900 — fix(desktop): arm the turn progress timer at submit instead
|
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
The desktop progress box's timer now arms the instant you hit Enter — previously
turnStartedAtwas only seeded by the backend'smessage.startevent, so the submit RPC → gateway accept → WS round trip (seconds under load, worse on remote gateways) showed no timer at all while the agent was already working.Changes
use-prompt-actions/submit.ts:seedOptimisticseedsturnStartedAt: state.turnStartedAt ?? Date.now()alongsidebusy: true;dropOptimisticand the submit-failure path retire the seed with the turn (guarded so a racing queued send can't wipe a live turn's clock).use-message-stream/gateway-event.ts:message.startkeeps an existing seed (state.turnStartedAt ?? Date.now()) instead of resetting — backend-originated turns (queue drains elsewhere, goal follow-ups) still arm there; the active-session mirror (setTurnStartedAt) reuses the seeded value so the visible timer can't snap back at accept-time; adds aconsole.debug('[turn-accept-latency]')probe measuring submit→accept.use-prompt-actions/index.test.tsx: 2 regression tests (submit-time arm;??guard preserves a pre-existing live clock) — both proven to fail against the pre-fix behavior via sabotage runs.Validation
Infographic