Skip to content

refactor(settings): remove the Diagnostics page and the dry-run server Doctor - #250

Merged
GoDiao merged 2 commits into
GoDiao:mainfrom
iruzen-dono:refactor/remove-diagnostics-settings
Nov 14, 2026
Merged

GoDiao merged 2 commits into
GoDiao:mainfrom
iruzen-dono:refactor/remove-diagnostics-settings

Conversation

@iruzen-dono

@iruzen-dono iruzen-dono commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

What this does

Removes the Diagnostics settings tab, the /doctor command and the dry-run half of the server Doctor, keeping every part that still has a user.

  • Desktop: deletes pages/DiagnosticsSettings.tsx and the doctorApi client. Settings loses the tab (and SettingsTab loses 'diagnostics'), and the desktop /doctor slash command in the composer is removed with it. runDoctorRepair becomes the local repair only, so DoctorPanel no longer awaits a server round trip and drops its loading state.
  • CLI: deletes commands/doctor/ and its entry in commands.ts.
  • Server: deletes api/doctor.ts, services/doctorService.ts and router.ts's doctor case.
  • i18n: 28 keys removed from both en.ts and zh.ts (the 24 that only the deleted page used, plus settings.tab.diagnostics, doctorFailed, doctorServerRan, doctorServerUnavailable). The two files stay the same size: 2111 → 2083 lines in each.
  • Behaviour: a request that fails because the server was never reached is no longer recorded as a diagnostic event.
  • Docs: the two files under docs/features/ui-refresh/ that still listed the tab and pages/DiagnosticsSettings.tsx are updated to match.

27 files changed, +37 / −1469, no lockfile touched.

Decisions worth reviewing

The unreachable-server guard is narrow on purpose. reportApiFailure is now skipped when fetch itself rejects with a TypeError, which is what an unreachable or refused server produces. It is still recorded for everything else, including timeouts: mcpDiagnostics.test.ts locks the redaction of MCP environment values on the timeout path, and a timeout means the server was reachable but slow, which is a different signal from the log the issue describes. My first version dropped every non-ApiError and broke those two tests; the narrower guard keeps that coverage and fixes the noise.

Kept deliberately: screens/Doctor.tsx, utils/doctorDiagnostic.ts and doctorContextWarnings.ts still serve the dreamcoder doctor CLI subcommand and the version notifications, not the removed page. Same for lib/diagnosticsCapture.ts (the error boundary feeds it), /api/status/diagnostics (Settings config directories) and /api/computer-use/doctor.

Tests

desktop/src/api/client.test.ts gains one test: a TypeError('Failed to fetch') rejection makes exactly one request, i.e. no diagnostic event is posted. It fails without the patch:

AssertionError: expected "fetch" to be called 1 times, but got 2 times

Three existing tests encoded the removed behaviour and are updated, not deleted: the /doctor alias expectation in composerUtils.test.ts, the ordering against the Diagnostics tab in generalSettings.test.tsx, and the fallback slash-command count in pages.test.tsx (14 → 13).

Gates, all three from .github/workflows/ci.yml, run locally on Windows 11 with Bun 1.3.14 (CI uses 1.4.2):

Gate Result
bun run lint (tsc, tsc -p electron, oxlint) pass
bun run test -- --run (desktop, vitest) 5 tests fail in 4 files; the same 5 fail on main untouched
bun test (server + CLI) 11 tests fail in 7 files; the same 11 fail on main untouched

This working copy is on Windows, where those tests already fail on main with no changes at all: prepare-ripgrep (5), artifact symlink and path checks (4), canvas artifacts (1), DiagnosticsService (1), plus two ActiveSession context tests, LocalSlashCommandPanel, MessageList and UpdateChecker. I checked main out and re-ran the same files in the same checkout: the failing tests are the same ones, so none of them is part of this diff.

Two failures appeared once under full-suite parallel load and not again: KanbanPage (passes 3 of 3 in isolation on this branch, passes on main, passes in a second full run on this branch) and two WebSocket Chat Integration 5-second timeouts (conversations.test.ts is 65 passed / 0 failed run alone on this branch). Neither is attributed to this change.

Not done

  • The dreamcoder doctor CLI subcommand stays, as it is the only caller left of screens/Doctor.tsx. If you want that gone too, it is a small follow-up.

Resolves #248

Copilot AI balanced review requested due to automatic review settings November 13, 2026 20:01

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

…r Doctor

Report a problem already collects the recent errors and exports the
diagnostics bundle, and Doctor still appears on the crash screen and the
startup error screen, where it is needed. The Diagnostics tab, the /doctor
command and the server half of Doctor duplicated that, and the tab's
warning count was mostly requests failing while the server was starting.

The desktop Doctor keeps the local repair of the safe UI keys, and a
request that fails because the server was never reached is no longer
recorded as a diagnostic event; a request the server rejects still is.
@iruzen-dono
iruzen-dono force-pushed the refactor/remove-diagnostics-settings branch from cccc61f to a4f67bb Compare November 13, 2026 20:07

@GoDiao GoDiao left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for the cleanup. Removing the Diagnostics page and the server Doctor looks right, the TypeError filter in client.ts is fine, and nothing was over-deleted: the remaining settings.diagnostics.* keys, DoctorPanel, the computer-use doctor and the problem-report endpoints are all still in use. CI is green.

A few things are still left behind, so I'm requesting changes.

Must fix

1. Item 3 of #248 isn't done: the endpoints and client methods that only the Diagnostics page used are still there. After this PR nothing calls them:

  • desktop/src/api/diagnostics.ts: getStatus, getEvents, openLogDir, clear (lines 54-59) and the types DiagnosticsStatus and DiagnosticEvent. Please also remove recordEvent with DiagnosticEventInput and DiagnosticSeverity. They were already unused on main, because the client sends events through rawRecordDiagnosticEvent in client.ts. Keep getProblemReport, exportBundle and revealExport.
  • src/server/api/diagnostics.ts: DELETE /api/diagnostics, GET /api/diagnostics/status, GET /api/diagnostics/events and POST /api/diagnostics/open-log-dir. Keep POST events, GET report, POST export and POST reveal-export.
  • src/server/services/diagnosticsService.ts: getStatus, the DiagnosticsStatus type, openLogDir, clear, and getDirectorySize, which only getStatus uses. Keep readRecentEvents, because problemReport.ts and the export bundle use it.
  • src/server/__tests__/diagnostics-service.test.ts (around lines 188-243): drop the status, GET events and clear assertions, and keep the parts covering POST events and export.
  • scripts/repro-issue-247-real.ts:76 calls GET /api/diagnostics/events. Please delete the script or update it so it doesn't depend on the removed route.

2. Several messages still tell users to run /doctor, which this PR removes. The dreamcoder doctor CLI subcommand still exists. Point these messages at it, or drop the clause:

  • src/utils/sandbox/sandbox-adapter.ts:584: "run /sandbox or /doctor for details". With sandbox.failIfUnavailable, this text reaches the desktop in the CLI exit error.
  • src/services/api/errorUtils.ts:99: "Run /doctor for details."
  • src/skills/bundled/keybindings.ts:232, 234, 279 (the SECTION_DOCTOR text).
  • src/commands/reload-plugins/reload-plugins.ts:53
  • src/components/mcp/MCPSettings.tsx:150
  • src/hooks/notifs/useSettingsErrors.tsx:38
  • src/keybindings/KeybindingProviderSetup.tsx:84

Code comments that mention /doctor in files you don't otherwise touch can stay.

Should fix

3. The English error boundary text still points at the removed page. errorBoundary.description in en.ts:438 says "The error was recorded in Diagnostics." Please reword it, for example "The error was recorded in the diagnostics log." The Chinese text (zh.ts:440) is fine as is.

4. Docs and mockups still list Diagnostics.

  • docs/features/ui-refresh/design-log.zh.md:339 still has "本机:终端、H5 访问、Computer Use、诊断". You updated line 98 of the same file but missed this line.
  • docs/features/ui-refresh/mockups/dreamcoder-complete-study.html and dreamcoder-preview.html still have the 诊断 settings page (prefsDiagnostics and its diagnostic-copy / diagnostic-clear actions) and /doctor in the command list. Please remove them so the mockups match the app.

5. doctorShownAtSession in src/utils/config.ts:195 is never read or written anywhere. It's an older leftover, but it belongs to the same Doctor cleanup. Please remove it.

Item 3 of GoDiao#248 was not done: the endpoints and client methods that only
the Diagnostics page used were all still there with no callers left.

- desktop/src/api/diagnostics.ts: drop getStatus, getEvents, openLogDir,
  clear and recordEvent, plus the types they needed. getProblemReport,
  exportBundle and revealExport stay.
- server: drop DELETE /api/diagnostics, GET status, GET events and
  POST open-log-dir, with the service methods and getDirectorySize that
  only served them. readRecentEvents stays for the problem report and
  the export bundle.
- the API test keeps POST events and the export, and
  scripts/repro-issue-247-real.ts reads the log through the service
  instead of the removed route.

Messages that sent users to the removed /doctor slash command now name
the `dreamcoder doctor` CLI subcommand, which still renders the same
screen: sandbox-adapter, errorUtils, the bundled keybindings skill,
reload-plugins, MCPSettings, useSettingsErrors and
KeybindingProviderSetup.

Also: the English error boundary text no longer says the error was
recorded "in Diagnostics" (its test follows), design-log.zh.md line 339
and both UI mockups drop the Diagnostics tab, and the unused
doctorShownAtSession config field is gone.
@iruzen-dono

Copy link
Copy Markdown
Contributor Author

Done in 2bace5b. All five points.

1. Item 3 of #248 — the orphaned surface is gone.

  • desktop/src/api/diagnostics.ts: removed getStatus, getEvents, openLogDir, clear, recordEvent, and the types DiagnosticsStatus, DiagnosticEvent, DiagnosticEventInput, DiagnosticSeverity. getProblemReport, exportBundle and revealExport stay — ReportProblemDialog is their only consumer.
  • src/server/api/diagnostics.ts: removed DELETE /api/diagnostics, GET /api/diagnostics/status, GET /api/diagnostics/events and POST /api/diagnostics/open-log-dir. POST events, GET report, POST export and POST reveal-export stay. GET events was the only reader of the url parameter, so it is now _url instead of dropped, to leave the router call site untouched.
  • src/server/services/diagnosticsService.ts: removed getStatus, DiagnosticsStatus, openLogDir, clear and getDirectorySize. listFiles stays — the retention sweep uses it twice. readRecentEvents stays as you said: problemReport.ts and the export bundle both read through it.
  • src/server/__tests__/diagnostics-service.test.ts: dropped the status, GET events and clear assertions. The test now covers POST events (redaction assertion included) and the export only.
  • scripts/repro-issue-247-real.ts: kept the script, dropped the route. fetchDiagnostics calls diagnosticsService.readRecentEvents(200) and filters on sessionId, which is exactly what the route did. The script starts the server in-process, so reading the log through the service needs no HTTP round trip.

I checked callers before deleting rather than after: diagnosticsService.recordEvent is still used by providers.ts, server/index.ts, errorHandler.ts and conversationService.ts, so only the client method went. Nothing in src/, desktop/src/ or scripts/ references a removed symbol now.

2. The /doctor messages. All eight now name the dreamcoder doctor CLI subcommand, which still exists and whose doctorHandler renders the same screen: sandbox-adapter.ts:584, errorUtils.ts:99, keybindings.ts:232,234,279, reload-plugins.ts:53, MCPSettings.tsx:150, useSettingsErrors.tsx:38, KeybindingProviderSetup.tsx:84. I also updated the doc comment at KeybindingProviderSetup.tsx:57, which describes that very message. Comments in files this PR does not otherwise touch are left alone, as you asked.

3. errorBoundary.description is now "The error was recorded in the diagnostics log." zh.ts:440 untouched. The desktop test that asserted the old string is updated with it.

4. design-log.zh.md:339 drops 诊断, and both mockups lose the page: the settings list entry, the 本机 group entry, the icon entry, prefsDiagnostics, its prefsPages entry, the two diagnostic-copy / diagnostic-clear actions, and /doctor in the command list. The logsCleared flag that only that page read is gone too.

5. doctorShownAtSession removed from src/utils/config.ts.

Checks. Both bun test and the desktop suite run here on Windows 11, and both already carry failures on the parent a4f67bb that this branch does not touch: five prepare-ripgrep cases, two symlink cases in artifacts, the worktree fork case in session-links, canvas entry resolution, and the fatal-startup-stderr case in diagnostics-service.test.ts (it times out at 5 s here; the PR's CI run had it green). I confirmed each one fails identically on the parent commit by stashing this branch, so none is a regression. The one failure I did introduce — the ErrorBoundary assertion on the old string — is fixed. Desktop typecheck and oxlint pass.

18 files, +34/−179.

@GoDiao GoDiao left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks, all five points are addressed. Merging.

@GoDiao
GoDiao merged commit 0ef0e61 into GoDiao:main Nov 14, 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.

Remove the Diagnostics settings page and the dry-run Doctor server

3 participants