返回 CodeWhale
OPERATIONS_RUNBOOK.md
根目录 / docs / OPERATIONS_RUNBOOK.md
1 # Codewhale operations runbook
2
3 This runbook covers the local CLI/TUI. Commands below describe current source;
4 check `codewhale --version` and compare a published build with the documentation
5 at its tag before assuming a candidate-only control exists.
6
7 ## Quick Triage
8
9 Start with offline diagnostics in the affected workspace:
10
11 ```sh
12 codewhale --version
13 codewhale config path
14 codewhale doctor --json
15 ```
16
17 `doctor --json` reports structural health without probing provider credentials,
18 contacting a provider, or starting MCP servers. An offline report is not proof
19 that a key works or that a remote service is reachable. Do not attach a raw
20 config, secret store, session archive or environment dump to an issue.
21
22 If more detail is needed, reproduce with `RUST_LOG=codewhale_tui=debug codewhale`.
23 Logs and session content can contain project data, so inspect and redact the
24 specific excerpt before sharing it. The [troubleshooting guide](INSTALL.md#13-troubleshooting)
25 covers installation and network messages.
26
27 ## Incident: Turn Hangs or Stream Stops
28
29 First read the transcript for a pending approval, clarification or failed tool.
30 If a shell command is still running, `Ctrl+B` backgrounds that command while
31 the turn continues; `/jobs` shows it. Ask Codewhale to stop the identified task
32 when needed; current source uses `task_shell_wait` with its `task_id` and
33 `cancel: true`, rather than treating a task id as an operating-system pid.
34
35 Press Esc to cancel a turn; close any modal first if it consumes Esc. Interrupting
36 a turn does not undo already completed file changes or external actions.
37
38 For a hosted route, explicitly opt into a connection test:
39
40 ```sh
41 codewhale auth status --provider <provider-id>
42 codewhale doctor --probe-api
43 ```
44
45 Replace the provider id with your selected provider; `--probe-api` tests the
46 active route, not necessarily the provider named in the previous command.
47 For a local model, use `codewhale doctor --probe-local` instead. These probes
48 contact the selected service and may create provider usage; they are not part
49 of the offline triage above.
50
51 Reconnect or repair credentials before retrying. A retry can repeat external
52 actions, so inspect the transcript and [receipts](RECEIPTS.md) first.
53
54 ## Incident: Network Outage / Offline Behavior
55
56 Use `/queue list` to inspect unsent messages. Offline queue state is persisted
57 per session under `~/.codewhale/sessions/checkpoints/`; a legacy global
58 `offline_queue.json` may be adopted during migration.
59
60 After connectivity is restored, inspect an entry with `/queue edit <n>` and
61 press Enter to send it. Verify the resulting response and queue state rather
62 than assuming queued work ran automatically.
63
64 ## Incident: Crash Recovery Needed
65
66 List saved sessions with `codewhale sessions`, then resume explicitly with
67 `codewhale resume <id>` or `codewhale --continue` for the workspace. Inside the
68 TUI, Ctrl+R opens the session picker. A fresh launch does not silently resume
69 an interrupted session.
70
71 If recovery fails, preserve the affected state before repair. Use a compatible
72 binary for a newer schema; do not delete a checkpoint to silence a schema error.
73 The [legacy-path guide](LEGACY_PATHS.md) covers migration from `~/.deepseek`.
74
75 ## Incident: Persistent State Schema Errors
76
77 Record the exact error and binary version. Back up the affected state directory
78 before changing files, then use a binary that supports that schema or a documented
79 migration path. Do not rewrite schema version fields by hand.
80
81 Session files, Runtime thread records and Fleet ledgers are different stores;
82 identify the one named in the failure. Preserve the original so repair can be
83 reviewed or reversed.
84
85 ## Incident: MCP/Tool Execution Failures
86
87 Review the server entry and exact command in your global or trusted project
88 `mcp.json`. Running a server manually or reloading it executes its code and can
89 contact its service, so review that authority first. Use `/mcp` diagnostics and
90 inspect policy or sandbox refusals rather than widening permissions to make an
91 unknown failure disappear.
92
93 Back up an existing config before repair. `codewhale mcp init --force` replaces
94 configuration; it is not a harmless validation command. After a deliberate
95 change, `/mcp reload` refreshes the running connections.
96
97 ## Post-Incident Checklist
98
99 Record what you ran, the exact output, the version and the smallest reproducible
100 workspace. Include a redacted diagnostic excerpt, the observed result and the
101 expected result in a bug report. Distinguish a tested fix from a workaround and
102 from an unverified hypothesis.
103
103 lines MARKDOWN