Skip to content

fix(runtime): explicitly disable Responses strict mode when unsupported - #2454

Merged
vastsa merged 2 commits into
vastsa:mainfrom
jeffry88:fix/agent-runtime/responses-explicit-nonstrict
Nov 20, 2026
Merged

vastsa merged 2 commits into
vastsa:mainfrom
jeffry88:fix/agent-runtime/responses-explicit-nonstrict

Conversation

@jeffry88

Copy link
Copy Markdown
Contributor

Summary / 概要

Custom Responses adapters default supportsStrictMode to false, but convertResponsesTools omitted the strict field in that branch. An endpoint that defaults an omitted field to strict schema compilation can reject the unchanged scheduled-tool uniqueItems constraint before a turn starts.

Extend the existing pi-ai 1.5.2 dependency patch to emit strict: false explicitly when strict support is disabled. The shared converter covers current function declarations and historical additional_tools / tool_search_output declarations. Preserve canonical schemas and local argument validation, strict-capable sampling, Codex's strict: null, and custom grammar tools. The lockfile changes only the generated pi-ai patch hash.

This differs from closed #2214: no keyword stripping or provider wrapper is introduced. Its successful strict: false/null requests are consistent with this change; the affected branch omitted strict entirely.

Reproduction and local acceptance

An installed Windows PI-Desktop 0.23.0 custom Responses route produced this real error twice after the upgrade:

HTTP 400 / invalid_json_schema
Invalid schema for 'tools[31].parameters': Unimplemented keys: ["uniqueItems"].
Compilation limits apply to all strict schemas in the request.

The installed adapter and converter still contained the omission. The equivalent one-expression local patch was verified, the application was completely restarted, and the user confirmed normal operation recovered. The new process and installed bytes were independently checked. The application log did not retain a provider request ID or full outbound request; recovery is user-confirmed, not a claim of independent raw gateway trace capture or universal OpenAI/Azure acceptance.

Verification

  • Regression baseline: 4 of 9 tests failed on the original dependency because strict: false was absent from current and replayed declarations; all 9 passed after the patch.
  • Related provider/runtime suite: 99 tests passed. Full agent-runtime suite: 2058 passed, 1 skipped across 137 files.
  • Shared and agent-runtime builds, runtime typecheck, both repository lint stages, installed Pi patch/dependency audits, agent-policy sync, and documentation checks passed. The lint stages ran through the installed pnpm 12 entry directly because the host Corepack wrapper referenced a missing legacy pnpm.cjs entry.
  • Production sidecar loopback E2E: complete a turn, switch to custom Responses, activate ScheduledTaskUpdate, execute exactly one fixture Host update, and return the final confirmation (4 HTTP requests, 1 Host tool call). No real scheduled task is executed by this test.
  • The equivalent installed-app patch passed 102 offline assertions, including canonical schema preservation and duplicate-weekday rejection. Offline mocks and loopback evidence are separate from user-confirmed recovery.

An independent read-only review found no defects in the final six-file change.

The existing scripts/pi-patch-hash.test.mjs integration fixtures hit Windows EPERM when creating directory symlinks; its two pure hash-parser cases and both audits against the actual installed dependencies pass. Full desktop/Electron/Rust builds were not run for this dependency converter fix. No paid provider call was made by the automated tests.

Requirement link / 需求关联

jeffry88 and others added 2 commits November 20, 2026 08:17
Custom Responses adapters disable strict sampling by default, but the
shared converter omitted strict instead of explicitly opting out. This
can let endpoints compile ordinary tool schemas as strict and reject
constraints such as scheduled weekday uniqueness.

Preserve schemas and existing strict-capable behavior while emitting
strict:false for disabled compatibility. Cover current and replayed
tools through provider requests and a sidecar model-switch workflow.

Refs vastsa#2213
@vastsa
vastsa merged commit cd6ca3e into vastsa:main Nov 20, 2026
6 checks passed
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.

2 participants