Skip to content

fix(pi-agents-tmux): Monitor times are run-times and local wall time (VST-316) - #1438

Merged
Brad (bmethod) merged 3 commits into
mainfrom
vst-316
Aug 17, 2026
Merged

fix(pi-agents-tmux): Monitor times are run-times and local wall time (VST-316)#1438
Brad (bmethod) merged 3 commits into
mainfrom
vst-316

Conversation

@bmethod

Copy link
Copy Markdown
Collaborator

Fixes the two Agents-popup time-display bugs (VST-316).

Left Monitor tree: task rows showed a local HH:MM clock sourced from completedAt ?? updatedAt ?? createdAt — ambiguous (reads as a duration) and jumpy, because registry polls refresh updatedAt every cycle. Rows now show run-time only: elapsed (createdAt → now, minute-granular, <1m under a minute) while active, total (createdAtcompletedAt) once terminal, when a terminal record has no completedAt. updatedAt is no longer a time source anywhere in the tree.

Detail panes: Session Start/Latest and Task Summary Created/Done printed raw UTC ISO; they now render local human time (Mar 24, 16:59, year added when not current). The Task Summary gains a Duration line once the task is terminal — only then, because that text is cached until status changes and a live elapsed would freeze at load time.

Live refresh: with spinner animation disabled and no lifecycle changes the popup never re-rendered, freezing running elapsed. The popup timer now re-renders on a slow (20s) cadence while any task is live — matching the minute granularity of the running display.

Tests: new tests/monitor-times.test.ts (8 pins: elapsed vs clock, updatedAt immunity, terminal stability, no-completedAt dash, <1m granularity, terminal-only Duration, duration shapes, local-time format); two existing dashboard-ux pins updated from the old HH:MM contract. 355 green.

Closes VST-316.

https://claude.ai/code/session_012epxJEzGqT7q3qcFhdZUt5

Copilot AI balanced review requested due to automatic review settings August 17, 2026 12:30
@linear-code

linear-code Bot commented Aug 17, 2026

Copy link
Copy Markdown

VST-316

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@macroscopeapp

macroscopeapp Bot commented Aug 17, 2026

Copy link
Copy Markdown

Approvability

Verdict: Approved f747ed8

This PR improves time display formatting in the monitor UI - switching from ambiguous clock-of-day times to clearer elapsed run-times. Changes are self-contained presentation logic with comprehensive test coverage, no business logic impact.

You can customize Macroscope's approvability policy. Learn more.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Aug 17, 2026

Copilot AI 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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates the tmux agents “Monitor” UI to display human-friendly timing: elapsed/total run-time for tasks (instead of a clock-of-day that jumped on polls) and local wall-time timestamps in detail panes.

Changes:

  • Replace clock-of-day task timestamps with elapsed/total run-time (createdAt → now while running, createdAt → completedAt when terminal).
  • Render local, human-readable date/time strings in session/task detail panes and add a “Duration” line for terminal tasks.
  • Add/adjust tests and bump @vanillagreen/pi-agents-tmux version + changelogs.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pi-extensions/pi-agents-tmux/extensions/subagent/browser/monitor-tree.ts Adds run-duration + local datetime formatting; switches task row labels to elapsed/total run-time.
pi-extensions/pi-agents-tmux/extensions/subagent/browser/monitor-task-detail.ts Uses local datetime formatting and adds terminal-only Duration line in summary.
pi-extensions/pi-agents-tmux/extensions/subagent/browser/monitor-session-detail.ts Uses shared local datetime formatter for Start/Latest timestamps.
pi-extensions/pi-agents-tmux/extensions/subagent/browser.ts Forces periodic re-render so elapsed run-times tick even without spinner animation.
pi-extensions/pi-agents-tmux/tests/monitor-times.test.ts Adds focused tests for duration/date formatting and “updatedAt not a time source”.
pi-extensions/pi-agents-tmux/tests/dashboard-ux.test.ts Updates UX assertions to match the new elapsed/total timing display.
pi-extensions/pi-agents-tmux/package.json Version bump to 2.8.3.
pi-extensions/pi-agents-tmux/CHANGELOG.md Documents the timing display change in the extension changelog.
CHANGELOG.md Notes the extension change in the repo-level Unreleased changelog.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pi-extensions/pi-agents-tmux/extensions/subagent/browser.ts
Comment thread pi-extensions/pi-agents-tmux/tests/monitor-times.test.ts
@bmethod
Brad (bmethod) added this pull request to the merge queue Aug 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 17, 2026
@github-actions

Copy link
Copy Markdown

Merge queue ejected this PR (removed_from_merge_queue, reason: CI_FAILURE). The auto-merge arm is now DROPPED — nothing will merge this PR until someone re-arms it.

Ejecting merge-group run: https://github.com/vanillagreencom/vstack/actions/runs/32031167093 (Skill Tests)

Failing job(s):

No usable same-named comparison on the PR head (checks absent, skipped, or still running) — no flake-vs-genuine call is available; inspect the failing run before re-arming.

Automated by merge-queue-ejection-alert (VST-196). This alert never re-arms auto-merge.

Copilot AI review requested due to automatic review settings August 17, 2026 12:51
@macroscopeapp
macroscopeapp Bot dismissed their stale review August 17, 2026 12:51

Dismissing prior approval to re-evaluate f747ed8

Copilot AI 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.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Suppressed comments (3)

pi-extensions/pi-agents-tmux/extensions/subagent/browser/monitor-session-detail.ts:28

  • formatDurationBetween now sits alongside the new formatRunDuration/monitorTaskRunTime formatting, but it produces a different shape (e.g., 1h 1m vs 1h 01m, and it includes seconds for minute durations while run-time rows do not). This can lead to inconsistent UI output across monitor panes. Consider consolidating duration formatting so session and task durations share a single formatter (or share the same padding/seconds rules) to keep output consistent and reduce future drift.
function formatDurationBetween(start: string | undefined, end: string | undefined): string {
	const startMs = Date.parse(start ?? "");
	const endMs = Date.parse(end ?? "");
	if (!Number.isFinite(startMs) || !Number.isFinite(endMs) || endMs < startMs) return "—";
	const totalSeconds = Math.floor((endMs - startMs) / 1000);
	const hours = Math.floor(totalSeconds / 3600);
	const minutes = Math.floor((totalSeconds % 3600) / 60);
	const seconds = totalSeconds % 60;
	if (hours > 0) return `${hours}h ${minutes}m`;
	if (minutes > 0) return `${minutes}m ${seconds}s`;
	return `${seconds}s`;
}

pi-extensions/pi-agents-tmux/extensions/subagent/browser/monitor-tree.ts:115

  • Passing \"\" as a sentinel for missing completedAt relies on Date.parse(\"\") yielding NaN to produce \"—\". That works, but it’s indirect and makes the terminal-path behavior less explicit. Consider handling the missing-completedAt case directly (e.g., early-return \"—\" when terminal and completedAt is absent) and only calling formatRunDuration(createdAt, completedAt) with a real timestamp.
export function monitorTaskRunTime(record: PaneTaskRecord): string {
	if (monitorStatusIsTerminal(record.status)) return formatRunDuration(record.createdAt, record.completedAt ?? "");
	// Minute granularity while running: the popup refreshes elapsed times on a
	// slow cadence, so a seconds display would visibly lag between renders.
	const elapsed = formatRunDuration(record.createdAt);
	return /^\d+s$/.test(elapsed) ? "<1m" : elapsed;
}

pi-extensions/pi-agents-tmux/extensions/subagent/browser.ts:226

  • The new elapsed-time refresh behavior introduces additional timing constants (20_000, 120) that control render cadence. To make the intent easier to maintain (and to avoid accidental mismatches with the minute-granularity requirement), consider extracting these into named constants (e.g., LIVE_TIMER_INTERVAL_MS, ELAPSED_REFRESH_INTERVAL_MS) and documenting why 20s is the chosen threshold.
	let lastElapsedRender = Date.now();
	const liveTimer = setInterval(() => {
		if (closed) return;
		if (refreshMonitorView()) {
			lastElapsedRender = Date.now();
			requestRender();
			return;
		}
		const hasLiveItems = getActiveItems().some((item) => isDashboardAnimatingStatus(item.status));
		if (spinnersAnimated() && hasLiveItems) {
			lastElapsedRender = Date.now();
			requestRender();
			return;
		}
		// Elapsed run-times tick at minute granularity; keep them moving even
		// with spinner animation off and no lifecycle changes.
		if (hasLiveItems && Date.now() - lastElapsedRender >= 20_000) {
			lastElapsedRender = Date.now();
			requestRender();
		}
	}, 120);

@bmethod
Brad (bmethod) added this pull request to the merge queue Aug 17, 2026
Merged via the queue into main with commit e07fc83 Aug 17, 2026
23 checks passed
@bmethod
Brad (bmethod) deleted the vst-316 branch August 17, 2026 13:21
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.

2 participants