Skip to content

fix(desktop): arm the turn progress timer at submit instead of waiting for message.start - #86923

Merged
teknium1 merged 1 commit into
mainfrom
fix/desktop-turn-timer-submit-arm
Aug 15, 2026
Merged

fix(desktop): arm the turn progress timer at submit instead of waiting for message.start#86923
teknium1 merged 1 commit into
mainfrom
fix/desktop-turn-timer-submit-arm

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

The desktop progress box's timer now arms the instant you hit Enter — previously turnStartedAt was only seeded by the backend's message.start event, 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: seedOptimistic seeds turnStartedAt: state.turnStartedAt ?? Date.now() alongside busy: true; dropOptimistic and 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.start keeps 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 a console.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

Before After
Timer visible after Enter after gateway accept (seconds under load) same frame as send
Backend-originated turns arm on message.start unchanged
Targeted vitest (use-prompt-actions + use-message-stream + status/indicator suites) 309/309 pass, tsc clean

Infographic

Instant turn timer — arms at send, not at gateway accept

…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.
@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 39ee900 — fix(desktop): arm the turn progress timer at submit instead

⚠️ Warnings

OSV vulnerability scan · View job

5 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.


debug info

CI timings

CI timings · View report · View job

Wall time 3m32s vs 4m20s (-18.5%). 12 job(s) slower, 6 faster,

  • JS & TS checks / apps/desktop / check:test:ui:shard-3of3: +33.0s
  • JS & TS checks / apps/desktop / check:test:ui:shard-1of3: -22.0s
  • Check no committed infographics / check-no-committed-infographics: -20.0s
  • JS & TS checks / web / check: +15.0s
  • JS & TS checks / apps/desktop / check:test:desktop:all: +11.0s

@alt-glitch alt-glitch added type/bug Something isn't working comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have labels Aug 15, 2026
@teknium1
teknium1 merged commit f70277b into main Aug 15, 2026
40 checks passed
@teknium1
teknium1 deleted the fix/desktop-turn-timer-submit-arm branch August 15, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants