Skip to content

DIAGNOSTICS

throndir edited this page Nov 14, 2026 · 1 revision

Diagnostics

Status: Implemented Last Updated: 2026-11-13 Audience: Developers and coding agents Last verified: 2026-11-13 against 5f40af2d9 (Doctor registry and CLI only; logs and desktop claims not rechecked) Code: src/Martlet.Doctor/, src/Martlet.Diagnostics/, src/Martlet.Desktop/

Diagnose setup and local component problems

Doctor runs local, read-only checks through the same probe registry used by desktop diagnostics. It can report settings, runtime, and platform findings. It does not test provider access, audio devices, or GPU readiness.

Diagnostics page and shared logs

Diagnostics (in the main window's navigation) shows every line Martlet's parts wrote on every computer of your Martlet network, newest first, in one list: each desktop app (desktop.log, including each status-line message as Status: ..., hosts that stop or start answering again, failed provider requests and the Thinking trace: each Thinking request step by step and what it waits for), avatar renderer (avatar-renderer.log) and host runs (host-runs.log), each with its rotated older copies, and every Martlet host's gateway. Filters choose the level (everything, warnings and errors, errors only), the part (app, character, host runs, host gateway) and the computer, and a search box matches the text. A PC writes under two IDs: its desktop app's device ID (desktop-<name>-<6 characters>, or desktop-<name> on a PC that was paired before Martlet gave each Windows user its own) and, when it runs Martlet's host service, that gateway's host ID (such as diva-host). Both are shown as This PC and the This PC filter covers both; other computers show their ID. Selecting a line shows it in full (with the ID it came from, who passed it on, stack traces and output lines included), and that box's Copy button copies the whole line. Home's unexpected errors and closed unexpectedly items open this page. Copy shown copies the shown lines; Open logs folder opens this PC's folder. The page refreshes every 15 seconds while open; Refresh reads again and sends nothing.

Check your computers

The Check your computers card on Diagnostics finds what makes Martlet slow. Click Check now. Martlet checks each of your own paired hosts one after another (never a friend's shared host) and shows each finding as it comes, with ⚠ for a problem:

  1. How long the host took to say what it runs. More than 2 s is slow.
  2. Where each loaded model sits, from the host's /api/ps: all on the graphics card, split with the processor, or on the processor only. A split model makes replies much slower. The check also keeps this in model-memory.json, as a host check does.
  3. One short test reply from each Thinking model on the host (the conversation model and the Thinking pool's). The test asks the model to count to thirty. It never sends what you said. It reports the time to the first words, the writing speed in tokens a second, and the model's usual first-word time.

A test reply is slow when its first words take 15 s or more, when they take three times the usual time and at least 4 s more, or when the model writes fewer than 6 tokens a second. A busy host (a live reply on it) is not tested and says so. Every finding also goes to desktop.log as Check your computers: ..., problems as warnings, so a shared log shows them.

When Thinking gets slow

After each reply, Martlet keeps how long the Thinking model took to its first words (model-speed.json: the last nine replies, and the model's usual time, which is the fastest middle of three replies in a row). Home warns Martlet replies much slower than usual when the middle of the newest three replies is three times the usual time and at least 4 s more. It warns Martlet replies slowly when that middle is 15 s or more, or when the host reported that the Thinking model isn't all on its graphics card. The warning has Check your computers, which opens Diagnostics and starts the check. The desktop log says Thinking got slow: ... once when a slowdown starts and Thinking is fast again: ... when it ends.

These rules live in ThinkingSpeed (src\Martlet.Core\Planning). MCP's thinking_speed_check shows them for a data directory.

Window resources and saving logs

Window resources lines in desktop.log show how many Window Manager and GDI objects the desktop holds, of the 10,000 of each that Windows allows one process. Martlet writes one a minute after it starts and then once an hour. It also writes one when a count grew by 1,000 since the last line, and a warning at 50%, 75% and 90% of a limit. Those lines also list Martlet's windows by class, so a leak shows what kind of object grows. At the limit, timers and windows fail with The current process has used all of its system allowance of handles for Window Manager objects; after that error Martlet writes the reading at once.

Save logs to share is the easy way to send your logs to someone helping you. It saves one ZIP (on the Desktop unless you choose another folder; named like Martlet logs desktop-diva 2026-10-04 0140.zip) with every line this PC has from every computer, whatever the filters show, then shows it in File Explorer so you can attach it to a message or an issue. The ZIP holds about.txt (when and where it was saved, the Martlet version and Windows, how log sharing went, each computer and part with its line count and newest line, the last 24 hours' errors and warnings, and what logs can contain) and martlet-logs.txt (every line once, oldest first: 2026-10-04 01:40:12.345 -07:00 WARN gpu-box/gateway: ..., with (this PC) after this PC's IDs, via the computer that passed a line on, and a message's following lines indented). The status line says how many lines from how many computers were saved.

Every computer has everyone's logs. Your computers form one network, so there is nothing to choose: logs are shared between all of them. Each desktop's local files are unchanged (rotated at 2 MiB). Each Martlet host's gateway keeps a bounded log of its own activity (start and stop, devices paired, each finished model request with route, device and duration (for a voice reply also how much speech it made, when its first audio left and, when the speech after that took longer to make than to play, that it was made slower than real time and how long the desktop's speakers waited for it at least, so a host too busy to keep up with its voice shows on every PC's Diagnostics page), each refused or failed request with its stable code, HTTP status and trace ID, and, for a voice engine (Chatterbox, F5-TTS, XTTS-v2, GPT-SoVITS, Dia), why its service failed or refused the reply: its error code, stage and summary (for example gpu_out_of_memory with the CUDA error), the state of its model and why it isn't ready, or that its reply stream ended unfinished because the service stopped) together with every line the desktops share with it, in logs.json beside host.json. Hosts never talk to each other, so the desktops carry the lines: every 30 seconds while Martlet runs (companion PCs and PCs set up as hosts alike), each desktop:

  1. reads each paired host's new lines (every computer's lines that host holds, its own gateway's included) into its own copy of the other computers' lines in Martlet's data folder (a week of lines; this PC's own lines stay in its log files). Each run appends the lines it added to logs\network-logs.journal; now and then the whole copy is written again as logs\network-logs.json and the journal starts empty. How far it read each host is kept in logs\network-logs-positions.json, so after a restart it goes on from there instead of reading the week again;
  2. the first time it reaches a host while Martlet runs, asks for its marks (the newest sequence number it holds per computer and part);
  3. gives every host the lines it lacks: this PC's own new lines and every other computer's lines it holds, oldest first, at most 4 batches of 1,000 lines per host per run (the rest follow on the next run). A host that has nothing yet from a computer gets at most that computer's last week.

Every computer keeps a week of lines. Each host and each desktop's copy keep lines for 7 days after they were written. Caps stop a computer with a wrong clock, or a flood of lines, from growing a log without end: at most 250,000 lines and about 128 MB in memory, oldest dropped first. A household's computers write about 430 lines an hour together, and up to about 1,000 while Martlet talks a lot (setup output can add a few thousand in an hour). So a week is about 72,000 to 170,000 lines: 20 to 45 MB on disk on each host and each PC, and about as much memory in each Martlet. A computer that was off for days gets the whole week the hosts hold when it comes back.

Every line has a sequence number that only grows per computer and part (derived from its time), and each host keeps only lines newer than its mark, so a line sent twice, by several desktops or again after a restart is kept once. Lines passed on by another desktop record who passed them on. Each host saves at most every 30 seconds and when it stops: only the lines since its last full save go to logs-recent.json, and logs.json with the whole week is written again once those take more than 1 MB. A desktop that reaches only some hosts still reaches every computer: another desktop that reaches both passes the lines on. A host that stops answering only delays lines; they wait on each computer and reach it when it answers again. A host that comes back without its newest lines (a power cut before it saved) is noticed on each desktop's next run: the line it read last is no longer where it was, so it reads that host again from the start, asks for its marks again and gives it back what it lost. The card under the title says how sharing went: Sharing logs with 2 of 3 hosts. Waiting for gpu-box. Update old-box to share its logs. Checked at 1:40 AM., or that no host is paired yet (then the page shows only this PC's logs). The logs entry older Martlet desktops kept in the shared plan (their single "log host") is no longer chosen or used; it stays in the plan so those desktops keep sending their logs to a host where the others read them, and updating them makes them share with every host.

Logs hold activity, errors and status only: never keys, pairing secrets or conversation content. They can include local paths, host names and provider error text, and they travel only over the pinned, signed pairing between the owner's own computers. Hosts older than shared logs refuse /martlet/v1/logs; the card says to update them. The desktop log also records the Martlet network as each PC sees it whenever it changes (membership, requests to join, who each host is paired with) and which role the PC runs as at start and on each change.

Qualification. Parsing, filters and the page were exercised on this Windows machine through Martlet MCP (logs_timeline, logs_export and the desktop's Diagnostics controls). Sharing was rehearsed with logs_share_selftest: two real gateways on loopback and three simulated desktops with the production sharing engine, including a desktop that reaches only one host, a host that was down, a host that lost its newest lines in a power cut and the saved copy after a restart; the gateway endpoint (marks, deduplication, relaying, paging, persistence and refused requests) in-process. Sharing between real computers over a network is NOT RUN.

Troubleshooting connects the existing Support engine to the real Desktop Troubleshooting surface: passive access at each setup stage, explicit OFF-by-default local metadata recording, exact five-file frozen preview and default-No destination-bound local export. Doctor help shares its authored scope/bounds; ordinary status/JSON/exit semantics remain unchanged. No CLI export or support upload/contact channel is implemented.

The live conversation adds a separate real conversation timeline in Desktop, fed by actual capture/STT/policy/runtime/playback state and sanitized credential/ configuration failures. It does not turn ordinary Doctor probes into live requests. status and run retain their existing no-network, no-key semantics; catalog/configuration state is never a live pass. The executable smoke now also requires unconfigured live Send/PTT disabled and all live permission/output choices OFF.

This is the local probe registry. It is not a release qualification. It does not change Core contracts, settings serialization, original file bytes or the provider/PCM schema.

The settings.load report also carries optional typed setup metadata: checkpoint, per-role route/consent/key-reference booleans and pending cleanup count. Human output and Desktop share that summary; JSON contains no route IDs, origins or credential IDs. Saved setup is not live readiness and never resolves secrets. See SETUP for configuration, migration and explicit vault actions.

Audio setup (local only) is a separate explicit action surface. It displays real local capture/tone stages and historical checkpoints through AudioSetupDiagnostics, never as a provider or fixture pass. settings.load may include optional sanitized setup.audio metadata: selected/default booleans and historical UTC times/outcomes, no device identities/labels or configuration revisions. Saved observations are stale for current readiness. Ordinary status/list/run still do not enumerate or open devices or play a tone; the audio guides point to separately permissioned Desktop actions instead. The audio-OFF executable smoke opens this window only to view never-tested status. See local audio semantics and unrun gates.

Implemented commands and scope

Martlet.Doctor.exe status --json --data-directory C:\Disposable\Martlet
Martlet.Doctor.exe list --json --data-directory C:\Disposable\Martlet
Martlet.Doctor.exe run settings.load application.version runtime.version --json --data-directory C:\Disposable\Martlet
Martlet.Doctor.exe --help
Martlet.Doctor.exe --version

Omitting the command still means status. Omitting --data-directory retains the existing per-user location. Tests/smokes always specify unique temporary directories. IDs and flags are exact and case-sensitive; repeated IDs/flags, unknown IDs, empty run, extra arguments, relative/invalid directories and unimplemented commands return one sanitized invocation-error report. There is no self-test, --profile, repair, export or generic shell action.

status reports all fourteen registered checks. The settings, application, runtime, platform and planning callbacks execute. The provider, audio, pipeline and host checks have no callback here: they are optional, show as not checked here and do not change the status, so a healthy PC reports requested checks passed (exit 0). run restricts the report and execution to the named checks: a successful application/runtime run does not inspect settings, test a provider or qualify installation. list reads no settings, executes no callbacks and always returns incomplete catalog-only evidence (exit 2). The human footer explicitly excludes unselected audio/GPU/cloud/host paths. JSON stdout remains exactly one DoctorReport, including invocation errors. Ctrl+C signals cancellation and produces the same report rather than a raw exception. Help/version retain normal success and do not load settings.

Exit Meaning
0 Every required check and every optional check that ran passed with current observed evidence, and at least one required check was selected; or ordinary help/version succeeded
1 A real reported failure, callback fault or rejected invalid evidence
2 Incomplete: a required check or an optional check that ran gave a warning, unknown, skipped, not configured, stale, stopped or timed-out result; catalog-only; or no required checks
3 Invalid invocation, or selected settings inspection found invalid/newer/inaccessible configuration; takes precedence over failures

An optional check that ran and failed or stayed incomplete also prevents green. An optional check that the report did not run (no callback here, or effects beyond local read-only) is not checked here and does not. Fixture success describes only explicitly injected test fixtures, never live readiness.

Production registry

Stable probe ID Automatically executed Declared effects / result (required unless it says optional)
settings.load Yes Local read-only SettingsStore.LoadAsync; loaded, first-run, malformed/newer or inaccessible
application.version Yes Local read-only executing application/version evidence
runtime.version Yes Local read-only executing .NET 10 runtime evidence; not SDK, install, host or GPU inventory
platform.architecture Yes Local read-only processor type (IsWow64Process2, so the x64 build on Windows on Arm reports ARM64) and whether Martlet runs emulated; no GPU or host inventory
provider.connection No (optional) Permissioned/network/provider-cost; not configured / not checked here
audio.input No (optional) Permissioned/device; skipped / not checked here
audio.playback No (optional) Permissioned/device; skipped / not checked here, no audibility claim
pipeline.vad No (optional) Local read-only declaration, but no diagnostic callback installed
pipeline.policy No (optional) Local read-only declaration, but no diagnostic callback installed
pipeline.stt, pipeline.llm, pipeline.tts No (optional) Permissioned/provider-cost; not wired / not checked here
host.connection No Optional permissioned/network host/GPU placeholder; not configured / not run
planning.catalog Yes (optional) Local read-only: which copy of the model catalog Recommended setup plans with (the daily copy, the shipped snapshot, or Martlet's own list alone); reads files only, downloads nothing

Stage labels Mic/VAD use existing Stage.Application; no shared stage enum was invented. The desktop maps their stable probe IDs to explicit pipeline labels. All current automatically runnable definitions declare only LocalReadOnly. The executor rejects any other effect combination without invoking its callback, even when explicitly selected. It is deliberately not a permission/consent engine.

No device enumeration/open/capture/playback, HTTP/DNS/provider/key-store calls, model pulls, automatic writes/repairs, permission changes or child processes are performed by diagnostics. File I/O uses the existing settings boundary; a user- selected remote filesystem, mapped drive or reparse target is not a network sandbox or an offline qualification. Tests use ordinary local temporary paths. Construction/load never creates a profile.

Shared API, timing and lifetime

ProbeRegistry.Local(SettingsStore) is the single production definition source. FoundationStatusService remains a compatibility wrapper over its ProbeExecutor. Doctor dispatch and DiagnosticStatusModel (the actual WPF presentation model) use that same registry, result contracts and ReportFormatter.Human.

Extension seams are ProbeDefinition, ProbeObservation, ProbeRegistry.Select, ProbeExecutor.RunAsync, Catalog, Pending, RefreshAge, ActiveOperationCount and bounded WaitForIdleAsync. Definitions and selections have at most 64 unique IDs. Callback output is a catalog finding ID plus explicit provenance, optional observation time and settings metadata, not free-form exception/provider text. Unknown finding IDs, impossible provenance and invalid evidence are rejected. The catalog and collections exposed to callers are read-only snapshots.

Clock and timers use injected TimeProvider. Default concurrency is 2 (range 1-8), per-probe timeout 2 seconds (maximum 30), whole-run timeout 5 seconds (maximum 60), and evidence maximum age 1 minute (maximum 1 day). Only callback execution uses worker threads; synchronous callback prefixes cannot block WPF. Monotonic elapsed time decides timeouts, including a callback completing at the deadline before its timer continuation is scheduled. UTC records observation age; future observations are unknown, expired evidence is stale, and refreshing an old report cannot resurrect a stale pass after a clock rollback.

Cancellation and deadlines bound reporting, not arbitrary third-party code. The callback token is separated from the reporting signal: even a blocking cancellation handler cannot hold the report/UI open. Interrupted results report timed_out or canceled, warning/exit 2, not-run provenance, no accepted observation, and operation_still_running when applicable. Slots remain reserved until the callback and cancellation handlers actually finish. An outstanding callback blocks reruns; concurrent active runs are rejected. Late success/fault is observed for cleanup but can never mutate or replace the published snapshot. No claim of cooperative compute cancellation is made.

New optional JSON properties are additive to the existing envelope: report started_at / completed_at; probe diagnostic_code, action_id, remedy, effects, execution, started_at, completed_at, duration_milliseconds, age_milliseconds, maximum_age_milliseconds, operation_still_running. An interrupted probe has start/duration if scheduled, but no fabricated completion time. Report completion means reporting finished, not that an outstanding callback ended. Catalog entries have no start, duration, observation or age. Existing strict Unicode/enum/JSON validation remains in force.

diagnostic_code is a Diagnostics-owned finding key, distinct from Core MartletError.Code. Existing settings error enums are unchanged. Callback fault/invalid-evidence errors use existing InvalidContract plus the precise diagnostic key; timeout/cancel are incomplete states, not new provider errors. Future audio errors should map at the adapter boundary after integration.

Catalog and non-executable remedies

The installed allowlist lives in DiagnosticCatalog.Findings / Remedies. Actions are authored descriptive guides only: no command strings, shell execution, links that change permissions, automatic reinstall, secret collection or uploads.

Diagnostic code Outcome Action ID
settings.valid Passed (settings only) diagnostics.refresh
settings.first_run Not configured settings.create
settings.malformed, settings.version Failed / configuration exit 3 settings.restore
settings.inaccessible Failed / configuration exit 3 settings.check_access
application.available, runtime.available Passed (process only) diagnostics.refresh
runtime.unsupported Failed diagnostics.report
platform.x64 Passed (processor only) diagnostics.refresh
platform.arm64_emulated, platform.arm64_native Passed (Windows on Arm; x64 emulation or native) platform.windows_on_arm
platform.unsupported Warning (neither x64 nor ARM64) diagnostics.report
provider.unavailable Not configured provider.setup
audio.input_unavailable Skipped audio.input_guide
audio.output_unavailable Skipped audio.output_guide
pipeline.unavailable Skipped pipeline.unavailable
host.unavailable Not configured host.setup
planning.catalog_daily, planning.catalog_snapshot Passed (where Recommended setup's options come from; files only) planning.review
planning.seed_only Warning (the model catalog can't be read; Martlet's own list only) planning.review
planning.catalog_refresh_failing Warning (the daily refresh tried this week, but no refresh read every source for over a week; the last good copy is used) planning.review
probe.not_run Skipped, catalog only diagnostics.refresh
probe.running Running, not completed evidence diagnostics.wait
probe.effects_blocked Skipped, callback never invoked diagnostics.refresh
probe.timeout, probe.canceled Warning / incomplete diagnostics.wait
probe.busy Skipped; outstanding callback owns capacity diagnostics.wait
probe.fault, probe.invalid_evidence Failed diagnostics.report
probe.unknown Unknown diagnostics.refresh
fixture.passed Passed, fixture provenance required pipeline.unavailable

Settings-save guides also retain settings.reload and settings.correct. Restoration means first keeping a backup and choosing compatible data/builds; access guidance explicitly says not to run as administrator or disable protection. Device guides describe intended input/output and Windows privacy/volume controls without opening or changing them. Provider/host guides state the missing capability, future consent boundary and that nothing was contacted. fixture.passed remains an injection/conformance seam, never automatic registry execution.

Desktop and evidence limits

Settings › Tools › Troubleshooting shows the status report. The report text box is focusable and read-only, and has a screen-reader name. Every check shows the actual report result with provenance/freshness/age and the full remedy. Refresh status runs the checks again asynchronously; overlap is disabled. Generation checks prevent post-close updates. A one-second UI timer ages existing evidence but never runs probes or auto-repairs.

Close cancels work, stops the age timer, waits at most 250 ms for callback cleanup, queues the final close on a subsequent dispatcher turn (including startup-error and synchronous-cleanup paths), then WPF's main-window shutdown exits the process. An uncooperative in-process callback cannot keep a tray/worker alive; none is launched. Library consumers must not equate a bounded report with adapter termination. Future independently hosted workers need their own termination boundary.

Local evidence is the pinned .NET 10.0.401 Windows developer host: locked restore; Release solution build/tests; real Doctor subprocess smoke; bounded WPF UIAutomation smoke. Regression coverage exercises the production registry, exact JSON property set, CLI/model result equality, unique selection, effect blocking, catalog-only evidence, unknown/future/stale age, total/per-probe deadlines, caller cancellation, spontaneous cancellation, callback faults, invalid evidence, blocking cancellation handlers, non-cooperative outstanding work, eventual completion, late-result discard, duplicate refresh and shutdown. Configuration smoke preserves malformed Unicode, invalid UTF-8, newer settings and inaccessible-path behavior and original bytes. Idle/no-active-work windows also close without reentering WPF's original closing event. Slow Stop/cancellation races are deterministic model tests, not injected fake audio/network UI activity.

Smoke-Doctor.ps1 optionally accepts -ExecutablePath selecting an existing .exe (launched directly) or .dll (launched with dotnet). The path is resolved and validated, and cleanup targets only that launched PID. Without this option, the existing Configuration-derived repository output is used, preserving the default local smoke commands. For an intentionally relocated build, pass its actual binary explicitly:

.\scripts\Smoke-Doctor.ps1 -ExecutablePath (Join-Path $artifacts 'bin\Martlet.Doctor\release\Martlet.Doctor.exe')

Martlet documentation

Clone this wiki locally