Skip to content

fix(ai): name the field a nullable section's submission got wrong - #1002

Merged
sroussey merged 1 commit into
mainfrom
claude/agent-submit-anyof-errors
Oct 2, 2026
Merged

sroussey merged 1 commit into
mainfrom
claude/agent-submit-anyof-errors

Conversation

@sroussey

@sroussey sroussey commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

What

AgentTask turns a failed submit_answer validation into a correction for the model. For a section typed anyOf: [object, null], json-schema-library reports only any-of-error: "Value {…} at #/x does not match any schema of […]". The model can't tell what to fix from that.

describeSchemaErrors (in ToolCallingUtils) handles failing anyOf/oneOf errors. When exactly one branch accepts the value's JSON type, it validates the value against that branch and reports the branch's own errors, re-rooted at the value's path. All other errors pass through unchanged.

Before:

Value {"security_type":"Units",…} at #/offering_terms does not match any schema of [{"type":"object",…},{"type":"null"}]

After:

Additional property trust_total in #/offering_terms/trust_total is not allowed

Why

In an embarc-data production run (108k filings read), 23 of 26 S-1 readings that hit their 9-minute budget did so by resubmitting an invalid answer. In 15 of those, the only fault was one extra property in a nullable section. One session submitted 36 times.

Tests

  • New: packages/test/src/test/ai/describeSchemaErrors.test.ts.
  • Passing: AgentTask.test.ts, AgentTaskTurnControls.test.ts.
  • Checked by hand against a real failed submission and the embarc schema (the Before/After above).

🤖 Generated with Claude Code

https://claude.ai/code/session_01QnfZoVpU6VAoGoTkN3jtmv

An answer section typed object-or-null that failed its schema was reported
as "does not match any schema of [...]", with the whole value and both
branches echoed back. The model never learned which field was wrong. In a
production run of 108k filings, 15 of 26 answer-budget failures were one
model resubmitting the same extra property until its time ran out.

When exactly one branch of a failing anyOf/oneOf takes the value's JSON
type, AgentTask now reports that branch's own errors, re-rooted at the
value's path: "Additional property `trust_total` in
`#/offering_terms/trust_total` is not allowed".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QnfZoVpU6VAoGoTkN3jtmv

@mergestorm-vortex mergestorm-vortex Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review progress ██████████ 3/3 files

Approve — reviewed files look good at 70dc294.

✅ All clear — nothing to fix.


Try MergeStorm

@sroussey
sroussey merged commit cfb2935 into main Oct 2, 2026
19 checks passed
@sroussey
sroussey deleted the claude/agent-submit-anyof-errors branch October 2, 2026 04:38
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