Skip to content

Bound Unbounded Routing Loops in Research-Family Recipes#2209

Merged
Trecek merged 6 commits into
developfrom
unbounded-routing-loops-in-research-family-recipes-cause-fle/2205
May 8, 2026
Merged

Bound Unbounded Routing Loops in Research-Family Recipes#2209
Trecek merged 6 commits into
developfrom
unbounded-routing-loops-in-research-family-recipes-cause-fle/2205

Conversation

@Trecek
Copy link
Copy Markdown
Collaborator

@Trecek Trecek commented May 8, 2026

Summary

Research-family recipes had 8 unbounded routing loops across 3 files (research-design.yaml, research.yaml, research-implement.yaml). These loops used retries: N + on_exhausted as their escape hatch, but retries only decrements on infrastructure failures (stale/resume), not on semantic on_result routing — making the escape hatch dead code for routing cycles.

This fix adds check_loop_iteration guard steps to all 8 loops, promotes the unbounded-cycle validation rule's WARNING to ERROR for cycles where retries cannot provide termination, and corrects misleading "bounded by retries: 2" descriptions in the recipe headers.

Requirements

(none — no new functional requirements; this is a corrective change)

Architecture Impact

(no validated diagrams — arch lens outputs were context files, not rendered diagrams)

Closes #2205

Implementation Plan

Plan file: /home/talon/projects/autoskillit-runs/impl-20260507-170916-720653/.autoskillit/temp/make-plan/unbounded_routing_loops_plan_2026-05-07_171600.md

🤖 Generated with Claude Code via AutoSkillit

Token Usage Summary

Step Model count uncached output cache_read peak_ctx turns cache_write time
plan claude-sonnet-4-6 1 6.1k 18.7k 874.8k 96.6k 137 89.3k 10m 30s
verify claude-opus-4-6 1 30 17.4k 589.5k 71.8k 55 58.7k 7m 23s
implement* MiniMax-M2.7 1 88.9k 12.7k 3.2M 0 94 0 3m 17s
prepare_pr* MiniMax-M2.7 1 49.1k 5.6k 341.7k 0 23 0 1m 52s
compose_pr* MiniMax-M2.7 1 42.7k 1.9k 319.3k 0 20 0 41s
review_pr claude-opus-4-6 3 104 81.3k 1.7M 83.4k 94 202.5k 20m 31s
resolve_review claude-opus-4-6 1 49 10.4k 1.2M 68.2k 54 55.3k 7m 48s
Total 187.1k 147.9k 8.2M 96.6k 405.8k 52m 3s

* 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 383 8453.6 0.0 33.1
prepare_pr 0
compose_pr 0
review_pr 0
resolve_review 13 91599.5 4253.8 796.8
Total 396 20759.8 1024.8 373.5

Model Usage Breakdown

Model steps uncached output cache_read cache_write time
claude-sonnet-4-6 2 858 32.3k 1.2M 83.1k 9m 33s
MiniMax-M2.7-highspeed 1 5.4M 26.6k 4.3M 188.3k 13m 26s

Trecek and others added 6 commits May 7, 2026 17:40
…s with success re-entry

When a routing cycle has retries > 0 with on_exhausted outside the cycle, but the
success path re-enters the cycle, the retry budget only bounds individual visits — not
the outer loop. The outer loop remains unbounded and should block recipe loading.

Also update the message to suggest check_loop_iteration guard steps as the fix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add guard steps to bound 8 routing loops across research-design.yaml,
research.yaml, and research-implement.yaml:
- review_design loop: check_design_review_loop (3 iters) in research-design, research
- implement_phase loop: check_implement_fix_loop (3 iters) in research, research-implement
- run_experiment loop: check_run_fix_loop (3 iters) in research, research-implement

Route revise_design → check_design_review_loop (instead of plan_experiment).
Route adjust_experiment → check_run_fix_loop (instead of run_experiment).
Route route_implement_failure → check_implement_fix_loop (instead of plan_phase).

Guard steps use run_python with check_loop_iteration callable and provide
on_failure routing to escape steps outside the cycle. Update all
misleading "bounded by retries: 2" descriptions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tion

- Update research-design step count (9→10) and step names to include check_design_review_loop
- Update revise_design routing expectation to check_design_review_loop
- Update research-implement step count (20→22) for two new guard steps
- Update adjust_experiment routing to check_run_fix_loop
- Update on_context_limit test to expect ERROR instead of WARNING
- Add unbounded-cycle to KNOWN_PART_B_VIOLATIONS for non-research recipes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The note described the cycle as run_experiment → troubleshoot → adjust_experiment
but the actual sub-loop enters via troubleshoot_run_failure → route_run_failure →
adjust_experiment. Updated both YAML and JSON variants.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The test asserts severity==ERROR and expects exactly one finding, so the
_is_clean suffix was misleading. Renamed to _is_error to match behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rity promotion

Renamed cycle_warnings to cycle_findings and updated the assertion message
from "Expected a cycle WARNING" to "Expected a cycle ERROR" to match the
actual Severity.ERROR expectation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Trecek Trecek added this pull request to the merge queue May 8, 2026
Merged via the queue into develop with commit 3609e7b May 8, 2026
2 checks passed
@Trecek Trecek deleted the unbounded-routing-loops-in-research-family-recipes-cause-fle/2205 branch May 8, 2026 01:42
Trecek added a commit that referenced this pull request May 8, 2026
## Summary

Research-family recipes had 8 unbounded routing loops across 3 files
(`research-design.yaml`, `research.yaml`, `research-implement.yaml`).
These loops used `retries: N` + `on_exhausted` as their escape hatch,
but `retries` only decrements on infrastructure failures (stale/resume),
not on semantic `on_result` routing — making the escape hatch dead code
for routing cycles.

This fix adds `check_loop_iteration` guard steps to all 8 loops,
promotes the `unbounded-cycle` validation rule's WARNING to ERROR for
cycles where retries cannot provide termination, and corrects misleading
"bounded by retries: 2" descriptions in the recipe headers.

## Requirements

*(none — no new functional requirements; this is a corrective change)*

## Architecture Impact

*(no validated diagrams — arch lens outputs were context files, not
rendered diagrams)*

Closes #2205

## Implementation Plan

Plan file:
`/home/talon/projects/autoskillit-runs/impl-20260507-170916-720653/.autoskillit/temp/make-plan/unbounded_routing_loops_plan_2026-05-07_171600.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 | claude-sonnet-4-6 | 1 | 115 | 17.6k | 424.6k | 50.8k | 58 |
42.5k | 5m 28s |
| verify | claude-sonnet-4-6 | 1 | 743 | 14.7k | 788.3k | 53.4k | 69 |
40.6k | 4m 5s |
| implement* | MiniMax-M2.7-highspeed | 1 | 5.4M | 26.6k | 4.3M | 91.9k
| 321 | 188.3k | 13m 26s |
| **Total** | | | 5.4M | 58.9k | 5.5M | 91.9k | | 271.4k | 23m 0s |

\* *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 | 272 | 15792.7 | 692.3 | 97.8 |
| **Total** | **272** | 20251.8 | 997.7 | 216.7 |

## Model Usage Breakdown

| Model | steps | uncached | output | cache_read | cache_write | time |
|-------|-------|----------|--------|------------|-------------|------|
| claude-sonnet-4-6 | 2 | 858 | 32.3k | 1.2M | 83.1k | 9m 33s |
| MiniMax-M2.7-highspeed | 1 | 5.4M | 26.6k | 4.3M | 188.3k | 13m 26s |

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant