Skip to content

fix(web): freeze idle agent elapsed timers - #6238

Closed
vincentmay wants to merge 1 commit into
pingdotgg:mainfrom
vincentmay:agent/fix-idle-agent-elapsed-time
Closed

fix(web): freeze idle agent elapsed timers#6238
vincentmay wants to merge 1 commit into
pingdotgg:mainfrom
vincentmay:agent/fix-idle-agent-elapsed-time

Conversation

@vincentmay

@vincentmay vincentmay commented Aug 11, 2026

Copy link
Copy Markdown

Problem

Codex child agents remain idle and resumable after a turn, so they intentionally have no terminal completedAt. The Agents panel treats those rows as non-live but passed that missing timestamp to elapsedBetween, which falls back to Date.now(). Their displayed run duration therefore kept accumulating idle time whenever the panel rendered.

For example, a child that ran from 21:49:13 to 22:07:16 displayed 44m 47s at 22:34 instead of freezing at its actual 18m 03s duration.

Fix

  • Freeze non-live rows at completedAt when available.
  • Fall back to updatedAt for resumable idle agents, matching the settled-idle behavior from the earlier snapshot implementation.
  • Add a focused SSR regression test using the observed timestamps.

Review history

This exact failure mode was reported by Macroscope during review of #5219, including the same updatedAt recommendation. The finding was automatically marked "No longer relevant as of 4622c3a", but that commit changed timeline folding and its tests rather than AgentsPanel; the elapsed-time calculation remained unchanged and the bug shipped.

Verification

  • pnpm exec vp test run apps/web/src/components/AgentsPanel.test.tsx
  • pnpm exec vp lint apps/web/src/components/AgentsPanel.tsx apps/web/src/components/AgentsPanel.test.tsx
  • pnpm exec vp fmt --check apps/web/src/components/AgentsPanel.tsx apps/web/src/components/AgentsPanel.test.tsx
  • pnpm --filter @t3tools/web typecheck

Made by gpt-5.6-sol using the Codex harness in T3 Code.

Note

Freeze elapsed timers for idle agents at their last update time

In AgentsPanel.tsx, the AgentElapsed component previously had no endedAt for non-live agents without a completedAt (e.g. idle agents), causing the timer to keep counting against the current time. It now uses completedAt ?? updatedAt as the freeze point for all non-live agents. A test suite in AgentsPanel.test.tsx verifies the frozen elapsed time is rendered correctly.

📊 Macroscope summarized 4684703. 1 file reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1e3ea414-a8cc-420b-ae8e-33679a27d187

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Aug 11, 2026
const startedAt = agent.startedAt;
// Idle is resumable, so it has no completedAt. Its latest update is the
// transition that ended the current activation and must freeze the timer.
const endedAt = live ? null : (agent.completedAt ?? agent.updatedAt);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Medium components/AgentsPanel.tsx:92

The endedAt fallback to updatedAt applies to every non-running/waiting status, including pending. When a resumable idle agent is requeued to pending and applyStatus preserves its previous startedAt, the elapsed timer freezes at the old updatedAt timestamp while the row shows "Working." Consider restricting the updatedAt fallback to idle only — pending should be treated as active so its timer runs against startedAt.

-  const endedAt = live ? null : (agent.completedAt ?? agent.updatedAt);
+  const endedAt = live
+    ? null
+    : agent.status === "idle"
+      ? agent.updatedAt
+      : agent.completedAt;
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/components/AgentsPanel.tsx around line 92:

The `endedAt` fallback to `updatedAt` applies to every non-`running`/`waiting` status, including `pending`. When a resumable `idle` agent is requeued to `pending` and `applyStatus` preserves its previous `startedAt`, the elapsed timer freezes at the old `updatedAt` timestamp while the row shows "Working." Consider restricting the `updatedAt` fallback to `idle` only — `pending` should be treated as active so its timer runs against `startedAt`.

@vincentmay vincentmay closed this Aug 11, 2026
@vincentmay
vincentmay deleted the agent/fix-idle-agent-elapsed-time branch August 12, 2026 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant