Fix #5: Refactor failed tool call detection to use JSON parsing#6
Merged
Fix #5: Refactor failed tool call detection to use JSON parsing#6
Conversation
…of regex - Replace regex-based pattern matching with proper JSON parsing using jq - Extract JSON objects containing "success": false from agent output - Format failed tool calls with tool names and error messages - Maintain backward compatibility with fallback to regex for non-JSON errors - Properly handle edge cases and errors in JSON parsing - Resolves #5
1 task
Contributor
|
@infer Don't maintain backward compatibility, please keep it simple, only use the jq approach to check specifically for "success" attribute. |
Contributor
Author
❌ Infer Agent Result: FailedModel: Agent OutputFailed Tool CallsTriggered by edenreich | Infer Action |
github-actions bot
pushed a commit
that referenced
this pull request
Nov 26, 2025
## [0.3.1](v0.3.0...v0.3.1) (2025-11-26) ### Bug Fixes * Properly escape GitHub event data in bash scripts ([48e8df7](48e8df7)) * Refactor failed tool call detection to use JSON parsing ([#6](#6)) ([562cb64](562cb64)), closes [#5](#5) * **workflow:** Update system prompt to follow conventional commit format ([#8](#8)) ([efe0b62](efe0b62)) ### Documentation * Update model provider in README ([90a236b](90a236b)) ### Maintenance * Update version ([4429ff2](4429ff2))
Contributor
Author
|
🎉 This PR is included in version 0.3.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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
This PR resolves issue #5 by refactoring the failed tool call detection in the infer workflow to use proper JSON parsing instead of permissive regex patterns.
Problem
The current implementation uses regex patterns that are too permissive and can match content that isn't actually failed tool calls:
grep -i "Tool execution failed\|command not whitelisted\|error" /tmp/agent-output.txtSolution
Replace the regex-based approach with proper JSON parsing using
jqto accurately detect when"success": falseoccurs in tool call results.Changes
"success": falsefrom agent outputjqto parse and format failed tool calls with tool names and error messagesImplementation Details
Benefits
"success": falseTesting
The implementation has been tested to ensure:
Resolves #5