Repository navigation
refactor(decisions): share one Decision HTTP executor across providers - #197615
Conversation
Move every HTTP Decision provider onto executeDecisionHttp in openclaw/plugin-sdk/decisions-http-runtime. The executor owns the deadline, one admission check when each request starts, guarded fetch with the trusted env-proxy mode, no redirects, status classification, the bounded JSON read, credential-reflection rejection, release, and cancellation pass-through. Providers keep their endpoint, auth header, request encoding, response decoding, and real status quirks (OpenRouter 529). Delete the per-provider transport copies, their post-DNS and after-read admission rechecks, and their transport tests; test the shared behavior once next to the helper. Co-authored-by: obviyus <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review blockedAutomated review did not run, so no review verdict was produced. Reason: The input-safety check rejected material in this revision. No detected value, path, or scanner output is reproduced here. Automatic review is on hold, including after source changes. Request a fresh re-review after resolving the failure; maintainers can also release the hold through an intentional scanner-policy update. Next step: If this is a genuine credential, remove and rotate it. If it is an intentional test fixture, a maintainer must review and qualify it. |
The shared executor checks admission once when each request starts, so the Levanto, SubQ and TypeSafe DNS-barrier tests and the Baseten mid-flight credential replacement case test removed behavior. Baseten's integration test keeps proving the shared executor through the real pooled guard. Also qualify the TypeSafe mock isolations, prune the mock-export baseline and drop credential-shaped URL fixtures. Co-authored-by: obviyus <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR moves HTTP Decision providers onto one shared executor while retaining provider-specific routes and codecs. Example: Gemini returns HTTP 422 for an unsupported Decision request.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it consolidates duplicated transport ownership, and both previously reported defects are fixed. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Decision host supplies prepared credentials, request policy, deadlines, and admission; provider adapters supply protocol details, and the shared executor returns decoded results or classified failures. flowchart LR
A[Decision tool] --> B[Prepared Decision host]
B --> C[Provider adapter]
C --> D[Shared HTTP executor]
D --> E[Guarded provider request]
E --> F[Provider API]
F --> D
D --> G[Provider decoder]
Technical reviewBest possible solution: Keep HTTP policy in the existing SDK executor and native protocol behavior in provider adapters. Do we have a high-confidence way to reproduce the issue? This is a consolidation rather than a reported bug reproduction; source inspection confirms the prior fixes, and no target code was executed. Is this the best way to solve the issue? Reusing the existing executor provides one transport owner without adding a competing manager, configuration option, or persistence layer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against dcac94644b3c. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -1580, Tests -2962, Docs 0, Other -3. Total -4545 across 55 files. Added test files: 2. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)Reviewed November 12, 2026, 3:45 AM ET / 08:45 UTC (Revision 3). |
The credential matcher also reads prepared request headers, so a TypeSafe image opt-in configured under request.headers was collected as a secret and valid responses containing `true` were rejected. Match against a header copy without the per-request names. Co-authored-by: obviyus <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
With debug capture, the guarded response body is teed, and cancelling one branch waits for the capture branch. Wrap the response with responseWithRelease and a memoized release, as the SubQ and TypeSafe copies did, so a failed request settles promptly. Move that regression to the executor. Co-authored-by: obviyus <[email protected]>
|
@clawsweeper re-review |
Complete the consumer cleanup from #197615: keep active module-local declarations private and remove two abandoned test helpers. The canonical export guards reproduce seven failures on the main parent and pass after the cleanup; 62 consumer tests and changed checks pass. Production line count is unchanged.
Preserve caller context until worker settlement, immediate Talk retirement, and existing auth/write authority across asynchronous preparation. Repair affected real-worker fixtures and retain FIFO assertions at the actual queue entry. Validated with focused consumer replays, complete affected type/lint checks, and Codex review. The changed-check command retains the independently reproduced main deadcode regression introduced by 81ec452 (#197615); no ignore or baseline exception was added.
…197718) * test(agents): align OpenAI Decision authority fixtures Match the transport contract from #197615: explicitly opt out of private-origin trust for the denied route, and allow the already-admitted retired request to finish while retaining host rejection, usage suppression, and request settlement checks. Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> * fix(test): align Decision fixtures with admitted request contracts Worked on by: - @obviyus - @steipete Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 1350869c-60a2-8c3a-bcb8-4f9d4a5a830a --------- Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]>
* test: repair hourly CI fixture boundaries * test: align Decision fixtures with request-start admission Retain explicit private-network denial and host suppression of retired results after an admitted transport completes. Attribute the stale expectations to #197615; all eight provider integration cases pass.
openclaw#197615) * refactor(decisions): share one Decision HTTP executor across providers Move every HTTP Decision provider onto executeDecisionHttp in openclaw/plugin-sdk/decisions-http-runtime. The executor owns the deadline, one admission check when each request starts, guarded fetch with the trusted env-proxy mode, no redirects, status classification, the bounded JSON read, credential-reflection rejection, release, and cancellation pass-through. Providers keep their endpoint, auth header, request encoding, response decoding, and real status quirks (OpenRouter 529). Delete the per-provider transport copies, their post-DNS and after-read admission rechecks, and their transport tests; test the shared behavior once next to the helper. Co-authored-by: obviyus <[email protected]> * test(decisions): drop per-provider post-DNS admission tests The shared executor checks admission once when each request starts, so the Levanto, SubQ and TypeSafe DNS-barrier tests and the Baseten mid-flight credential replacement case test removed behavior. Baseten's integration test keeps proving the shared executor through the real pooled guard. Also qualify the TypeSafe mock isolations, prune the mock-export baseline and drop credential-shaped URL fixtures. Co-authored-by: obviyus <[email protected]> * fix(decisions): keep per-request headers out of credential matching The credential matcher also reads prepared request headers, so a TypeSafe image opt-in configured under request.headers was collected as a secret and valid responses containing `true` were rejected. Match against a header copy without the per-request names. Co-authored-by: obviyus <[email protected]> * fix(decisions): release on body cancel in the shared executor With debug capture, the guarded response body is teed, and cancelling one branch waits for the capture branch. Wrap the response with responseWithRelease and a memoized release, as the SubQ and TypeSafe copies did, so a failed request settles promptly. Move that regression to the executor. Co-authored-by: obviyus <[email protected]> --------- Co-authored-by: obviyus <[email protected]>
Complete the consumer cleanup from openclaw#197615: keep active module-local declarations private and remove two abandoned test helpers. The canonical export guards reproduce seven failures on the main parent and pass after the cleanup; 62 consumer tests and changed checks pass. Production line count is unchanged.
…penclaw#197718) * test(agents): align OpenAI Decision authority fixtures Match the transport contract from openclaw#197615: explicitly opt out of private-origin trust for the denied route, and allow the already-admitted retired request to finish while retaining host rejection, usage suppression, and request settlement checks. Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> * fix(test): align Decision fixtures with admitted request contracts Worked on by: - @obviyus - @steipete Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 1350869c-60a2-8c3a-bcb8-4f9d4a5a830a --------- Co-authored-by: obviyus <[email protected]> Co-authored-by: steipete <[email protected]>
* test: repair hourly CI fixture boundaries * test: align Decision fixtures with request-start admission Retain explicit private-network denial and host suppression of retired results after an admitted transport completes. Attribute the stale expectations to openclaw#197615; all eight provider integration cases pass.
Problem
Each HTTP Decision provider kept its own copy of the same transport: deadline and timeout signal, admission checks, guarded fetch, env-proxy mode, redirect policy, status-to-reason mapping, bounded JSON read, reflected-credential check, release and error mapping. The copies had drifted. Some rechecked admission after DNS and again after the response read, some mapped 422 differently, some skipped the reflected-credential check, and one raced a local image probe against the abort signal.
openclaw/plugin-sdk/decisions-http-runtimealready existed, but only OpenAI, Celeris, Nace, Perplexity and Fastino used it.Solution
One owner:
executeDecisionHttp/evaluateDecisionHttpinopenclaw/plugin-sdk/decisions-http-runtime. It owns:isAdmissible()check when each request starts. A provider with a queue wait or a retry calls the executor again, and that call checks again.maxRedirects: 0resolveProviderTransportSsrFPolicywith origin trust), which is the same policy the chat transport usesauthentication, 429 →rate-limitedwithretry-after-ms/Retry-After, 400/413/422 →unsupported-input, otherwisetransportresponseWithRelease), so a debug-capture tee cannot hold a failed request open.invalid-response.Providers keep only their route. That is the base URL and endpoint path, the body (omit it for GET), and a decoder. Optional fields cover real differences:
authHeaders: Geminix-goog-api-key, Parallelx-api-key, and the keyless markers for Rerank and TypeSafestatusReason: OpenRouter's 529maxResponseBytes: Gemini, the ClawRouter catalog, and TypeSaferequestHeaders: the per-body TypeSafe image opt-in header. These values are kept out of credential matching, including when they are also configured underrequest.headers.The post-DNS and after-read rechecks are deleted. The host already checks admission after
evaluatereturns (evaluatePreparedDecisionProvider), and the docs say to check once when the request starts.executeOpenAIDecisionis deleted. ClawRouter now usesevaluateOpenAICompatibleDecision. Neither SDK subpath has shipped in a stable release (both are absent from v2026.11.3).Providers
decision-execution.tsdeleted)decision-execution.tsdeleted)decision-execution.tsdeleted)textsretry; each request checks admission when it startsexecuteDecisionHttperrors.tsdeleted)test/admission integration testsreplaced; the barrier helper is removedTotal: +1,008 / −5,579 (net −4,571). Production code is about −1,587 lines and tests about −2,984. No test-lines allocation is needed (
check:test-lines-ratchetpasses).Impact and accepted edge cases
allowPrivateNetwork: true. Liquid, OpenRouter, Parallel and Rerank already trusted the configured origin.HTTP(S)_PROXY/NO_PROXYrules. They no longer pinlocalhostDNS. TypeSafe also no longer re-reads its config owner after the cold import. Revocation applies to the next request.test/decision-{levanto,subq,typesafe}-admissiontests and Baseten'sreplacedcase asserted the old post-DNS recheck.textsretry. A ClawRouter catalog 400 maps tounsupported-input. Gemini 422 maps tounsupported-input.unknownpayloads and check the shape themselves.Evidence
oxfmtandoxlinton the changed files: cleansrc/plugin-sdk/decisions-http-runtime.test.tsandsrc/plugin-sdk/decisions.test.ts(26 tests)src/decisions/rerank.integration.test.ts(real loopback server, keyless/keyed/TEI retry, revocation between request and retry),src/decisions/clawrouter.integration.test.tsandtest/decision-index-providers.integration.test.ts: all passpnpm tsgo:extensions,pnpm tsgo:extensions:testandpnpm tsgo:core:test(through pueue): passtest/decision-baseten-admission.integration.test.ts: a real prepared runtime and the real pooled guard through the shared executor (allowed, auth reflection, header reflection, abort with release); passessrc/decisions/registered.live.test.tswith a realGEMINI_API_KEY. The Google route passes end to end: text, PNG, JPEG and WebP throughdecision_evaluate, with typed answers andoutputTokens: 0.