Commit a72cb01
[FIX] Dispatch-Feasibility Preflight — Claim-Before-Validate Immunity (#4087)
## Summary
Add a dispatch-feasibility preflight in the server layer that fires at
`open_kitchen` and `dispatch_food_truck` time — validating that the
backend can dispatch the recipe's `run_skill` steps before any
irreversible side effects (clone, branch push, issue labeling) occur. On
preflight failure, the gate is closed, structurally denying all
downstream side-effect tools via `_require_enabled()`. This fixes the
"claim-before-validate" anti-pattern identified in production run
`impl-20260611-163753-197057` where the backend-compat check fired only
inside `run_skill`, after claims and branch pushes had already happened.
<details>
<summary>Individual Group Plans</summary>
### Plan 1: Rectify — Dispatch-Feasibility Preflight —
Claim-Before-Validate Immunity
The backend-compatibility gate (`_check_backend_compat`) fires only
inside `run_skill` — after irreversible external side effects (clone,
branch push, issue labeling) have already occurred. The incompatibility
is statically knowable at `open_kitchen` time from constants
(`HOOK_REGISTRY`, `backend.capabilities`). The architectural weakness is
that `open_kitchen` enables the gate and reveals tools before validating
that the backend can dispatch the recipe's steps, and no existing test
models the temporal ordering between gate-enable, side-effect tools, and
the compat check.
The immunity plan addresses three layers:
1. **LoadRecipeResult extension** — expose post-prune step names from
the recipe layer so the server can inspect them without duplicating
parse logic.
2. **Server-layer preflight** — a `_check_dispatch_feasibility` function
shared by `open_kitchen` and `dispatch_food_truck`, evaluated against
post-prune steps and the real backend, with gate-close on failure.
3. **Temporal-ordering test infrastructure** — tests that assert gate
state after validation failure, test with the real `HOOK_REGISTRY`, and
verify that side-effect tools are structurally denied after preflight
failure.
### Plan 2: Implementation — dispatch_food_truck Preflight Fix and
Missing Tests
Fix the `active_recipe_steps={}` bug in `dispatch_food_truck` that
renders the dispatch-feasibility preflight a no-op, and add four missing
tests: gate-closure after validation failure (1a), full `open_kitchen`
integration preflight (1b), real `HOOK_REGISTRY` test (1e), and
behavioral fleet dispatch preflight (1g).
The root cause is that `dispatch_food_truck` calls
`_check_dispatch_feasibility` with an empty dict for
`active_recipe_steps`, unlike `open_kitchen` which properly loads the
`Recipe` object via `recipes.find()` + `recipes.load()` and filters with
`filter_steps_by_post_prune()`. The fix mirrors the `open_kitchen`
pattern.
</details>
Closes #4083
## Implementation Plan
Plan files:
-
`/home/talon/projects/autoskillit-runs/remediation-20260611-215136-833713/.autoskillit/temp/rectify/rectify_dispatch_feasibility_preflight_2026-06-11_215136.md`
-
`/home/talon/projects/autoskillit-runs/remediation-20260611-215136-833713/.autoskillit/temp/make-plan/remediation_dispatch_feasibility_preflight_plan_2026-06-11_230600.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 |
|------|-------|-------|----------|--------|------------|----------|-------|-------------|------|
| resolve_review* | sonnet | 10 | 3.0k | 136.6k | 15.9M | 109.9k | 608 |
628.2k | 1h 6m |
| dispatch:44d3705c-3f62-459b-af5b-9678f2bbcb64* | sonnet | 1 | 114 |
3.6k | 1.2M | 94.6k | 28 | 94.9k | 23m 9s |
| plan* | opus[1m] | 10 | 9.8k | 210.3k | 14.0M | 136.8k | 432 | 818.6k
| 2h 19m |
| verify* | sonnet | 10 | 4.1k | 122.6k | 4.7M | 74.1k | 255 | 427.3k |
1h 2m |
| implement* | MiniMax-M3 | 10 | 24.0M | 134.7k | 0 | 0 | 722 | 0 | 1h
11m |
| audit_impl* | sonnet | 9 | 6.1k | 71.6k | 2.0M | 49.5k | 141 | 266.9k
| 43m 44s |
| prepare_pr* | MiniMax-M3 | 8 | 1.9M | 18.0k | 0 | 0 | 115 | 0 | 7m 59s
|
| compose_pr* | MiniMax-M3 | 8 | 1.6M | 13.2k | 0 | 0 | 103 | 0 | 6m 21s
|
| review_pr* | sonnet | 14 | 2.1k | 347.6k | 13.6M | 101.1k | 618 |
770.8k | 1h 26m |
| dispatch:0145c757-e69c-4878-929a-ba4acb07e3d1* | sonnet | 1 | 322 |
13.7k | 3.0M | 86.3k | 84 | 62.0k | 42m 39s |
| fix* | sonnet | 4 | 640 | 28.9k | 4.4M | 98.2k | 210 | 202.0k | 21m
12s |
| dispatch:341f411a-3d76-4fcf-88a3-15a64c6d7bd4* | sonnet | 1 | 354 |
10.0k | 3.4M | 86.4k | 89 | 62.0k | 1h 18m |
| dispatch:7e27c189-e656-4ec2-b528-b128157c59a8* | sonnet | 1 | 490 |
17.2k | 5.0M | 98.3k | 122 | 73.9k | 1h 26m |
| dispatch:36a96fbc-6c25-4316-a068-66f069a326ac* | sonnet | 1 | 386 |
14.1k | 3.8M | 89.9k | 102 | 65.5k | 1h 14m |
| dispatch:540912dc-04a8-4bda-b6dd-1ba4a533b68f* | sonnet | 1 | 418 |
12.6k | 4.1M | 89.9k | 106 | 65.5k | 1h 27m |
| dispatch:726982d8-8d44-4345-91ee-7c36d41bf8c0* | sonnet | 1 | 330 |
11.6k | 3.1M | 84.9k | 82 | 60.5k | 1h 10m |
| dispatch:c51e35aa-e1dc-42fd-91a6-8cadbf463f94* | sonnet | 1 | 418 |
12.6k | 4.1M | 90.7k | 107 | 66.3k | 1h 36m |
| dispatch:136d06d2-7313-45ac-b80d-f17a96a36af8* | sonnet | 1 | 322 |
10.0k | 3.0M | 83.9k | 80 | 59.5k | 1h 8m |
| **Total** | | | 27.5M | 1.2M | 85.2M | 136.8k | | 3.7M | 18h 54m |
\* *Step used a non-Anthropic provider; caching behavior may differ.*
## Token Efficiency
| Step | LoC Changed | cache_read/LoC | cache_write/LoC | output/LoC |
|------|-------------|----------------|-----------------|------------|
| resolve_review | 100 | 159103.9 | 6282.2 | 1366.2 |
| dispatch:44d3705c-3f62-459b-af5b-9678f2bbcb64 | 0 | — | — | — |
| plan | 0 | — | — | — |
| verify | 0 | — | — | — |
| implement | 1691 | 0.0 | 0.0 | 79.6 |
| audit_impl | 0 | — | — | — |
| prepare_pr | 0 | — | — | — |
| compose_pr | 0 | — | — | — |
| review_pr | 0 | — | — | — |
| dispatch:0145c757-e69c-4878-929a-ba4acb07e3d1 | 360 | 8363.5 | 172.2 |
38.2 |
| fix | 20 | 219002.4 | 10100.2 | 1446.6 |
| dispatch:341f411a-3d76-4fcf-88a3-15a64c6d7bd4 | 446 | 7548.5 | 139.0 |
22.5 |
| dispatch:7e27c189-e656-4ec2-b528-b128157c59a8 | 235 | 21444.0 | 314.5
| 73.2 |
| dispatch:36a96fbc-6c25-4316-a068-66f069a326ac | 0 | — | — | — |
| dispatch:540912dc-04a8-4bda-b6dd-1ba4a533b68f | 0 | — | — | — |
| dispatch:726982d8-8d44-4345-91ee-7c36d41bf8c0 | 0 | — | — | — |
| dispatch:c51e35aa-e1dc-42fd-91a6-8cadbf463f94 | 844 | 4875.8 | 78.5 |
14.9 |
| dispatch:136d06d2-7313-45ac-b80d-f17a96a36af8 | 0 | — | — | — |
| **Total** | **3696** | 23057.4 | 1007.5 | 321.7 |
## Model Usage Breakdown
| Model | steps | uncached | output | cache_read | cache_write | time |
|-------|-------|----------|--------|------------|-------------|------|
| sonnet | 14 | 19.1k | 812.8k | 71.2M | 2.9M | 15h 9m |
| opus[1m] | 1 | 9.8k | 210.3k | 14.0M | 818.6k | 2h 19m |
| MiniMax-M3 | 3 | 27.5M | 165.9k | 0 | 0 | 1h 25m |
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 93b7360 commit a72cb01
18 files changed
Lines changed: 867 additions & 44 deletions
File tree
- src/autoskillit
- hooks/formatters
- recipe
- server/tools
- tests
- arch
- infra
- recipe
- server
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
183 | 184 | | |
184 | 185 | | |
185 | 186 | | |
| 187 | + | |
186 | 188 | | |
187 | 189 | | |
188 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
| 583 | + | |
| 584 | + | |
583 | 585 | | |
584 | 586 | | |
585 | 587 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
137 | | - | |
| 138 | + | |
138 | 139 | | |
139 | 140 | | |
140 | 141 | | |
| |||
151 | 152 | | |
152 | 153 | | |
153 | 154 | | |
| 155 | + | |
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
| |||
65 | 64 | | |
66 | 65 | | |
67 | 66 | | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | 90 | | |
104 | 91 | | |
105 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| |||
312 | 316 | | |
313 | 317 | | |
314 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
315 | 360 | | |
316 | 361 | | |
317 | 362 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
| |||
625 | 629 | | |
626 | 630 | | |
627 | 631 | | |
628 | | - | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
629 | 635 | | |
630 | 636 | | |
631 | 637 | | |
| |||
638 | 644 | | |
639 | 645 | | |
640 | 646 | | |
| 647 | + | |
641 | 648 | | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
642 | 663 | | |
643 | 664 | | |
644 | 665 | | |
| |||
708 | 729 | | |
709 | 730 | | |
710 | 731 | | |
711 | | - | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
712 | 735 | | |
713 | 736 | | |
714 | 737 | | |
| |||
725 | 748 | | |
726 | 749 | | |
727 | 750 | | |
| 751 | + | |
728 | 752 | | |
729 | 753 | | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
730 | 769 | | |
731 | 770 | | |
732 | 771 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
858 | 858 | | |
859 | 859 | | |
860 | 860 | | |
861 | | - | |
| 861 | + | |
862 | 862 | | |
| 863 | + | |
| 864 | + | |
863 | 865 | | |
864 | 866 | | |
865 | 867 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
876 | 876 | | |
877 | 877 | | |
878 | 878 | | |
879 | | - | |
| 879 | + | |
880 | 880 | | |
881 | 881 | | |
882 | 882 | | |
| |||
962 | 962 | | |
963 | 963 | | |
964 | 964 | | |
965 | | - | |
| 965 | + | |
966 | 966 | | |
967 | 967 | | |
968 | 968 | | |
969 | 969 | | |
970 | 970 | | |
971 | | - | |
| 971 | + | |
| 972 | + | |
972 | 973 | | |
973 | 974 | | |
974 | 975 | | |
| |||
0 commit comments