Skip to content

fix(desktop): restore turn-elapsed timer across session switches via gateway turn_started_at (salvage #61518) - #87237

Merged
teknium1 merged 2 commits into
mainfrom
salv-61518
Aug 15, 2026
Merged

fix(desktop): restore turn-elapsed timer across session switches via gateway turn_started_at (salvage #61518)#87237
teknium1 merged 2 commits into
mainfrom
salv-61518

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Salvage of #61518 (@yingliang-zhang) onto current main: the turn-elapsed timer reset to 0:00 on session switch / cold resume because the gateway never reported when the running turn began — the desktop's cold-resume path fell back to Date.now().

Complements #86923 (submit-time arm covers turns THIS window started); this covers turns the window did NOT start — cold resume onto a running session, adopted turns — by carrying turn_started_at from inflight_turn.started_at through session.resume and session.info.

Changes

  • Cherry-picked c1041d5 + fb27c1a (@yingliang-zhang, authorship preserved): gateway includes turn_started_at in _session_info() and _live_session_payload(); desktop restores the clock on cold resume from the resume payload (validated numeric, seconds→ms), and the running=true heartbeat prefers the gateway timestamp over Date.now(); shared JSON round-trip fixture pins the contract on both sides.
  • Conflict resolution kept main's live-turn transcript reconcile design (the PR predated it) — only the timestamp extraction was taken from the PR's side of that hunk.

Validation

Result
Desktop vitest (session-actions + message-stream) 148/148 pass
Gateway pytest (protocol + server, resume/turn_started) 18/18 pass
typecheck (3 tsconfigs) clean

Infographic

Timer survives the switch

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on a4ed014 — style: order deep-parent fixture import before siblings (per

⚠️ 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 5m33s vs 5m42s (-2.6%). 21 job(s) slower, 16 faster,

  • Python tests / Run tests slice 4/12: +56.0s
  • Python tests / Run tests slice 9/12: -46.0s
  • JS & TS checks / apps/desktop / check:test:ui:shard-2of3: -44.0s
  • JS & TS checks / apps/desktop / check:test:ui:shard-1of3: +32.0s
  • Python tests / Run tests slice 7/12: -30.0s

@alt-glitch alt-glitch added type/bug Something isn't working comp/desktop Electron desktop app (apps/desktop/*) comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Aug 15, 2026
Rebased onto latest origin/main. Resolved conflicts in:
- use-session-actions.test.tsx: kept both HEAD's image-attachment test
  and PR's turn-clock restoration test (orthogonal features)
- use-session-actions/index.ts, gateway-event.ts, server.py,
  test_tui_gateway_server.py, test_protocol.py: adapted to HEAD's
  refactored structure while preserving PR's turn-origin tracking
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/*) comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants