Skip to content

Diagnostics log and a copyable report, for slowness reports from the field - #66

Merged
rocketraman merged 2 commits into
masterfrom
claude/diagnostics-log-and-report
Oct 14, 2026
Merged

rocketraman merged 2 commits into
masterfrom
claude/diagnostics-log-and-report

Conversation

@rocketraman

Copy link
Copy Markdown
Owner

Why

A user reported GitVantage getting very slow again on macOS. The app already had a stall watchdog (always on) and perf counters (GITVANTAGE_PERF=1), but both wrote only to stderr — which is connected to nothing when the app is launched from a dock. The diagnostics had been reporting to nobody.

What changed

Diagnostics log — stall reports, watcher errors, a line per launch and the counter dumps now go to diagnostics.log beside registry.json, as well as stderr. Capped at 1MB plus one rotated generation, no fsync, and a disk it cannot write to costs the diagnostics rather than the app.

Settings → Diagnostics

  • "Collect performance data" switch, remembered across restarts. GITVANTAGE_PERF=1 still forces it on.
  • "Copy diagnostics report": app version, native/JVM, OS and arch, repo and worktree counts, uptime, heap, GC, threads, counters, and the recent log. No paths, remotes or branch names (a failed folder watch is recorded with that folder's name).
  • "Show log folder".

More in the counters

  • gh.<subcommand> timings alongside git.<subcommand>.
  • A "recent" column per counter (since the last one-minute dump), so "fine for hours, then slow" is visible.
  • Peak concurrent git / gh processes.
  • ui.dispatch.sluggish: UI round-trips over 100ms that fall short of a 500ms stall.
  • Dump cadence moved from 30s to 60s, since it now goes to a bounded file.

Toolbar (second commit) — the "◐ System" button is now "Settings" with a drawn gear. The fetch-status text gives up width before the buttons do, so "+ Add repo" keeps its label in a narrow window.

README — a short "Reporting a slow or frozen dashboard" section.

Verification

  • ./gradlew check: 201 unit tests, 10 architecture rules, detekt, JVM smoke checks.
  • Two new --smoke-test checks run inside the native image on every platform: that one thread can read another's stack (what the watchdog depends on), and that the report can be produced and written.
  • smokeTestNativeImage (Linux) now injects a deliberate 1.5s UI stall and fails unless diagnostics.log contains it with a stack. Its hold went from 15s to 20s, and it now runs against a scratch XDG_CONFIG_HOME. Passed locally against a native build.
  • The Settings section and the toolbar button were exercised in an isolated KWin session: toggle persists, copy puts the report on the clipboard.

For the reviewer

  • The log is always on. Only stalls, watcher errors and one line per launch are written unless collection is switched on.
  • The version is generated source (generateBuildInfo → BuildInfo.VERSION), because a native image keeps neither build-time system properties nor unregistered resources.
  • No Rosetta detection. It needs a sysctl subprocess, which the architecture rule confining process spawning does not allow outside four files. The report shows the binary's arch.
  • GC figures are absent in the native image, and "committed" heap reads as the maximum there; heap used is the reliable number.
  • Not verified on macOS. The native stall gate is Linux-only, as before; the macOS release legs run only the two --smoke-test checks.
  • The ⚙ character on worktree alert rows is unchanged and can still render as a colour emoji.

The stall watchdog and the perf counters only ever wrote to stderr, which
is connected to nothing when the app is launched from a dock. The people
reporting slowness are exactly those people, so the diagnostics that were
always on had been reporting to nobody.

- Write stall reports, watcher errors and counter dumps to a bounded
  diagnostics.log beside registry.json, as well as stderr.
- Make perf collection switchable at runtime and remembered, from a new
  Diagnostics section in Settings; GITVANTAGE_PERF=1 still forces it on.
- Add "Copy diagnostics report": version, OS, repo counts, uptime, heap,
  counters and the recent log, with no paths, remotes or branch names.
- Time gh calls, track concurrent git/gh processes, count sluggish UI
  round-trips, and show per-interval figures beside the running totals.
- Stamp the app version into the build as generated source.
- Check inside the native image that another thread's stack can be read
  and the report produced, and make the Linux native smoke gate inject a
  deliberate UI stall and require it in the log with a stack.

Signed-off-by: Raman Gupta <rocketraman@gmail.com>
It wore the current theme's glyph and name from when appearance was the
only thing behind it. The gear is drawn rather than typed: U+2699 is
claimed by colour-emoji fonts and ignores the requested colour.

The fetch status now yields width before the buttons do, so "Add repo"
keeps its label in a narrow window.

Signed-off-by: Raman Gupta <rocketraman@gmail.com>
@rocketraman
rocketraman force-pushed the claude/diagnostics-log-and-report branch from 1beab16 to 918c75e Compare October 14, 2026 04:44
@rocketraman
rocketraman merged commit f7e6b37 into master Oct 14, 2026
2 checks passed
@rocketraman
rocketraman deleted the claude/diagnostics-log-and-report branch October 14, 2026 04:45
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.

1 participant