fix(core): treat blank subagent optionals as absent - #64
Merged
Conversation
GPT-family models (observed on gpt-5.6-sol in production) fill every tool schema property and send "" for fields they mean to omit. The forking subagent parser rejected these calls with 'agent_id must not be blank.', so every dispatch failed and sessions fell back to inline work. Normalize blank/whitespace optionals to undefined before validation: blank agent_id/subagent_type/skill/description parse as absent, blank fork_turns falls back to the 'all' default, and blank selectors no longer count toward the mutual-exclusivity check. A blank prompt is still an error. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> HumanLayer-Session: https://app.dev.codelayer.gg/sessions/019ff95b-c6a6-74f2-88bd-9e543222702e
Docs Agent ReviewAgent finished with reason: error To apply these recommendations, comment: |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> HumanLayer-Session: https://app.dev.codelayer.gg/sessions/019ff95b-c6a6-74f2-88bd-9e543222702e
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
In production, Codex sessions on
gpt-5.6-solintermittently emitagenttool calls with every schema property present, using""for fields they mean to omit:{"skill": "", "prompt": "...", "agent_id": "", "fork_turns": "", "description": "...", "subagent_type": "rpi:codebase-analyzer"}parseSubagentCommandrejected these withError: agent_id must not be blank.— every subagent dispatch in the affected sessions failed (example prod session:019ff92b-9c3b-70cf-93c5-74aeb76d9389, 6/6 agent calls errored and the model gave up on subagents).The schema we send is correct (
required: ["prompt"],strict: false); the blank-filling is upstream model serving variance — the same host, build, and settings produce omitted-style calls most of the time and blank-filled episodes at others. We can't control that, so blank must mean absent.Fix
Normalize blank/whitespace optional strings to
undefinedbefore validation:agent_id/subagent_type/skill/descriptionparse as absentfork_turnsfalls back to the'all'defaultpromptis still an errorWith this, the failing production calls parse exactly as intended (dispatch-role and fork commands).
Testing
subagent-tool.test.tsexpectations and added a test covering the exact blank-filled production shapebun testinagentlayer-core: 506 pass / 0 fail;agents/codelayer: 116 pass / 0 failtsgo --noEmitclean🤖 Generated with Claude Code