Skip to content

Show live elapsed-time timers for tool calls and subagents - #486

Closed
snimu wants to merge 1 commit into
mainfrom
feat/live-timers
Closed

snimu wants to merge 1 commit into
mainfrom
feat/live-timers

Conversation

@snimu

@snimu snimu commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

What changes

Adds live elapsed timers to running tool calls and subagents, then freezes the final duration when work settles.

State ownership

Tools

The existing agent-core tool lifecycle owns timing:

  • AgentState.pendingToolCalls and AgentState.runningToolStartedAt are updated together by the existing tool start/end reducer.
  • The existing finishRun() and reset() boundaries clear IDs and timestamps atomically, including abnormal/aborted runs.
  • AgentSession only serializes this canonical state into connection snapshots.
  • Reconnect/resync seeds timestamps before rebuilding transcript and streaming tool components.
  • Older events/snapshots without timestamps omit the timer instead of fabricating 0s.

Subagents

The parent AgentSession owns subagent timing:

  • active runs own startedAt and terminal durationMs;
  • successful retention carries timing alongside the retained child session;
  • sparse daemon seeds transport the same state;
  • failed deletion blocks late completion retention;
  • timing is removed with child tracking.

Terminal timing is intentionally in-memory only. Older daemon-restored completed children without timing remain compatible and omit the timer rather than receiving a guessed duration.

Presentation

  • Compact shared duration formatting (s, m, h).
  • Timers appear in tool panel status, subagent summary rows, and subagent detail status.
  • One existing UI pulse invalidates active timers; no per-row intervals are introduced.
  • Historical replay without canonical timestamps remains timer-free.

Consolidation

The branch is one commit on current main and follows the test-consolidation approach from #498–#500:

  • no new test files or harnesses;
  • tool lifecycle timing extends existing agent reset/abort coverage;
  • deferred component creation and timestamp preservation share one fixture;
  • running and terminal daemon seed cases are table-driven together;
  • historical no-0s behavior lives in the existing transcript reconstruction regression;
  • redundant timestamp assertions in unrelated activity tests were removed.

The consolidated diff is 441 additions / 187 deletions across 26 files, down from 424 additions / 73 deletions and ten accumulated commits.

Validation

  • npm run check
  • 24 focused agent-core tests
  • focused coding-agent timer, lifecycle, snapshot, and reconstruction tests

Note

Low Risk
Additive optional fields and UI timing; daemon schema revision bump is backward-compatible for clients that tolerate unknown snapshot fields.

Overview
Adds live elapsed-time display for in-flight tool calls and RLM subagents, with frozen final durations when work completes.

Agent core: tool_execution_start now carries optional startedAt; Agent.state exposes runningToolStartedAt alongside pendingToolCalls, cleared on tool end, run finish, and reset.

Coding-agent UI: Tool panels and subagent summary/detail use shared formatLiveDuration / formatDuration helpers. Daemon and connection snapshots include runningToolStartedAt so timers survive attach/resync; daemon schema revision bumps to 3. Subagent runs track startedAt and terminal durationMs, retained with finished child sessions; parent timing feeds daemon child seeds instead of guessing from idle streaming state.

Reviewed by Cursor Bugbot for commit 2769737. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add live elapsed-time timers for running tool calls and subagents

  • tool_execution_start events now carry a startedAt timestamp; Agent tracks per-tool start times in runningToolStartedAt and clears them on completion, reset, or abort.
  • ToolExecutionComponent shows a live M:SS timer while a tool runs and freezes the final duration on completion using new formatLiveDuration and formatDuration helpers in working-icon.ts.
  • Child agent summary and detail views display live elapsed timers for running/queued agents, with dynamic column sizing in the summary list.
  • Daemon attach snapshots now include runningToolStartedAt; resync restores tool timers from canonical start times so reconnecting clients show accurate elapsed time.
  • RLM child run snapshots gain startedAt and durationMs; AgentSession tracks and exposes this timing via getRlmChildRunState, persisting it through retention and failure paths.
  • Behavioral Change: daemon protocol schema bumped to revision 3; clients on revision 2 will not receive runningToolStartedAt in attach payloads.

Macroscope summarized 2769737.

Comment thread packages/coding-agent/src/modes/interactive/components/tool-execution.ts Outdated
Comment thread packages/coding-agent/src/modes/interactive/components/tool-execution.ts Outdated
@snimu
snimu marked this pull request as ready for review July 21, 2026 20:42
Comment thread packages/coding-agent/src/modes/interactive/interactive-mode.ts Outdated
Comment thread packages/coding-agent/src/modes/interactive/components/child-agent-inspector.ts Outdated
Comment thread packages/coding-agent/src/modes/interactive/interactive-mode.ts
Comment thread packages/coding-agent/src/modes/interactive/interactive-mode.ts
Comment thread packages/coding-agent/src/modes/interactive/interactive-mode.ts Outdated
Comment thread packages/coding-agent/src/modes/daemon/daemon-session-list.ts Outdated
Comment thread packages/coding-agent/src/modes/interactive/interactive-mode.ts Outdated
Comment thread packages/coding-agent/src/modes/interactive/interactive-mode.ts
Comment thread packages/coding-agent/src/core/agent-session.ts Outdated
@snimu
snimu force-pushed the feat/live-timers branch from 0950a0d to 23cdaec Compare July 22, 2026 13:35

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 23cdaec. Configure here.

Comment thread packages/coding-agent/src/modes/interactive/theme/working-icon.ts
@snimu
snimu force-pushed the feat/live-timers branch from 23cdaec to 2769737 Compare July 22, 2026 14:08
@snimu snimu closed this Jul 30, 2026
@kevinjosethomas
kevinjosethomas deleted the feat/live-timers branch September 8, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant