Skip to content

[Feat] Add privacy-safe diagnostics reports - #2292

Merged
edelauna merged 5 commits into
mainfrom
feature/diagnostics-report-recreation
Nov 2, 2026
Merged

edelauna merged 5 commits into
mainfrom
feature/diagnostics-report-recreation

Conversation

@zoomote2

@zoomote2 zoomote2 Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

​Created by Roomote. Follow up by mentioning @roomote, in the web UI, or in Discord.

Supersedes #1172. This PR recreates that closed, unmerged PR on the current main.

Related GitHub Issue

None. This PR supersedes #1172, which was closed unmerged before review. #1172 had no linked issue.

Description

Adds the Zoo Code: Create Diagnostics Report command to the Command Palette. The command helps users troubleshoot blank or unresponsive webviews, missing history, and failed task or subtask navigation.

The command collects a bounded, structural report and writes it to a temporary JSON file. The extension opens that file and copies the JSON to the clipboard. The report contains version and environment metadata, provider and task state, navigation events, task persistence integrity, webview hydration and sequence state, and theme colors. Failed navigation targets are inspected. Runtime errors appear as fingerprints only.

The report protects privacy. Task identifiers become report-local pseudonyms. The report excludes conversation content, secrets, identity information, file paths, and raw logs. Nothing is uploaded.

Key points for reviewers:

  • New src/services/diagnostics/ module: recorder, request broker, report builder, persistence inspector, and command entry point.
  • ClineProvider records boundary events (provider, webview-in, webview-out, task-history, task-navigation) and answers webview diagnostics requests through a request broker.
  • The webview records hydration, state sequence, tab changes, and unknown message updates, and reports render errors through the error boundary.
  • This port merges with current main. Main added a stale-view guard and a webview heartbeat watchdog. Diagnostics recording runs after the stale-view check. The dispose path keeps the watchdog stop before the diagnostics record. The persistence inspector reads the legacy _index.json by literal name, because current main removed GlobalFileNames.historyIndex. Installs upgraded from older versions may still have that file on disk.

Test Procedure

Automated checks, run from the repository root:

  • pnpm --dir src run check-types
  • pnpm --dir webview-ui run check-types
  • pnpm --dir src exec vitest run services/diagnostics --config vitest.services.config.ts
  • pnpm --dir src exec vitest run activate/__tests__/registerCommands.spec.ts --config vitest.misc.config.ts
  • pnpm --dir src exec vitest run core/webview/__tests__/ClineProvider.spec.ts --config vitest.core.config.ts
  • pnpm --dir webview-ui exec vitest run src/utils/__tests__/diagnostics.spec.ts src/context/__tests__/ExtensionStateContext.spec.tsx src/__tests__/App.spec.tsx src/__tests__/ErrorBoundary.spec.tsx
  • pnpm test

Manual check: run the Zoo Code: Create Diagnostics Report command. The report opens in the editor and the JSON lands in the clipboard.

Pre-Submission Checklist

  • Issue Linked: No approved issue exists. This PR supersedes closed PR [Feat] Add privacy-safe diagnostics reports #1172 and recreates its scope.
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I reviewed my own code with care.
  • Writing Style: The PR title and description use Simplified Technical English (ASD-STE100): short sentences, plain words, active voice, one idea per sentence, no contractions.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Test Helpers (test changes only): Shared test helpers (src/test-utils/, @/utils/test-utils) are used only for mechanical duplication; test intent and scenario-specific mocks remain visible.
  • Visual Snapshot (UI changes only): N/A. This change adds a command and non-visible diagnostics instrumentation. No user-visible webview rendering changes.
  • Documentation Impact: I checked if my changes need documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I read and agree to the Contributor Guidelines.

Visual Snapshots

No visual change to report. The feature adds a command and diagnostics collection. Webview rendering does not change.

Videos (interaction / animation only)

No interaction or animation change to report.

Documentation Updates

Additional Notes

This PR recreates the two commits of #1172 on the current main. Conflict areas resolved against main: message-type unions in @roo-code/types, the registerCommands import block and its spec, ClineProvider watchdog and heartbeat fields, the dispose path, view visibility listeners, the webview message listener, App.tsx and ExtensionStateContext.tsx context changes, and the persistence index file name. Validation passed. The full pnpm test run shows two intermittent extension.spec.ts failures under full-suite parallel load. The same failures occur on pristine main, so they are pre-existing and unrelated to this change.

Get in Touch

0x7777777_

Related PRs

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 1
  • coderabbit-review-active

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

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@zoomote2

zoomote2 Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Re-reviewing new commits now. Follow

  • webview-ui/src/components/ErrorBoundary.tsx:25 — Diagnostics recording happens inside getDerivedStateFromError, a render-phase lifecycle that must stay side-effect free; move the call to the existing componentDidCatch.
  • src/services/diagnostics/persistence.ts:129 — Up to 10 tasks × 2 files (≤25 MB each) are read and fully JSON-parsed in parallel just to count messages and extract timestamps; large ui_messages.json files can transiently spike extension-host memory by gigabytes. Parse sequentially or extract counts/timestamps without materializing the full object graph.

Reviewing d130eb1

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review status

This PR was opened by an automated account. A human maintainer must verify the change intent, provenance, and validation before merging.

Current step: The required review sequence passed. Remaining merge requirements apply.

Review-state labels are managed by this workflow; do not edit them manually. community-approved is managed the same way — do not add or remove it manually. It signals a fresh community code approval for the current head as an advisory priority only; maintainer review is still required.

Comment thread src/services/diagnostics/persistence.ts Resolved
@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

@edelauna
edelauna marked this pull request as ready for review November 1, 2026 17:30
@edelauna
edelauna force-pushed the feature/diagnostics-report-recreation branch from 15596b6 to d930b12 Compare November 1, 2026 17:41
@github-actions github-actions Bot added the awaiting-maintainer CodeRabbit approved; waiting for a human maintainer label Nov 1, 2026
@github-actions github-actions Bot added awaiting-maintainer CodeRabbit approved; waiting for a human maintainer and removed awaiting-maintainer CodeRabbit approved; waiting for a human maintainer labels Nov 1, 2026
@github-actions github-actions Bot added awaiting-maintainer CodeRabbit approved; waiting for a human maintainer and removed awaiting-maintainer CodeRabbit approved; waiting for a human maintainer labels Nov 2, 2026
@edelauna
edelauna enabled auto-merge November 2, 2026 01:45
@edelauna
edelauna added this pull request to the merge queue Nov 2, 2026
@github-actions github-actions Bot removed the awaiting-maintainer CodeRabbit approved; waiting for a human maintainer label Nov 2, 2026
Merged via the queue into main with commit a53ac5c Nov 2, 2026
23 of 24 checks passed
@edelauna
edelauna deleted the feature/diagnostics-report-recreation branch November 2, 2026 04:12
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