Skip to content

feat(plugin): Count up worker run time in the agents pane - #132

Merged
4ndreello merged 4 commits into
mainfrom
feat/agents-pane-timer
Sep 25, 2026
Merged

4ndreello merged 4 commits into
mainfrom
feat/agents-pane-timer

Conversation

@4ndreello

Copy link
Copy Markdown
Owner

Show how long each worker has been running in the agents pane (/band), counting up once per second while the worker is live, like Claude Code's own turn timer.

Before, the card's detail line read Working · 3m, and that 3m was the age of the last update, not the run time. It also only moved when a tool.call or turn.complete refreshed the pane.

Now:

  • a live card (working, starting, needs_input) shows now - createdAt: 42s, 3m 07s, 1h 02m 07s. Zero padding keeps the width steady so the card does not jitter every second
  • a finished card kept in the tree (parent of a live child) shows a frozen updatedAt - createdAt
  • history lines keep their last-update age

The tick lives in plugin/hooks/pane-ticker.ts, a small scheduler with injected timers. It runs only while the pane is open and at least one row is live, holds at most one interval, redraws every second without a subprocess, and asks for a data refresh at most every 5 seconds so a worker that finishes while the orchestrator is idle stops counting. register.tsx only wires it to the transitions it already owns.

createdAt was already in codedeck ps --json, so there is no daemon or CLI change.

Worth knowing when reviewing:

  • whether a hooks module can run a clock was an open question (the realm has no process global). It was probed in a live PTY on Claude Code 2.1.282: setInterval fires and can call $.ui.invalidate through a $ captured in session.start. The result is recorded in docs/mods.md
  • closing the pane with the engine's own ✕ still fires no hook, so in that case the tick keeps running until the next toggle or until no row is live
  • the frozen duration of a finished card uses updatedAt, which a later rename also bumps. ps has no end timestamp. Recorded in the spec as a known limitation

4ndreello and others added 4 commits September 25, 2026 00:26
Use createdAt for live and frozen card durations while preserving history ages.

Keep redraws at one second and data refresh to no more than one request per five seconds.

Co-Authored-By: Codex <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@4ndreello
4ndreello merged commit fce1a7d into main Sep 25, 2026
4 checks passed
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