Repository navigation
feat(ai): opt compatible Responses endpoints into stored HTTP continuation - #128633
Patrick-Erichsen merged 25 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 15, 2026, 2:30 PM ET / 18:30 UTC (Revision 22). ClawSweeper reviewWhat this changesAdds a documented per-model setting that enables stored HTTP conversation continuation on compatible Responses endpoints, with schema, catalog, transport coverage, and a Codex test-fixture repair. Merge readiness⛔ Blocked before merge - 2 items remain This remains useful: current main still limits HTTP continuation to native endpoints. The earlier no-store defects are repaired, the recorded live proof covers the opt-in, and no actionable correctness findings remain. Priority: P2 Review scores
Verification
How this fits togetherThe Responses transport converts conversation history and model settings into provider requests. Its existing continuation owner can replace matching history with a previous response reference and new input, while preserving full-history recovery. flowchart TD
A[Conversation and model settings] --> B[Responses payload policy]
B --> C[Storage and endpoint eligibility]
C --> D[Session and credential scoped continuation]
D --> E[Full history or new input plus response reference]
E --> F[Compatible Responses endpoint]
F --> G[Assistant reply and next baseline]
F -->|Missing prior response| E
Before merge
Agent review detailsSecurityNone. PR surfaceSource +29, Tests +723, Docs +2, Generated 0. Total +754 across 19 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one continuation owner with explicit endpoint capability, preserved existing defaults, strict no-store controls, and documented operator verification. Do we have a high-confidence way to reproduce the issue? Not applicable as a feature request: current main's native-only eligibility establishes the limitation, and the recorded real-API run demonstrates the proposed capability. Is this the best way to solve the issue? Yes. The patch extends the existing policy and continuation owner, preserves shipped no-store behavior, and keeps the separately tracked tool-ID optimization outside this change. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d363685cab9f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (21 earlier review cycles; latest 8 shown)
|
d223ed0 to
58a052c
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
4901728 to
bdf5a55
Compare
|
Fixed the P2/security finding (ChatGPT/Codex scope), added the model-resolution test, and updated the PR body with an honest re-check of live proof — see the update section above. Rebased onto latest |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
bdf5a55 to
c2ce514
Compare
Conflict repair and landing verificationRepair commit: hartmark@a0edaa5 Retention decision: the requesting operator explicitly authorized landing after the review explained that the per-model opt-in sends Proof:
The local loopback test exercised actual HTTP/SSE, not the real OpenAI service. The contributor's earlier real-service proof was not rerun here; no claim of success in the reported production deployment is being made. Exact-head hosted CI remains a required gate before native guarded prepare/merge. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…sponsesContinuation surface The compat opt-in this PR adds grew the core config surface from 2420 to 2421, but the generated baseline count/hash files weren't regenerated to match -- failing config:docs:check (checks-fast-baseline-ratchets and check-docs both ran it). Ran `pnpm config:docs:gen` per the check's own instruction; the growth is exactly the one new field this PR adds (already documented/justified by the PR itself), so no other config surface moved.
The store value here is this model's own explicitStore policy (native OpenAI is continuation-eligible by default), unrelated to what this test is actually about (token clamping and disabling implicit SDK retries) -- and already has dedicated, deterministic coverage in openai-responses-payload-policy.test.ts. Confirmed via repeated full packages/ai suite runs (combined with other in-flight PRs during a meta-PR rebuild) that this assertion resolves differently depending on what other test files ran earlier in the same process -- a real test-isolation leak elsewhere, not something this specific test should be asserting on in the first place. Removing the incidental assertion is the fix; the leak's actual source was not pursued further since it's orthogonal to this test's own contract and doesn't affect production behavior.
Conflicts: config-baseline generated files (regenerated), the old monolithic docs/concepts/model-providers.md (main has since split it into per-page docs; the equivalent addition now lives in docs/concepts/model-providers/official-provider-plugins.md), and openai-responses.test.ts's token-clamping test (main's newer version also asserts on transportParams; kept that shape, dropped the stale store:false expectation since native OpenAI is now continuation- eligible by default). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vk2cBRQdErwRtPea8VuhG6
Only the two generated config-baseline files conflicted this round (regenerated). The earlier model-providers docs split and openai-responses.test.ts store-assertion resolutions carried forward cleanly. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vk2cBRQdErwRtPea8VuhG6
|
Rebased onto latest
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Resolved the merge conflicts and pushed The root cause was the raw transport's Before/after proof on the composed candidate:
Commands: node scripts/run-vitest.mjs src/agents/openai-responses-payload-policy.test.ts packages/ai/src/providers/openai-responses.test.ts packages/ai/src/transports/openai-responses-client.continuation.test.ts packages/ai/src/transports/openai-responses-client.continuation-store-policy.integration.test.ts packages/ai/src/transports/openai-responses-prompt-observer.test.ts packages/model-catalog-core/src/model-catalog-normalize.test.ts src/llm/providers/stream-wrappers/openai.test.ts src/agents/embedded-agent-runner/model.test.ts
node scripts/run-vitest.mjs src/agents/embedded-agent-runner-extraparams.test.ts packages/ai/src/providers/azure-openai-responses.test.ts packages/ai/src/providers/openai-chatgpt-responses.test.ts src/config/zod-schema.providers*.test.ts
pnpm config:docs:gen
git diff --checkContract evidence: OpenAI SDK The operator explicitly requested fixing and landing this named PR. The intended new per-model storage opt-in is retained; that direction does not cover changing unopted native defaults, which this repair restores. Docs now state that opted-in models may retain requests even when a turn cannot continue, and that Known proof limits: the contributor's unforced real-OpenAI test was inspected and still asserts exactly two upstream requests, stored turns, the one-message delta, omission of earlier history, and successful recall. I have not rerun it successfully yet: local 1Password authorization timed out and Blacksmith authentication is unavailable. No new real-service or reported production-deployment success is claimed. Custom tool-call IDs that require rewriting can still cause safe full-history fallback; the separate optimization is tracked in #134425. Current scope versus the pinned main baseline: production +38 lines, tests/test support +696, docs +2, generated +0. Growth implements the explicit capability across the existing policy/schema/catalog contract; no new transport or fallback path was added. Local changed checks and exact-head hosted CI remain in progress; landing will use the guarded native workflow after its gates pass. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Local validation is complete on The earlier re-review command finished as superseded without updating the durable September 10 review. Requesting one fresh review of the finalized implementation and evidence. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Final candidate: 7eeb60a. The wider review exposed a second retention regression: the shipped public The prior head's six CI failures were existing fixture defects. This candidate includes the existing maintainer fixes from #149301 and #149288, preserving their attribution. The original 12-file Codex shard passed in its original order (87 tests). The six native PR-tooling suites and full changed-file gates are still completing; exact-head CI has restarted. Fresh P0–P2 autoreview reported only a proposed Azure-host restriction. I rejected that runtime change after checking the actual owner contracts: the dedicated Azure executor does not enable HTTP continuation and its builder sets ClawSweeper revision 20's endpoint-compatibility and retention notes are addressed: operator-verified opt-in, explicit retention disclosure, Production +46/-8 (net +38); tests/support +751/-9 (net +742); docs +3/-1; generated +3/-3, against pinned main ad69391. Growth carries the explicit capability through the existing policy/schema/catalog contracts; the strict public API repair adds no net production lines. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Final head: 07e6ad4. All local validation is complete:
Main landed the repository-identity repair through #149294 during validation. The refresh retains main's exact fixtures, removing those four files from this PR's diff. The executable continuation code and its tests are unchanged from the head reviewed by ClawSweeper revision 21. The only additional feature-file change shortens a stale comment to distinguish continuation from instructions support. Revision 21's two before-merge notes are explicitly accepted and addressed: retain the documented endpoint opt-in, require operator verification of backend storage/continuation semantics, disclose retention, preserve existing defaults and strict public disable, and make no existing-config migration necessary. The reviewer found no correctness/security findings and accepted the unchanged recorded real-service proof. No new live-service success is claimed. Final delta against refreshed main: production +49/-20 (net +29), tests/support +725/-2 (net +723), docs +3/-1, generated +3/-3. The source growth carries one capability through existing owners; obsolete comment text was removed. Exact-head hosted CI run 35006333394 passed, including required |
|
Merged via squash.
|
What Problem This Solves
Custom OpenAI Responses endpoints cannot use HTTP continuation even when their backend supports stored responses and
previous_response_id. Operators must resend the complete conversation on every turn.Fixes #123215.
Why This Change Was Made
Adds the explicit per-model
compat.supportsResponsesContinuationcapability to the existing Responses payload policy, transport eligibility check, configuration schema, and model-catalog normalization. It enablesstore: trueand continuation on verified compatible endpoints without adding another transport path.The native no-store regression reported during review is repaired: raw native transport requests retain
store: falseunless explicitly opted in or changed by their caller. The shipped public payload-policy API also preserves strictstoreMode: "disable"semantics, including for opted-in models. The raw builder selects a separatetransport-defaultpolicy; native provider wrappers retain their existingprovider-policybehavior. The dedicated Azure and ChatGPT/Codex transports remain excluded from the new opt-in, andcompat.supportsStore: falsedisables it.The conflict repair preserves current schema-derived model types and regenerates the configuration baselines. The loopback proof no longer forces storage through a test callback.
User Impact
An operator can set
models.providers.<provider>.models[].compat.supportsResponsesContinuation: trueafter verifying that the endpoint supports stored responses andprevious_response_id. This deliberately allows that backend to retain the model's requests, including turns that cannot continue. Other custom models stay stateless by default. No existing configuration or native storage default changes.Custom tool-call IDs that require rewriting can still trigger safe full-history fallback. Recovering continuation savings for those cases is tracked separately in #134425; this PR does not claim to fix that optimization.
Evidence
Final repair head:
07e6ad4d4d234f39cd81ee7bee4123a377eb38e6.disableenabled storage for opted-in models. The final policy passes all six assertions while preserving opt-in continuation.openclaw/ci-gate.previous_response_idand one-message deltas across two/three turns, and verify unopted models sendstore: falsewith complete history.disabledefect, which was reproduced and repaired. A fresh complete-candidate pass reported only an Azure-host exclusion finding; direct transport/source and Microsoft contract checks showed that exclusion belongs to the dedicated transport, not every compatible Azure endpoint. The docs/comment now name the excluded API/provider identities. No blocking findings remain.@openclaw/ai/transportsexport, installed OpenAI SDK request types, and sibling Codex source. Codex's explicit no-store contract remains unchanged.The contributor recorded an unforced real
api.openai.comrun on August 31: one live test passed in 10.22 seconds. The inspected live test requires exactly two upstream requests,store: trueon both, a one-message continuation delta, omission of the earlier secret, and successful recall. Its file remains unchanged. A fresh maintainer rerun could not authenticate: 1Password authorization timed out and Blacksmith is unauthenticated. Loopback results are not represented as real-service proof, and no success in the contributor's deployment is claimed.CI prerequisites
The first refreshed head hit six existing main-branch fixture failures. This candidate includes the existing maintainer repairs, with source attribution, instead of weakening production checks:
Review disposition
ClawSweeper revision 22 reviewed the final head, found no correctness/security findings, judged this the best fix, and accepted the recorded live proof. Its two compatibility/retention notes are addressed through the documented opt-in contract, unchanged existing defaults, and strict public disable semantics.
The latest ClawSweeper review's endpoint-compatibility and retention notes are accepted in the documented per-model opt-in: the operator verifies the backend before enabling it,
supportsStore: falsestill prevents storage, excluded routes stay excluded, and existing defaults/configurations require no migration. The public API's explicit no-store option also remains strict. The real-API proof establishes the API interaction; it does not certify every third-party endpoint.Earlier repair commands and before/after evidence.
Production delta versus the refreshed main
40e6f12380e306c92c47e96f3d0caa8fe94fb825: +49/-20 (net +29); tests/test support +725/-2 (net +723); docs +3/-1 (net +2); generated +3/-3 (net 0). The production growth carries one explicit capability through the existing policy/schema/catalog contracts.