Repository navigation
Incident log: what failed, where, when and why - #6
Merged
Merged
Conversation
The dispatcher's tmux_failed is something failing on the machine, but the
hub mapped every dispatcher error code to refused_by_policy, so the journal
and the spoken answers said the request was refused ("switchboard-remote
refused the request") when tmux there had failed. tmux_failed now maps to
the new transport error remote_failed with the code in detail, spoken as
"wsl answered, but tmux failed there." Sends keep their not_sent outcome.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh
`health` reports, by fixed label and never by path, the free and total bytes and the read-only flag (statvfs ST_RDONLY) of /, $HOME and the Claude Code home; on WSL (Microsoft in the kernel release) also of the Windows drive at /mnt/c when it is mounted, probed in a daemon thread with a 3 s limit because DrvFs goes through the Windows host. Plus load, available memory and uptime. No arguments, no opt-in: it is allowed under the normal policy like list. Standard library only, Python 3.8. Inside WSL the root's free space does not show the Windows disk filling, which is how the WSL root went read-only without warning. The connector's version moves with the dispatcher's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh
stateDir/incidents.jsonl (0600, append-only, rotated by size with the open incidents carried over, appends under incidents.lock so the CLI can write next to the hub): one line when an incident opens and one when it closes, with UTC and local times, machine (or hub), component, a stable code, what, why, effect, recovery, a repeat count and the source (auto, owner, cli). Never pane text, prompts, tokens or a machine's error text. Automatic incidents (IncidentTracker): every dispatcher call goes through ObservedTransport (tmux failures, bad policy, busy, missing or crashed dispatcher, ssh and transport failures and timeouts); agent links that close without being replaced or stopped by the hub; relay socket and connection problems; summariser failures (a refused login is auth_failed); tool exceptions (by type only); an unclean hub stop (a hub-alive.json marker left behind). Repeats only count; a success closes an incident only after incidents.settleSeconds without the failure, so a flapping link stays one incident; at most 30 new automatic incidents per hour, the rest are counted in one incident_flood. Open ones are adopted at the next start. Machine health (HealthPoller): the dispatcher's health verb every incidents.health.intervalSeconds (default 300, also when an agent machine connects) and the hub's own state directory; incidents for a file system under minFreeGigabytes or minFreePercent, any read-only file system and low memory, closing with a margin. On WSL the Windows disk counts, with the reason spoken: WSL's disk image lives there and goes read-only when it fills. A dispatcher before 0.9.0 is polled with version instead. Owner side: the incidents tool (spoken summary for a period, open ones always), incident_note (records the owner's words as a note), the CLI voice-coding-mcp incidents [list|add|close], one short clause about an open incident in list_remote_sessions and remote_status, and optional pushes with incidents.notify. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh
SWITCHBOARD.md gets the "Incident log" section (file, automatic incidents, machine health, owner tools, open questions), the incidents config table, the health verb and the remote_failed mapping; DESIGN.md records the decisions; REFERENCE.md the config keys, the incidents CLI and the two tools; SETUP-AGENTS.md how to update the dispatcher to 0.9.0; SETUP-WSL.md a short owner guide paragraph and a troubleshooting line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The owner asked on 2026-11-27 for an accountability log of everything that goes wrong (machine, time, what failed, why), after the wsl machine went down unseen: the Windows disk C: filled up, WSL's ext4 root remounted read-only, and Claude Code exited with "Bus error (core dumped)". All the hub had was
listcalls on wsl failing asrefused_by_policy/tmux_failedfrom 10:57 UTC, then an agent disconnect at 12:03:48 UTC and a reconnect at 12:03:58 UTC.Design (details in docs/SWITCHBOARD.md "Incident log", decisions in docs/DESIGN.md)
stateDir/incidents.jsonl, mode 0600, append-only. An incident is written when it opens and again, with the same id, when it closes; a reader keeps the last line of each id. Fields: id, start/end (UTC) plus local times and zone (incidents.timeZoneor the hub's zone), duration, machine (orhub), component, stable code, what, why, effect, recovery, count, source (auto/owner/cli). It rotates by size (default 1 MB x 3 files) and carries the open incidents into the new file. Appends hold a file lock, so the CLI can write next to the hub. Lines are at most 8 KB. No pane text, prompts, tokens, paths or machine stderr: only fixed hub texts, numbers, config machine names and the owner's own words, which are redacted and clipped.settleSeconds(120) with no new failure, so a flapping link stays one incident (two lines). New automatic incidents are capped at 30 per hour; anything past that is counted in oneincident_flood. Incidents left open by an earlier run are adopted at the next start. Triggers:ObservedTransport: tmux, dispatcher (bad_policy, busy, missing, bad response, crashed), and ssh/transport failures and timeoutsauth_failedfor a 401 or login error,timeout,error)hub-alive.jsonmarker left behind)tmux_failedis now the transport errorremote_failed, notrefused_by_policy. Spoken: "wsl answered, but tmux failed there."healthverb. It needs no opt-in, uses the stdlib only and runs on Python 3.8. It reports free/total bytes andST_RDONLYfor/,$HOMEand the Claude Code home. On WSL it also reports/mnt/cwhen mounted (statvfs only, in a daemon thread with a 3 s limit, with only one probe in flight at a time). It also reports load, memory and uptime, all by fixed labels, never paths. The hub polls every 300 s by default, and also when an agent connects, and checks its own state dir the same way. It opens incidents for free space under 5 GB or 5 %, any read-only file system, and available memory under 200 MB. Each closes only once the value is back past the limit by a margin (10 % more space and 1 point more percent, 20 % more memory). Example why: "the Windows disk C: has 57 GB free of 1.9 TB (97 % used): WSL's disk image usually lives there, and when that disk fills, WSL's root file system goes read-only and programs crash (inside WSL the root still shows free space)". Dispatchers older than 0.9.0 are polled withversioninstead.incidents(machine?, since?, open_only?, details?), read-only, with a short spoken summaryincident_note(machine, what, why?), which records the owner's words as a note and does nothing elsevoice-coding-mcp incidents [list|add|close]list_remote_sessions/remote_statusadd one clause for an open incident on that machine, without repeating a failure the answer already statesincidents.notifypushes throughnotify.urlNew config:
incidents.{enabled,timeZone,settleSeconds,maxKilobytes,keepFiles,notify,health.{intervalSeconds,minFreeGigabytes,minFreePercent,minMemoryMegabytes}}(docs/REFERENCE.md). Docs: SWITCHBOARD.md, REFERENCE.md, DESIGN.md, SETUP-AGENTS.md (dispatcher update), SETUP-WSL.md (owner guide paragraph and troubleshooting).Tests
uv sync --locked,ruff check,ruff format --checkandmypy --strict src testsare clean.pytest: 1850 passed, 9 skipped (full run; the one failure in that run wastests/test_cli.pylisting the commands, now fixed, plustest_status_of_a_menu_with_twelve_options, a timing flake under a load average of 17 that passes 3 out of 3 runs alone). The new file istests/remote/test_incidents.py(39 tests). It covers:Existing tests were updated for the version and verbs, the tool list snapshot and the tool count.
Deploy
uv sync --locked, restart the hub. The defaults are on. Health polls start at once and do nothing harmful against old dispatchers. Optionally setincidents.timeZonetoEurope/Athens(a VPS hub is usually on UTC) andincidents.notify.switchboard-remote0.9.0 (andswitchboard-connect, whose version moves with it) from the owner's own verified copy, as in SETUP-AGENTS.md "Updating the dispatcher". Restartswitchboard-connecton agent machines. No forced-command or flag change is needed.remote-checkshould show0.9.0withhealth.First entry (run on the hub after deploy, as the hub user)
(On a Linux or WSL hub with the dedicated user, use
sudo -H -u switchboard <venv>/bin/voice-coding-mcp incidents add ... --config <config>instead.)voice-coding-mcp incidents --detailsshows it.Open questions
/mnt/cis probed; a--host-drivedispatcher option or a hub setting could name it.link_downincidents. Should those open only after a grace time?hubis allowed with a warning. Should the name be reserved instead? That would break an existing config with that name.healthat the end ofVERBS(dispatcher and protocol),"health"toREAD_ONLY_VERBS, and bumps the dispatcher and connector to 0.9.0. After Media attachments: images, audio and video from a machine's outbox #5 (0.7.0) and the clear-input PR (0.8.0), keep their verbs, appendhealth, and keep 0.9.0; regeneratetests/fixtures/tool_list.jsonand the tool count intests/test_mcp.py/tests/test_e2e.py.🤖 Generated with Claude Code
https://claude.ai/code/session_011moV3EPNNknRWZQ686AChh