fix(web): refresh resource timeline while diagnostics is open#30528

merged1
main
GitHub fork: fix/diagnostics-history-refresh
opened8d agobySshawk08033
View on GitHubTwo-way sync enabledPR last imported 6d ago

Diagnostics subscribes to live process samples but reads timeline history only once. On a fresh monitor, the timeline stays empty while live counters update; clicking refresh immediately shows the retained samples.

Refresh the existing history query every five seconds while it is observed, and dispose it immediately when the view closes so polling stops. This is a focused stale-data bug fix under the small, obvious bug exception: it updates the existing timeline from the same RPC and leaves sampling, retention, contracts, and controls unchanged.

Fixes #30520.

Verification:

  • Added a regression test that fails on current main (dd69b3166561): history is read once instead of refreshing. It passes with the fix and checks that polling stops after unmount.
  • vp run check:changed passed: formatting, lint, both knip checks, affected typechecks (including web, desktop, and mobile), and all 34 tests in server.test.ts.
  • Real Browser panel verification on Linux against an isolated dev server, copied/pruned development data, and the native monitor built from this checkout: unpatched main remained empty while live counters changed; manual refresh populated both rows with 69 samples. With the fix, the timeline populated automatically after the monitor restarted, and sample counts increased from 11 to 16 without manual refresh.
  • The affected entry point is Settings > Diagnostics, shared by web and desktop. Mobile currently has no consumer of this history query. The fix uses the existing environment-scoped RPC query mechanism; no provider or transport changes. Packaged Electron and relay/tunnel connections were not separately exercised.

Evidence is attached to an evidence-only prerelease in my fork, outside the source history:

Before recording · After recording: timeline updates without clicking refresh

The after recording keeps the Resource timeline visible throughout; monitor/server sample counts increase automatically (127 to 151 during the capture).

Implemented with GPT-6.1 Sol through the Codex harness in T3 Code.

Checks

24 successful · 13 skipped · 1 neutral
All checks passed
c7e11a6

Added 1 commit

  • fix(web): refresh resource timeline while diagnostics is openc7e11a6
Synced from GitHub

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — Diagnostics history will automatically refresh every five seconds while observed, with polling stopped when the query is disposed. This changes the default refresh behavior and request cadence, which requires human acceptance.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The resource telemetry history query now refreshes every five seconds and uses a zero idle TTL. A test verifies periodic reads while the history atom is mounted and confirms reads stop after unmount.

Changes: Resource history updates

Layer / File(s)Summary
History polling and lifecycle validation
packages/client-runtime/src/state/server.ts, packages/client-runtime/src/state/server.test.ts
The history query now polls every five seconds and uses a zero idle TTL. The test verifies timer-triggered reads and confirms that reads stop after unmount.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

Suggested labels: bugfix, size:S

Suggested reviewers: t3dotgg, juliusmarminge, macroscopeapp

Merge Risk: External image Minimal · up to c7e11

The timeline refreshes while Diagnostics is open. No merge-blocking risk was identified.

Pre-merge checks: Passed 4
Check nameStatusExplanation
Title checkPassedThe title "fix(web): refresh resource timeline while diagnostics is open" matches the main change. The PR adds five-second polling to the existing resource timeline history query while the Diagnostics…
Linked Issues checkPassedIssue #30520 requires the Diagnostics resource timeline to update without manual refresh. server.ts adds a 5-second refresh interval to the existing resourceTelemetryHistory query and sets `idleTt…
Out of Scope Changes checkPassedThe change is limited to the existing resource telemetry history query and its regression test. The implementation does not change sampling, retention data, RPC contracts, or controls. The test direct…
Description checkPassedThe description includes all required sections: Problem, Change, Scope and approval, and Verification. It explains the bug, the implementation, the small obvious bug exception and linked issue, focuse…
Full details: Title check

Explanation

The title "fix(web): refresh resource timeline while diagnostics is open" matches the main change. The PR adds five-second polling to the existing resource timeline history query while the Diagnostics view is open, and stops polling on unmount. The title follows the conventional commit format and is specific. It names the web scope, though the change also applies to the desktop app through the shared Diagnostics entry point. That is a minor scope note, not a mismatch.

Full details: Linked Issues check

Explanation

Issue #30520 requires the Diagnostics resource timeline to update without manual refresh. server.ts adds a 5-second refresh interval to the existing resourceTelemetryHistory query and sets idleTtlMs: 0, so the query stops being retained when unmounted. server.test.ts verifies the initial read, the timed refresh, the updated sample count, and no reads after unmount.

Full details: Out of Scope Changes check

Explanation

The change is limited to the existing resource telemetry history query and its regression test. The implementation does not change sampling, retention data, RPC contracts, or controls. The test directly verifies the requested polling lifecycle, so no unrelated change is demonstrated.

Full details: Description check

Explanation

The description includes all required sections: Problem, Change, Scope and approval, and Verification. It explains the bug, the implementation, the small obvious bug exception and linked issue, focused regression coverage, manual verification, untested connection modes, evidence, and the agent model and harness.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
External image Recent review info
External image Run configuration
External image Commits

Reviewing files that changed from the base of the PR and between dd69b316656119b4613b13f3c076f45d4dbda2ce and c7e11a61f3cb0cf509ce6e65a2b43a514c7c1a4a.

External image Files selected for processing: 2
  • packages/client-runtime/src/state/server.test.ts
  • packages/client-runtime/src/state/server.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Note

Written by gpt-6.1-sol on behalf of Maria

Verified in a real dev environment

verified as-is at c7e11a61f3cb0cf509ce6e65a2b43a514c7c1a4a on a disposable linux vm. used repository Playwright with /usr/bin/google-chrome, one background dev server at a time, isolated empty development databases, and the real native resource monitor. created the same project pointing at a real git checkout through the app and completed Codex gpt-6.1-sol turns through the web composer on both revisions. no mocks, fixtures, replay provider, or source changes.

  • before: on github/main (d51bc58f5e05123a416a3737ac4bce42d1d76b7c), opened settings > maintenance > diagnostics, installed the missing native monitor, and clicked retry monitor. live counters updated, but the resource timeline stayed empty for 52 seconds. manual refresh immediately displayed 53 server/monitor samples and retained provider processes.
  • after: repeated the fresh-monitor recovery on the exact pr head. the timeline populated automatically and reached 21 samples without manual refresh. websocket history requests arrived at 0.055, 5.294, 10.301, 15.317, and 20.338 seconds after retry. the recording shows the empty timeline filling and sample counts growing to 16; the later screenshot shows 21.
  • nearby behavior: switching from 15m to 5m sent windowMs=300000, bucketMs=15000; manual refresh sent another history request; returning to 15m restored its parameters. leaving diagnostics for general settings produced zero further history requests over 34 seconds. reopening resumed polling and displayed fresh history, including the real Codex process after a successful follow-up turn.
text
1main: vp i; background vp run dev --no-seed
2 server=16733 web=8693; reproduced stale timeline; stopped captured process group
3head: vp i; background vp run dev --home-dir /home/user/t3code/.t3 --no-seed
4 server=13773 web=5733; automatic history updates and lifecycle checks passed
5blacksmith: vp test run packages/client-runtime/src/state/server.test.ts
6 1 file passed, 34 tests passed

same viewport, project, prompt, 15m window, and fresh-monitor recovery scenario; resource values are measured independently on each run. inspected captures and verified uploaded video playback and seeking.

main: healthy monitor but empty resource timeline

pr: resource timeline updates automatically to 21 samples

pr: empty timeline fills automatically and sample counts increase

Not verified

packaged electron, native ios/android, macos/windows host signals, and relay/tunnel or multiple-environment connections were not exercised on this linux vm. mobile has no consumer of this history query. other provider adapters were not exercised; this change uses the existing environment history RPC and does not change provider protocols. CI is green; the local verification ran the focused existing test file through blacksmith rather than rerunning the full CI suite.