Repository navigation
fix(pi): break the output-token-limit retry loop with a loop-guard extension - #49
Merged
Merged
Conversation
Contributor
Review — PASSHead SHA: Change class: harness config + extension (project-local Security screen: PASS — no secrets, no exfiltration, no network calls, no weakened guardrails, no scope mismatch (diff matches description exactly: Checklist: All applicable rules PASS or NA.
Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
This was referenced Sep 7, 2026
This was referenced Oct 23, 2026
github-actions Bot
pushed a commit
that referenced
this pull request
Oct 24, 2026
…sdk and distro-cachyos producer work (#684) (#685) The currency report named four pins that were not current, and every one of them is a fast-forward against its own remote: charly 6f62efbf3a -> 2386643d4 charly#1055, #1062, #1067, #1068, #1069 distro-cachyos 1893455d3a -> 6abe89522 distro-cachyos#157 -- the EDGE: charly's own box/cachyos gitlink, advanced by charly#1055 plugin-task 69223053ff -> 30c57809b plugin-task#47, #49, #52 sdk 306d3d15c2 -> d71b9abb4 sdk#475 The advance is the sanctioned verb's, never a hand-pin: `charly task sync` rolled the submodules to their default-branch HEAD and advanced the pins in the index, `charly task init` materialized the checkouts AT those pins, the worktree-local binary was rebuilt from the new charly pin (R9, stamp 2026.297.2323), and `charly task verify` judged the tree on the committed commit: 33 step(s), 0 failed, 0 skipped, zero warnings. The currency question, asked again on the same tree: 0 of 411 pin(s) NOT current -- every pin is at the ref its intent names. That closes the nine rows filed as #669: eight moved in #671, and distro-cachyos moved here once charly#1055 advanced the edge's source. The bump's own report counts index WRITES (406) where this commit carries the four gitlinks that MOVED; the difference is a defect in the verb that owns the count and is filed as opencharly/plugin-task#53. Refs #684, #669 Assisted-by: Claude Code minimax/minimax-m3.1-flash:cloud (fully tested and validated)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The pi agent looped for hours generating hundreds of IDENTICAL tool calls, each rejected with "the response hit the output token limit, so its arguments may be truncated" (600M+ tokens burned, zero progress).
RCA (8-step): when the model's response exceeds the output token cap, the pi harness (
runLoop→failToolCallsFromTruncatedMessage) rejects every tool call in the truncated message with the error "Re-issue the tool call with complete arguments" and returnsterminate: false. That error message INSTRUCTS the model to re-issue the same call; the model regenerates the same oversized response; it is truncated again; the loop repeats forever. The truncated path bypasses thetool_call/tool_resultextension events, so the loop cannot be intercepted at the rejection — but the RETRY goes through the normal path.Fix (root, not workaround): a new project extension
.pi/extensions/loop-guard.tsthat:message_endwithstopReason === "length"(truncated response), records the tool calls the truncated message carried.tool_call, when a call matches a recorded truncated call (same tool + same args), BLOCKS it with a corrective directive: do NOT re-issue — make a SHORTER response, split the work, or delegate to a subagent.This changes the actual instruction that drives the loop (the harness's "Re-issue the tool call") into one that breaks it, at the exact point where the loop repeats. Plus
.pi/APPEND_SYSTEM.mdcarries the behavioral discipline (short calls, minimal responses, subagents for exploration, never retry a truncated call).How tested
node --checkon the extension: syntax OK.pi.on("message_end"),pi.on("tool_call")with{block: true, reason}), same import pattern as the existinggithub-pr-status.ts/umbrella-gates.tsextensions..pi/settings.json).Rulebook compliance
.pi/is an umbrella-specific fork (not in the SHARED parity list); the change is scoped to the umbrella's own config.Change classification
Assisted-by: pi openrouter/deepseek/deepseek-v4-flash-0731 (analysed on a live system)