fix(agent): normalize neutral Task action placeholders - #1852
Merged
Conversation
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
Taskinput boundary.null, blank strings, and defaultfalsevalues as omitted when they carry no action intent.agent_idonspawnor a non-emptysubagent_typewithfork_context=true.Root Cause
This is not caused by managed worktree execution.
The failing call was rejected by
Taskargument validation before workspace resolution or subagent creation. Its model-generated payload included neutral placeholders for fields that do not apply to the selected action:{ "action": "spawn", "agent_id": "", "fork_context": true, "subagent_type": "" }The regular
Tasktool intentionally uses one flat schema forspawn,send_input, andcancel. Some models serialize unused optional properties instead of omitting them. The validator previously treated raw key presence as intent, so an emptyagent_idwas incorrectly rejected as a spawn conflict.Historical managed-worktree sessions successfully spawned subagents with clean payloads, and the existing worktree inheritance test confirms that a fresh subagent receives the parent managed-worktree binding correctly.
Design
The public tool schema and action model remain unchanged. Parsing now uses semantic optional values:
nullare absent;falsetoggles are absent when an action forbids that toggle;true, and other concrete values remain present and are validated normally.This keeps strict action invariants while making the boundary robust across model providers.
Verification
pnpm run fmt:rscargo test -p bitfun-core validate_input_ -- --nocapture(25 passed)cargo test -p bitfun-core neutral_ -- --nocapture(4 passed)cargo test -p bitfun-core fresh_subagent_inherits_matching_parent_worktree_binding -- --nocapture(1 passed)cargo check --workspacenode scripts/check-core-boundaries.mjsgit diff --check