fix(skill): line-budget batching and split-on-output-limit retry#202
fix(skill): line-budget batching and split-on-output-limit retry#202AsimRaza10 wants to merge 1 commit into
Conversation
Two changes to /understand orchestration so users on output-constrained models (Opus on Bedrock in particular) stop hitting "Batch X failed again (output limit). Retrying with minimal output mode." repeatedly: 1. **Cap batches by line count, not just file count.** The existing 20-30 file target is fine for typical batches but blows up when those 25 files are 400 lines each — output tokens scale with input size, not file count. Add a ~2,500 source-line cap that closes batches early when hit. 2. **Split-on-output-limit retry.** The Error Handling section currently retries any subagent failure once with the same prompt. For output-limit failures that just wastes a retry (the prompt is what caused the overflow). Instead, split the batch in half by file list and dispatch each half as a fresh batch with new batchIndex values. Recursively split if a half-batch still hits the cap; only skip after shrinking to a single file that still fails. Closes Lum1104#159
|
Closing this — PR #204 (merged just now) fixes #159 via a more comprehensive route: a programmatic My input-side line cap and orchestrator-level split-retry aren't present in #204, but they're not the right shape to graft onto the new architecture — the line cap would belong inside Thanks @Lum1104 for the thorough fix on #159. Happy to revisit if you want a line-aware secondary cap added to |
|
Thanks for helping, really appreciate it!
…---- Replied Message ----
| From | Asim ***@***.***> |
| Date | 05/24/2026 21:24 |
| To | Lum1104/Understand-Anything ***@***.***> |
| Cc | Yuxiang ***@***.***>,
Mention ***@***.***> |
| Subject | Re: [Lum1104/Understand-Anything] fix(skill): line-budget batching and split-on-output-limit retry (PR #202) |
Closed #202.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Summary
Fixes #159 — "Frequently seeing 'Batch X failed again (output limit). Retrying with minimal output mode.' on Opus + Bedrock for a 100-file repo. Can we split into smaller batches?"
Two tweaks to
understand-anything-plugin/skills/understand/SKILL.md. Both are prompt-only — no code changes, no schema changes.1. Cap batches by line count, not just file count
The current batching guidance says "20-30 files each, aim for ~25." That's fine for typical mixes, but on repos where files run 300-500 lines (web frameworks, generated config, fat test files) a 25-file batch can carry 10K+ source lines. Output tokens scale with input size, so on output-constrained models — Opus on Bedrock is the canonical case from the issue — those batches blow past
max_tokensbefore the response finishes.Added: a ~2,500 total-source-line cap that closes a batch early when hit, regardless of file count. The 20-30 file target becomes a ceiling rather than a quota.
$FILE_LISTalready carriessizeLinesfrom Phase 1, so no new data needed at batching time.2. Split-on-output-limit retry (instead of identical retry)
The Error Handling section currently retries any subagent failure once with the same prompt. For output-limit failures specifically, that's a wasted retry — the prompt is what caused the overflow, so a verbatim retry will overflow the same way.
Added: when the failure signal is output-token overflow (e.g.
output limit exceeded,max_tokens reached, truncated JSON), split the failing batch in half by file list and dispatch each half as a fresh batch with a newbatchIndex(avoidsbatch-<index>.jsoncollisions). Recurse if a half still hits the cap. Only fall back to skip-and-continue after the batch has been shrunk to a single file that still fails.This means a transient output overflow gets healed by smaller batches rather than burning the retry budget and dropping that batch's contribution to the graph.
Why this is prompt-only
Both behaviours are already orchestrated by the main session reading SKILL.md — there's no separate scheduler to teach. The batching loop in Phase 2 needs one extra line of bookkeeping (running line sum); the retry logic in Error Handling needs the new branch.
What this doesn't change
batchIndexvalues, including split-batch ones).--max-batch-linesif maintainer wants user override.Files changed
understand-anything-plugin/skills/understand/SKILL.mdTest plan
Closes #159