Skip to content

improve(decisions): reuse connections for repeated evaluations - #174002

Merged
vincentkoc merged 3 commits into
mainfrom
perf/decision-provider-transport-reuse-20261016
Oct 17, 2026
Merged

vincentkoc merged 3 commits into
mainfrom
perf/decision-provider-transport-reuse-20261016

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Repeated OpenAI and TypeSafe Decision evaluations create fresh direct HTTP transports instead of reusing the bounded connection pool already used for model requests.

User Impact

Eligible direct Decision requests can reuse connections without changing payloads, credentials, deadlines, retries, or proxy/TLS behavior. No configuration or migration is required.

Why This Change Was Made

Expose fetchWithProviderHttpGuard through the existing provider-http SDK entry and route model fetches plus both Decision adapters through that helper. The existing provider lifecycle remains the sole pool owner; plugins receive no raw pool or shutdown capability.

The guard performs fresh DNS/SSRF validation before acquisition and pools only eligible direct requests. Each caller retains response parsing and finally release. Shutdown keeps the closing generation until it settles; requests during closure use caller-owned dispatchers rather than publishing a competing pool. The correction makes the unused internal getter private and exercises that lifecycle through a real public-SDK HTTP socket test.

Current diff: production +25/-13 (net +12), tests +100/-68 (net +32), documentation +8. The production delta establishes the shared SDK capability while removing duplicate pool selection. No production latency, cost-saving, authenticated inference, or external-service benchmark claim is made.

Evidence

  • Exact head: bc5cdd489f3018e3e519b25c102ac86421f8b7de. Signed commits, targeted formatting, direct source review and independent review are clean. Current main's adjacent credential-authority checks and response cleanup remain separate and must be preserved by the merge.
  • PR CI38918130674 completed successfully. Job117031467397 passed OpenAI Decision provider 27, TypeSafe local transport 21, and TypeSafe transport 17. These 65 cases ran on tested merge 34a1ccda3d806f6585d5fceededf0d3a4efbce70, composing bc5 with main 33f497e178d7acf5a48c940f00b18096de279672, not the literal branch tree.
  • Main-shaped qualification38920102707 ran literal bc5. Six required suites passed, 109 cases: provider transport fetch 43, real HTTP reuse 1, public SDK pool socket 1 (job117038036736); fetch-guard release 11 (job117038036932); SSRF 48 and pinned pool 5 (job117038036934). Combined named coverage is 174 cases across nine suites, without double-counting earlier runs. Real HTTP tests cover terminal-before-EOF reuse, per-request credentials, closing-generation fallback, shutdown, restart, and IPv4/localhost/IPv6 calls.
  • Packaged build, SDK declarations and export validation passed at literal bc5. Startup metadata was reused, not freshly generated. Standalone SDK surface passed at bc5.
  • The interrupted npm-lock check was recovered with one completed exact-source validation of all 105 package locks: node scripts/generate-npm-package-lock.mjs --all --jobs 1, exit 0, literal bc5 inputs unchanged before/after. The qualified local fallback used macOS arm64, official checksum-verified Node 24.21.0 and bundled npm 11.19.0, isolated HOME/config/cache/temp, the unchanged generator dependency closure, and the normal child timeout. This is local recovery proof, not a green rerun or Linux execution claim. A prior attempt failed before validation because two isolated npm config selectors pointed to the same file; distinct absent config files repaired that envelope only.
  • Earlier head 3ce2e8ff2248f7b9802369da677cb7ec7d9d5f81 proof remains historical. Queued remote allocations that never ran are not test evidence.

Broader Failed Run

The main-shaped run remains failed. Its eight nonaggregate failures and downstream aggregate are retained; they are not relabeled as green PR CI. Independent review accepted the following existing-source attributions and targeted recovery:

Original job Failure and attribution
117038035062 Cold catalog transport import assertion. Existing owner repair 586e70d4 in #174015 addresses the baseline import boundary.
117038036105 The 105-lock gate stopped on npm-registry ECONNRESET, before any completed mismatch assertion. The exact-source 105-lock local pass above closes this incomplete proof.
117038036137 Lit ratchet compared old unchanged files against a newer main baseline; the seven reported files are unchanged by F2.
117038036286 Existing dependency/export diagnostics, five production and two Slack helper exports, addressed by 7a43e126 in #173991 and c316ecaa in #173919. The F2 pool getter is private in bc5 and is not among these remaining diagnostics.
117038036568 Directive-prefix delivery omitted the final expected summary line at embedded-agent-subscribe.directive-delivery.test.ts:294. It independently reproduced in non-F2 run38936572406/job117094242847, and again at the later U3 head; relevant owner/dependency inputs are unchanged by F2. This is not a matched-runtime untouched-main replay.
117038036668 Native reasoning timed out at 120025 ms: 4096 acknowledgment-gated deltas each incur the baseline's 32 ms batching timer, a programmed serial budget of about 131.072 seconds. Canonical acaaa6088a1c90500c08425fdfc88714070b9bbb removes that batching owner. Historical run38881445511/job116909405647 has the exact repaired owner blob and records 4096 events in 213.361 ms, test 236 ms. Node 24.21 versus failing 24.19 means this is not fresh matched-runtime proof.
117038036876 Heartbeat isolated-runtime fixture expected ran, received failed. Independent scheduled-main run38962862509/job117182388806, head 6c07f3ddc035e3d6ee1bdf266f3f368b8a705bd3, fails the same assertion with the explicit reason that the heartbeat session was deleted while work was starting. The fixture's epoch clock creates a row removed by wall-clock retention. Canonical 18c09e5c0f381d4e8cac3cbae8c5e7c2a2dbfd83 uses Date.now and preserves the assertions. The original F2 log did not expose that full reason; no fresh F2 heartbeat execution is claimed.
117038038018 Codex delivery-cache fixture expects retired top-level instructions. Direct inspection of pinned Codex 0.162.0 shows base instructions prepended to request input in client.rs:900-1018, with developer role in context/base_instructions.rs:26-44. Canonical e2872f9330af34aeb243b0366248d4f00d1fd14c corrects the assertion while retaining exact serialized instruction equality. This is contract attribution, not fresh F2 execution.

Aggregate117048807484 failed downstream. The successful PR run and failed manual broader run remain distinct. Native completed-evidence qualification and ordinary live head, authority, review, security, and required-check guards decide admission; no invented tested-merge identity or blanket admin waiver is used.

@vincentkoc vincentkoc self-assigned this Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vincentkoc
vincentkoc marked this pull request as ready for review October 16, 2026 08:11
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling extensions: openai plugin: typesafe size: S labels Oct 16, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 3ce2e8ff2248f7b9802369da677cb7ec7d9d5f81, but the PR head is now bc5cdd489f3018e3e519b25c102ac86421f8b7de. Its old verdict and PR readiness labels are no longer current.

Next step
Run or wait for a fresh ClawSweeper review on the current PR head.

Review history (1 earlier review cycle)
  • reviewed 2026-10-16T08:43:03.952Z sha 3ce2e8f :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 16, 2026
@vincentkoc
vincentkoc merged commit a2cf0a7 into main Oct 17, 2026
277 of 286 checks passed
@vincentkoc
vincentkoc deleted the perf/decision-provider-transport-reuse-20261016 branch October 17, 2026 02:45
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…law#174002)

* perf(decisions): reuse guarded provider connections

* test(decisions): intercept the pooled TypeSafe transport

* fix(agents): keep provider dispatcher pool private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: openai P2 Normal backlog priority with limited blast radius. plugin: typesafe size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant