fix: add delegation confirmation to prevent LLM confusion loops#2285
Open
mikeangstadt wants to merge 1 commit into
Open
fix: add delegation confirmation to prevent LLM confusion loops#2285mikeangstadt wants to merge 1 commit into
mikeangstadt wants to merge 1 commit into
Conversation
RTK rewrites (e.g. ruff check) output only the tool's filtered result (e.g. 'Ruff: No issues found'), but the surrounding shell command ($ rtk ruff check ...) confuses LLMs into thinking they mistyped 'rtk' instead of 'ruff', causing infinite re-execution loops. Add 'rtk: <tool> done' confirmation after every successful filtered command so the LLM sees both rtk and the tool name in the same output line, confirming the delegation was intentional and completed. Fixes rtk-ai#2280
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.
Problem
When RTK runs a delegated command like
ruff check, the output shows the full command in the bash tool result (e.g.$ rtk ruff check ... --fix) followed by the filtered output (Ruff: No issues found). LLMs misinterpret the$ rtkprefix as a typo for the underlying tool (ruff), causing them to re-execute the command directly in an infinite loop.Solution
After every successful filtered command, RTK now prints a delegation confirmation line:
This makes it unambiguous that
rtkwas intentional and the command successfully completed. The LLM sees both names in the same line and understands the delegation was correct.Example output before
Example output after
Testing
rtk: <tool> doneline only appears for commands that succeed (exit_code == 0)tee_labelorno_trailing_newlinepaths are unaffectedFixes #2280
Collaborated & Orchestrated by ClosedLoop.AI | www.closedloop.ai · github.com/rtk-ai