Conversation
…ized The rules system would create an infinite loop when: 1. Rules with compare_to: base fire when src/ files are modified 2. The assistant responds with <promise>Rule Name</promise> tags 3. The stop hook runs again and fires the same rules, ignoring promise tags Root cause: When a PROMPT action rule fires, a queue entry is created with QUEUED status. The hook only skipped rules with PASSED or SKIPPED status, so QUEUED rules would fire again even though they had already been shown to the agent. The promise tag mechanism relies on reading the transcript, which may not be available or may not contain the current response yet. Fix: Skip PROMPT rules that already have a QUEUED entry, since the agent has already seen this rule and doesn't need to see it again. Added tests: - test_queued_prompt_rule_does_not_refire - test_rule_fires_again_after_queue_cleared - test_promise_tag_still_prevents_firing
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.
The rules system would create an infinite loop when:
Root cause: When a PROMPT action rule fires, a queue entry is created with QUEUED status. The hook only skipped rules with PASSED or SKIPPED status, so QUEUED rules would fire again even though they had already been shown to the agent. The promise tag mechanism relies on reading the transcript, which may not be available or may not contain the current response yet.
Fix: Skip PROMPT rules that already have a QUEUED entry, since the agent has already seen this rule and doesn't need to see it again.
Added tests: