Commit a83df66
fix(agent): pop agent_stack on failed handoff; guard recent_turns<=0 (#60)
Three handoff-path fixes, verified against the merged-onto-new-dev state.
- executor.py: a failed handoff now pops the target whenever it is on top of agent_stack (it was pushed only after early depth/cycle/registry checks passed), regardless of return_to_parent. Prevents a stuck target from tripping false cycle detection on retry and inflating agents_used.
- handoff/history.py: _find_turn_boundary returns len(messages) for recent_turns<=0 so the recent slice is empty (RECENT_N/HYBRID). Previously user_indices[-0] returned nearly the full history.
- utils/sanitization.py: allow '|' in user_id/conversation_id (Auth0-style 'sub' claims). ':' remains the only excluded key delimiter; nothing splits on '|', so no scope-bleed.
Adds adversarial tests for handoff depth/cycle/stack-cleanup/summarization and a whitespace user_id journey test.
Co-Authored-By: claude-flow <ruv@ruv.net>1 parent 4612344 commit a83df66
7 files changed
Lines changed: 1049 additions & 7 deletions
File tree
- src/continuum
- agent
- execution
- handoff
- utils
- tests
- integration
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
639 | 639 | | |
640 | 640 | | |
641 | 641 | | |
642 | | - | |
643 | | - | |
644 | | - | |
645 | | - | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
646 | 650 | | |
647 | 651 | | |
648 | 652 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
115 | | - | |
| 117 | + | |
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
| |||
0 commit comments