Skip to content

Enforce advertised Tool argument constraints - #955

Draft
Y1fe1Zh0u wants to merge 2 commits into
dataelement:002-tool-runtime-contractfrom
Y1fe1Zh0u:fix/tool-schema-validation
Draft

Enforce advertised Tool argument constraints#955
Y1fe1Zh0u wants to merge 2 commits into
dataelement:002-tool-runtime-contractfrom
Y1fe1Zh0u:fix/tool-schema-validation

Conversation

@Y1fe1Zh0u

Copy link
Copy Markdown
Collaborator

Summary

  • enforce the JSON Schema keywords already used by production Tool definitions
  • reject length, range, array, pattern, format, dependency, and conditional-shape violations before handlers run
  • keep validation issues bounded, value-free, and compatible with the existing model repair path

Validation

  • 118 Runtime Tool validation, Tool Step, and builtin contract tests passed
  • targeted regressions for six previously silent violations passed
  • scoped Ruff and git diff checks passed

Boundaries

  • no new dependency
  • not a complete JSON Schema implementation
  • no handler or Tool Registry refactor

Set the existing protocol repair, safe-read replay, and model-visible Tool episode limits to ten while preserving their current independent state and execution semantics. Update focused tests and planning artifacts to make the off-by-one behavior explicit.

Constraint: Tool-related retry and repair limits must be ten without restructuring the existing counters

Rejected: Unify protocol, Receipt, and model-visible repair state now | counter redesign is intentionally deferred

Confidence: high

Scope-risk: moderate

Directive: Keep the independent counters until the planned repair-control refactor; do not infer identical attempt semantics from the shared numeric limit

Tested: 911 Runtime and Tool pytest cases; scoped Ruff; fatal-level caller Ruff; py_compile; git diff --check

Not-tested: Live Provider credentials
The Runtime validator now enforces the JSON Schema keywords already used by production Tool definitions, so arguments rejected by the advertised contract cannot reach a handler. Failures remain bounded, value-free, and use the existing repairable Tool result path.

Constraint: No new dependency and no attempt to implement the entire JSON Schema specification.

Rejected: Add a general JSON Schema package | broader dependency and behavior change than required by the current Tool catalog.

Confidence: high

Scope-risk: moderate

Directive: Add validator support when introducing a new schema keyword; unsupported schema contracts must not silently pass.

Tested: 118 Runtime Tool validation, Tool Step, and builtin contract tests; scoped Ruff; git diff --check.

Not-tested: Property-based comparison against a complete JSON Schema implementation.
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