Skip to content

feat: enhance output validator with error handling and schema support#5

Merged
Z-M-Huang merged 2 commits into
mainfrom
output-validator-improve
May 26, 2026
Merged

feat: enhance output validator with error handling and schema support#5
Z-M-Huang merged 2 commits into
mainfrom
output-validator-improve

Conversation

@Z-M-Huang
Copy link
Copy Markdown
Collaborator

No description provided.

@Z-M-Huang Z-M-Huang added the gvi:reviewing GitVibe is reviewing a pull request. label May 26, 2026
Copy link
Copy Markdown
Collaborator Author

@Z-M-Huang Z-M-Huang left a comment

Choose a reason for hiding this comment

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

GitVibe Review Matrix

Status: completed
Next state: changes-required

Synthesized 3 successful role reviews for PR #5 and performed an additional diff inspection. One regression needs a fix before approval: discriminator auto-enabling can turn previously valid schemas into invalid configured schemas.

Next Action

Continue with changes-required.

Result

When present, required fixes are posted as pull request review comments. Full structured output remains in the workflow run summary.
Workflow run: https://github.com/markhuangai/agentool/actions/runs/26477105606

Inline comments: 1

Required Fixes

  1. src/output-validator/index.ts:192 unconditionally adds discriminator: true whenever hasOneOfDiscriminator(config.schema) is true. Ajv documents that discriminator mode is not enabled by default and that compile fails when its limitations are not met, including unsupported mapping, missing required discriminator property, non-inline/non-direct-$ref branches, or non-unique const/enum tag values. Because the pre-PR Ajv config used strict: false without discriminator mode, those schemas could compile and validate through normal oneOf; this PR can now return Error [output-validator]: Invalid configured schema for every call. Fix by only enabling discriminator mode for schemas that satisfy Ajv's discriminator constraints, or by retrying compilation without discriminator mode when discriminator compilation fails.

Comment thread src/output-validator/index.ts Outdated
const ajv = new Ajv({
allErrors: true,
strict: false,
...(hasOneOfDiscriminator(config.schema) ? { discriminator: true } : {}),
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.

This enables Ajv discriminator mode for any schema that merely has discriminator.propertyName next to oneOf. Ajv discriminator mode has additional compile-time constraints, so schemas that previously compiled with normal oneOf validation can now become invalid configured schemas. Please add compatibility checks or fall back to a non-discriminator compile when discriminator compilation fails.

@Z-M-Huang Z-M-Huang added gvi:blocked GitVibe is blocked by missing or contradictory information. and removed gvi:reviewing GitVibe is reviewing a pull request. labels May 26, 2026
@Z-M-Huang Z-M-Huang added gvi:reviewing GitVibe is reviewing a pull request. and removed gvi:blocked GitVibe is blocked by missing or contradictory information. labels May 26, 2026
Copy link
Copy Markdown
Collaborator Author

@Z-M-Huang Z-M-Huang left a comment

Choose a reason for hiding this comment

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

GitVibe Review Matrix

Status: completed
Next state: review-passed

Synthesized 3/3 successful role reviews for PR #5 and re-inspected the follow-up diff. The prior discriminator auto-enable regression is addressed by a fallback compile path, and no blocking correctness, security, regression, test, or maintainability issues remain.

Next Action

Continue with review-passed.

Result

When present, required fixes are posted as pull request review comments. Full structured output remains in the workflow run summary.
Workflow run: https://github.com/markhuangai/agentool/actions/runs/26480711312

@Z-M-Huang Z-M-Huang added gvi:ready-for-approval GitVibe believes the issue is ready for approval. and removed gvi:reviewing GitVibe is reviewing a pull request. labels May 26, 2026
@Z-M-Huang Z-M-Huang merged commit 1c235d2 into main May 26, 2026
5 checks passed
@Z-M-Huang Z-M-Huang deleted the output-validator-improve branch May 26, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gvi:ready-for-approval GitVibe believes the issue is ready for approval.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant