Repository navigation
fix(providers): report request acceptance consistently - #125807
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 4:17 PM ET / 20:17 UTC. ClawSweeper reviewWhat this changesThis PR adds a provider-acceptance callback across HTTP, SDK, and WebSocket streams, forwards it through provider wrappers, and records it in model diagnostics. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessThe prior public-SDK export blocker is fixed on the current head. Keep this maintainer-owned PR open for the required direct Codex WebSocket-source check before treating its Codex-dependent behavior as fully cleared. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherModel providers open HTTP, SDK, or WebSocket streams and emit lifecycle callbacks before model output begins. Those callbacks feed plugin hooks and diagnostic records used by the agent runtime. flowchart LR
A[Model request] --> B[Provider transport]
B --> C{Acceptance evidence}
C --> D[Lifecycle callbacks]
D --> E[Model event stream]
D --> F[Diagnostics]
G[Provider wrappers] --> B
Decision needed
Why: Repository policy requires direct sibling Codex-source inspection for a verdict on Codex-backed behavior, and that checkout was unavailable in this read-only environment. Before merge
Agent review detailsSecurityNone. PR surfaceSource +263, Tests +819, Docs +3, Config +8, Other +4. Total +1097 across 44 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Restore the exact Codex source checkout, verify its WebSocket error and first-normal-event boundary against this implementation, then merge after exact-head validation is green. Do we have a high-confidence way to reproduce the issue? Yes from source and focused tests, but this read-only review did not execute the PR’s reproduction commands. Is this the best way to solve the issue? Unclear: the shared lifecycle owner and published SDK seam are coherent, but the Codex-dependent WebSocket boundary needs direct dependency-source confirmation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d1a194b52f6a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
|
@clawsweeper re-review The current head addresses the Google retry finding. Provider acceptance callback time no longer consumes the first-response deadline, callback failures remain terminal, and both cases have regressions. It also reports acceptance on the default ChatGPT/Codex WebSocket path before stream start. The final head passes 665 focused tests, |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review The current head fixes the pending-callback availability finding. HTTP and SDK acceptance callbacks now race the effective request signal, explicit retry-local signals still take priority, and caller abort cancels unread response bodies without retrying. The head also commits accepted Codex WebSocket state before it invokes the acceptance callback. It passes 684 focused tests, all requested local gates, the build, and Pi Reviewer with no findings. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review The current head now captures Mistral’s real guarded The head passes 687 focused tests, all requested local gates, the build, and Pi Reviewer with no findings. |
ec1515b to
dfc0727
Compare
|
Land-ready verification for exact head
Known proof gaps: none. |
|
Merged via squash.
|
* fix(providers): report request acceptance consistently * fix(providers): retain response hook compatibility * fix(providers): keep legacy response hook path * fix(providers): distinguish rejected response attempts * fix(providers): keep acceptance evidence truthful * fix(google): preserve provider acceptance errors * test(google): satisfy acceptance callback lint * fix(google): exclude acceptance hooks from retry deadline * fix(openai): report Codex websocket acceptance * fix(openai): commit websocket state before acceptance hook * fix(google): abort pending acceptance callbacks * fix(providers): abort pending acceptance callbacks * fix(mistral): report observed HTTP response * fix(mistral): report rejected HTTP responses * fix(providers): derive acceptance from HTTP status * fix(providers): preserve acceptance lifecycle cleanup * fix(anthropic): report observed HTTP response * fix(anthropic): report rejected HTTP responses * fix(plugin-sdk): expose provider lifecycle * fix(providers): stop after lifecycle abort * fix(mistral): cancel unread acceptance failures
…law#125807)" (openclaw#126021) This reverts commit 4bfea80.
Closes #125802
What Problem This Solves
Successful provider streams could complete without reporting that the provider accepted the request.
Model diagnostics and plugin hooks could not distinguish a request that reached the provider from one that failed before acceptance.
Some wrappers also dropped the existing HTTP response callback.
Why This Change Was Made
Provider acceptance is now one shared lifecycle fact across HTTP, SDK, and WebSocket transports.
Real HTTP paths report observed status and headers, while transports that cannot see HTTP metadata report only that the provider stream opened.
ProviderAcceptancetype andonProviderAcceptedcallback, with three lifecycle helpers on the supportedopenclaw/plugin-sdk/provider-lifecyclesubpath.onResponsedelivery, abort handling, and unread-body cleanup in provider transport helpers.onResponsewithout marking them accepted.Maintainer decision: Onur requested the complete remaining provider-acceptance work in one PR, including the additive Plugin SDK contract and diagnostic migration.
Dependency contracts were checked directly:
Responsethrough the publicHTTPClientresponse hook. Acceptance is emitted only afterchat.stream()succeeds.provider_stream_openedwithout fabricated HTTP data.openai/codex@d6ea5991e7f91eec5bad1fb4cb36f6be638878bcsendsresponse.create, rejects wrapped error events, and then forwards parsed provider events incodex-rs/codex-api/src/endpoint/responses_websocket.rs:675-795. OpenClaw reports acceptance on that first forwarded event before exposing it downstream.User Impact
Operators get truthful provider-acceptance diagnostics across the built-in transport families.
Plugin developers can observe successful non-HTTP streams without inventing an HTTP status, while existing HTTP response hooks keep their real status and headers.
No configuration, authentication, persistence, request payload, or database contract changes.
Evidence
The original deterministic reproduction showed Mistral completing with
onResponse=0, Anthropic Vertex and Bedrock Mantle dropping the callback, and OpenAI HTTP calling it once beforestart.A live native Ollama run also completed with
onResponse=0before the repair and with one acceptance plus one HTTP response callback after it.Focused exact-branch tests:
Production/tooling LOC: +430/-155 (net +275) | Tests: +828/-9 (net +819) | Docs: +3/-0.
The production growth establishes one public lifecycle contract, adapts the affected built-in transport families, and centralizes callback cancellation and response cleanup. Removing Ollama's local response-hook implementation offsets part of that growth.
Risks
The main risk is callback ordering at provider boundaries.
Tests cover success, rejection, retries, first-event ordering, callback failure, aborts, wrapper forwarding, WebSocket state, and unread-stream cleanup.
The new Plugin SDK callback is optional and additive.
The existing
onResponsecallback remains the compatibility contract for paths with real HTTP metadata.Agent transcript
Redacted agent session transcript