Commit aa38139
fix: stale RUNNING dispatch recovery with session-type-agnostic liveness (#4136)
## Summary
Interactive sessions have zero path to recover stale RUNNING dispatch
state. The bug is a convergence of two gaps: (1) `reset_dispatch` blocks
on RUNNING status without checking process liveness, and (2) neither
`open_kitchen` nor any interactive boot path runs the dispatch reaper.
The architectural weakness is that liveness verification before
status-based blocking is enforced by convention, not by structure —
three callers do it correctly (`resume_campaign_from_state`,
`_try_claim_with_liveness`, `reap_stale_dispatches`) while
`reset_dispatch` does not.
The immunity plan extracts a shared `resolve_stale_running` helper that
centralizes the "RUNNING → check liveness → classify if dead" pattern,
adds the reaper to `open_kitchen`, extends the existing AST boot-step
symmetry guard to cover `open_kitchen`, and adds integration tests that
would have caught this bug immediately.
The remediation plan replaces mocked `resolve_stale_running` in two
tests (`test_reset_dispatch_running_dead_process_succeeds` and
`test_reset_dispatch_running_alive_process_still_blocked`) with real
PID/boot-id fields on the dispatch record, exercising the full liveness
detection path: `reset_dispatch` → `find_locked_dispatch` →
`resolve_stale_running` → `is_dispatch_session_alive` →
`is_session_alive`.
Closes #4133
## Implementation Plan
Plan files:
-
`/home/talon/projects/autoskillit-runs/remediation-20260627-224639-242652/.autoskillit/temp/rectify/rectify_stale_running_dispatch_recovery_2026-06-27_224639.md`
-
`/home/talon/projects/autoskillit-runs/remediation-20260627-224639-242652/.autoskillit/temp/make-plan/remediation_stale_running_dispatch_recovery_plan_2026-06-28_001600.md`
🤖 Generated with [Claude Code](https://claude.com/claude-code) via
AutoSkillit
<!-- autoskillit:pipeline-signature
steps=prepare_pr,run_arch_lenses,compose_pr,annotate_pr_diff,review_pr
-->
## Token Usage Summary
| Step | Model | count | uncached | output | cache_read | peak_ctx |
turns | cache_write | time |
|------|-------|-------|----------|--------|------------|----------|-------|-------------|------|
| plan* | opus[1m] | 3 | 9.1k | 37.2k | 4.4M | 123.0k | 132 | 231.7k |
45m 36s |
| verify* | sonnet | 3 | 228 | 24.3k | 1.3M | 71.9k | 70 | 123.2k | 13m
37s |
| implement* | MiniMax-M3 | 3 | 185.8k | 16.1k | 2.5M | 60.5k | 140 | 0
| 7m 54s |
| retry_worktree* | sonnet | 1 | 76 | 3.6k | 314.5k | 40.7k | 24 | 22.2k
| 2m 2s |
| audit_impl* | sonnet | 3 | 756 | 16.1k | 723.1k | 42.9k | 46 | 79.7k |
10m 33s |
| dispatch:1133b9e6-5319-48e2-b878-5f30f979fbcb* | sonnet | 1 | 170 |
5.8k | 1.4M | 77.7k | 51 | 77.9k | 20m 52s |
| prepare_pr* | MiniMax-M3 | 2 | 85.9k | 4.6k | 386.8k | 0 | 29 | 0 | 1m
45s |
| compose_pr* | MiniMax-M3 | 2 | 73.1k | 4.5k | 430.1k | 38.5k | 25 | 0
| 1m 45s |
| review_pr* | sonnet | 4 | 482 | 46.6k | 2.7M | 59.5k | 155 | 161.1k |
13m 55s |
| dispatch:9f9aa203-f3ea-44fd-9d3d-8f7ce0265f6f* | sonnet | 1 | 298 |
10.5k | 2.8M | 84.3k | 77 | 59.8k | 1h 5m |
| merge_gate_fix* | sonnet | 1 | 110 | 5.5k | 527.3k | 47.6k | 35 |
29.5k | 2m 55s |
| **Total** | | | 356.0k | 174.8k | 17.4M | 123.0k | | 785.2k | 3h 6m |
\* *Step used a non-Anthropic provider; caching behavior may differ.*
## Token Efficiency
| Step | LoC Changed | cache_read/LoC | cache_write/LoC | output/LoC |
|------|-------------|----------------|-----------------|------------|
| plan | 0 | — | — | — |
| verify | 0 | — | — | — |
| implement | 16 | 156056.6 | 0.0 | 1008.7 |
| retry_worktree | 0 | — | — | — |
| audit_impl | 0 | — | — | — |
| dispatch:1133b9e6-5319-48e2-b878-5f30f979fbcb | 0 | — | — | — |
| prepare_pr | 0 | — | — | — |
| compose_pr | 0 | — | — | — |
| review_pr | 0 | — | — | — |
| dispatch:9f9aa203-f3ea-44fd-9d3d-8f7ce0265f6f | 0 | — | — | — |
| merge_gate_fix | 7 | 75335.4 | 4210.6 | 791.0 |
| **Total** | **23** | 755144.3 | 34140.5 | 7600.8 |
## Model Usage Breakdown
| Model | steps | uncached | output | cache_read | cache_write | time |
|-------|-------|----------|--------|------------|-------------|------|
| opus[1m] | 1 | 9.1k | 37.2k | 4.4M | 231.7k | 45m 36s |
| sonnet | 7 | 2.1k | 112.4k | 9.7M | 553.5k | 2h 9m |
| MiniMax-M3 | 3 | 344.7k | 25.3k | 3.3M | 0 | 11m 25s |
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 3d7a765 commit aa38139
14 files changed
Lines changed: 357 additions & 32 deletions
File tree
- src/autoskillit
- fleet
- server/tools
- tests
- arch
- infra
- server
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
| |||
126 | 128 | | |
127 | 129 | | |
128 | 130 | | |
| 131 | + | |
129 | 132 | | |
130 | 133 | | |
131 | 134 | | |
| |||
179 | 182 | | |
180 | 183 | | |
181 | 184 | | |
| 185 | + | |
182 | 186 | | |
183 | 187 | | |
184 | 188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 49 | + | |
54 | 50 | | |
55 | 51 | | |
56 | 52 | | |
| |||
74 | 70 | | |
75 | 71 | | |
76 | 72 | | |
| 73 | + | |
77 | 74 | | |
78 | 75 | | |
79 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
83 | 94 | | |
84 | 95 | | |
85 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
| 42 | + | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| |||
209 | 213 | | |
210 | 214 | | |
211 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
212 | 248 | | |
213 | 249 | | |
214 | 250 | | |
| |||
230 | 266 | | |
231 | 267 | | |
232 | 268 | | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
237 | 272 | | |
238 | 273 | | |
239 | 274 | | |
| |||
242 | 277 | | |
243 | 278 | | |
244 | 279 | | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
| 280 | + | |
253 | 281 | | |
254 | 282 | | |
255 | 283 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
123 | 126 | | |
124 | 127 | | |
125 | 128 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
131 | 147 | | |
132 | 148 | | |
133 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| |||
306 | 310 | | |
307 | 311 | | |
308 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
309 | 324 | | |
310 | 325 | | |
311 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
0 commit comments