Skip to content

fix(coderd/x/chatd/toolschema): traverse schema branches - #31128

Merged
hugodutka merged 1 commit into
mainfrom
hugodutka/acp-fix-anyof-validation
Oct 26, 2026
Merged

hugodutka merged 1 commit into
mainfrom
hugodutka/acp-fix-anyof-validation

Conversation

@hugodutka

Copy link
Copy Markdown
Collaborator

Tool input validation skipped properties declared inside composed schemas, allowing case-variant keys to bypass ambiguity checks. Traverse anyOf, oneOf, and allOf branches when checking nested objects, arrays, and free-form map values, while preserving exact property matches.

Generated with Codex, carefully reviewed by Hugo.

@hugodutka
hugodutka added this pull request to stack #31131 October 21, 2026 16:34
@hugodutka
hugodutka marked this pull request as ready for review October 21, 2026 16:34
@mafredri
mafredri self-requested a review October 22, 2026 09:44
Comment thread coderd/x/chatd/toolschema/toolschema.go Outdated
return xerrors.Errorf("input key %q differs from schema property %q only by case", path, name)
for _, properties := range propertySets {
for _, name := range slices.Sorted(maps.Keys(properties)) {
if strings.EqualFold(name, key) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps we should drop the range above and just do name != key && strings.EqualFold(name, key)? Say we have both "config" and "CONFIG", where the latter would be invalid, we wouldn't error out. Perhaps overly defensive?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@hugodutka
hugodutka force-pushed the hugodutka/acp-fix-anyof-validation branch from 906ac3f to 50e8652 Compare October 23, 2026 11:14
@hugodutka
hugodutka force-pushed the hugodutka/acp-fix-anyof-validation branch from 50e8652 to fff39f3 Compare October 26, 2026 16:01
@hugodutka
hugodutka merged commit 457d777 into main Oct 26, 2026
27 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 26, 2026
@hugodutka
hugodutka deleted the hugodutka/acp-fix-anyof-validation branch October 26, 2026 16:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants