Skip to content

fix(core): treat blank subagent optionals as absent - #64

Merged
K-Mistele merged 2 commits into
mainfrom
fix-blank-subagent-optionals
Aug 13, 2026
Merged

fix(core): treat blank subagent optionals as absent#64
K-Mistele merged 2 commits into
mainfrom
fix-blank-subagent-optionals

Conversation

@K-Mistele

Copy link
Copy Markdown
Contributor

Problem

In production, Codex sessions on gpt-5.6-sol intermittently emit agent tool 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"}

parseSubagentCommand rejected these with Error: 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 undefined before validation:

  • blank agent_id / subagent_type / skill / description parse as absent
  • blank fork_turns falls back to the 'all' default
  • blank selectors no longer count toward the mutual-exclusivity check (real ones still do)
  • blank prompt is still an error

With this, the failing production calls parse exactly as intended (dispatch-role and fork commands).

Testing

  • Updated subagent-tool.test.ts expectations and added a test covering the exact blank-filled production shape
  • bun test in agentlayer-core: 506 pass / 0 fail; agents/codelayer: 116 pass / 0 fail
  • tsgo --noEmit clean

🤖 Generated with Claude Code

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
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

Docs Agent Review

Agent finished with reason: error


To apply these recommendations, comment: @docs-agent apply

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
HumanLayer-Session: https://app.dev.codelayer.gg/sessions/019ff95b-c6a6-74f2-88bd-9e543222702e
@K-Mistele
K-Mistele merged commit 6a599ec into main Aug 13, 2026
6 checks passed
@K-Mistele
K-Mistele deleted the fix-blank-subagent-optionals branch August 13, 2026 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant