Commit 32d9eaa
fix: break delegate→plan-mode→approve infinite loop
The Stop hook's continuation injection used `reason: "continue"` which the
model interpreted as a fresh work request. Combined with orchestrator_stub's
"all work MUST go via /workflow-orchestrator:delegate" rule and delegate.md's
unconditional EnterPlanMode at Stage 0, this caused an infinite
ExitPlanMode → Stop hook → continue → delegate → EnterPlanMode → ExitPlanMode
loop after every plan approval.
Three-layer fix:
- Stop hook continuation message is now explicit anti-redelegation
(hooks/stop/python_stop_hook.py).
- Orchestrator stub adds an "Exception — continuation after plan approval"
clause that overrides the routing rule during in-flight delegation
(system-prompts/orchestrator_stub.md).
- delegate.md gets a "RE-INVOCATION GUARD" section as the first content
after frontmatter, telling the skill to skip Stage 0 if it just exited
plan mode (commands/delegate.md).
Layered guards because the loop is driven by model interpretation, not
deterministic state — any one layer alone could be missed by prompt cache
effects or session resumes; together they harden the path.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent b65f6a8 commit 32d9eaa
3 files changed
Lines changed: 15 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
177 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
178 | 183 | | |
179 | 184 | | |
180 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
| |||
0 commit comments