fix(kiro): retry malformed tool_call wrappers once#2688
Open
SemonCat wants to merge 7 commits into
Open
Conversation
fazulfi
added a commit
to fazulfi/9router-mw
that referenced
this pull request
Jul 23, 2026
Backport missing test coverage from upstream decolua#2681 (tool-call validation) and decolua#2688 (one-shot repair-all). The corresponding kiro.js features were already present in the codebase; these tests close the coverage gap. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
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
tool_callwrappers429to existing account rotation/fallback logicRoot cause confirmed in production
The first implementation made the repair path opt-in. AWS live Kiro credentials did not set the option, so the real path was:
The malformed wrapper was validated and returned as
invalid_kiro_tool_callwithout entering the one-shot repair gate. This matched the live failure:This PR now removes that option entirely. Successful streaming Kiro responses always enter the bounded one-shot repair gate. Non-streaming and unsuccessful HTTP responses remain unchanged.
Dependency
Depends on #2681. This is intentionally a stacked PR; until #2681 merges, the GitHub diff also contains its commits. The repair-only diff is:
After #2681 merges, this branch can be rebased onto
masterso only the repair commits remain.Behavior
The repair gate:
[DONE]as meaningful outputkiro_tool_call_repair_retry_failedif the retry is also malformedOperational safety limits remain configurable; these are bounds, not enable/disable switches:
KIRO_TOOL_CALL_REPAIR_BUFFER_MAX_BYTESKIRO_TOOL_CALL_REPAIR_TTFT_TIMEOUT_MSKIRO_TOOL_CALL_REPAIR_STALL_TIMEOUT_MSTests
getExecutor("kiro").execute()with empty provider-specific data429remains a non-OK response for existing account rotationgit diff --checknpm run buildThe branch was deployed to AWS internal 9Router before the toggle removal and passed direct Kiro text and real terminal tool-call smoke tests; post-deploy logs showed zero
invalid_kiro_tool_call,kiro_tool_call_repair_retry_failed, orresponse.failedmarkers during the smoke window. The final toggle-removal commit does not change the already-active live behavior when no option is set; it removes the ability to bypass it.