carry of #26214: time the live turn instead of its old prompt

Closed
TE
4d ago
+373-45

Carry of #26214: fix(agent-chat): time the live turn instead of its old prompt.

Preserves the original commits and authorship, merges feat-cmux-next, and repairs the missing snapshot lifecycle field. Running turns use their event or summary start time; stale terminal events do not stop a newer turn, and a later idle summary clears working state even if the terminal event was missed.

No capture: the elapsed-time source and lifecycle bookkeeping change without a layout or styling change. Regression tests cover the visible timer state, Stop state, and Continue availability.

Original PR: https://github.com/manaflow-ai/cmux/pull/26214

agent session


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Carries #26214. The agent chat's live "Working for" timer now anchors to the live turn start event instead of the prompt's timestamp, so a resumed session that exposes an older prompt as its opener shows the correct elapsed time.

  • Adds turnStartedAtMs to the snapshot and threads it through the turn view, activity line, and live timer rows.
  • Old terminal events no longer end a newer turn or clear Stop; stale summaries no longer move the clock backwards. An idle summary clears a summary-only turn whose terminal event was missed, while a waiting summary keeps the active turn blocked.
  • Resync rebuilds derive the live turn's lifecycle from the recovered end and start events instead of preserving pre-rebuild state.

No capture: this repair changes the elapsed-time source and lifecycle bookkeeping, with no layout or visual styling change. Existing regression tests exercise resumed turns, summary-only attach, stale summaries, and matching versus old terminal events.