fix(subagent): only block fenced-block calls with matching tool tags#1464
Merged
fix(subagent): only block fenced-block calls with matching tool tags#1464
Conversation
FilteredToolExecutor::execute_erased() was unconditionally returning Err(ToolError::Blocked) for every LLM response, including plain text replies with no tool invocations. This caused sub-agents to exhaust their max_turns limit on false-positive blocks without ever producing a response (issue #1432). Fix: collect registered fenced-block language tags at construction time and check whether the response actually contains a fenced block matching one of those tags before blocking. Plain text and non-tool code fences now return Ok(None), allowing the agent loop to break cleanly.
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
FilteredToolExecutor::execute_erased()was unconditionally returningErr(ToolError::Blocked)for every LLM response, regardless of whether it contained an actual tool invocationmax_turnswithout producing a responseChanges
crates/zeph-core/src/subagent/filter.rs: addedfenced_tagsfield (cached at construction),has_fenced_tool_invocation()helper, updatedexecute_erased()andexecute_confirmed_erased()to returnOk(None)for non-tool responsesCHANGELOG.md: updated[Unreleased]sectionTest plan
cargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins— 4892 tests passcargo +nightly fmt --check— cleancargo clippy --workspace --features full -- -D warnings— clean/agent spawnanswers questions instead of exhausting turns on false-positive blocksFixes #1432