Skip to content

refactor(providers): share catalog facts and JSON response ownership - #173375

Merged
steipete merged 3 commits into
mainfrom
deslop/z11-ext-providers-20261015
Oct 15, 2026
Merged

steipete merged 3 commits into
mainfrom
deslop/z11-ext-providers-20261015

Conversation

@steipete

@steipete steipete commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Provider implementations repeatedly copy admitted catalogs, parse the same internal facts, and duplicate JSON-submission response ownership.

User Impact

No intended user-visible change, migration, or configuration change. Provider requests, diagnostics, public permissive parsers, credential checks, and ordinary concurrent session/shutdown behavior remain supported.

Why This Change Was Made

One existing provider HTTP seam now owns JSON submission, status handling, bounded response reading, and transport release for fourteen provider paths. Provider-specific endpoints, labels, timeout policies, polling, and downloads remain local.

Admitted catalogs and static declarations pass by reference instead of being defensively reconstructed. NVIDIA projects remote listings once before caching. Codex prepares terminal notifications once before router/projector fan-out, carries catalog DTOs through worker dispatch, parses native subagent completions and delivery receipts together, and shares the native-history predecessor check. Typed configuration/context facts remain typed through their consumers.

Net production reduction: 574 lines (1,386 added / 1,960 removed across 147 production files), excluding tests, fixtures, support modules, generated files, declarations, and documentation. This is the final 500–999-line honest-pass exception, not a partial first scan.

Best-effort tradeoffs accepted

  • Loaded plugin catalogs are no longer defensively copied/revalidated after registration. The SDK value contract prohibits mutation after handoff; an internal producer violating it may now expose its mutation rather than receiving an isolated copy.
  • Static vendor catalog rows and nested input/cost/compatibility values are borrowed where consumers do not mutate them. History/source review identified no human incident requiring per-read copies; producer ownership and consumer source traces establish the invariant. A violating consumer must be fixed at that writer.
  • Inherited native tool specifications and parsed session-metadata schemas retain their immutable producer references. Source consumers fingerprint, serialize, compare, or build new namespace wrappers; no schema writer was found. Unsupported internal mutation would affect later consumers.
  • Doctor's Ollama/xAI repairs copy only paths actually changed, not unrelated configuration. Repair owners still create replacement objects; unrelated internal mutation is not separately isolated.
  • Completed Codex turns are schema-admitted once at notification preparation, including the synthetic terminal response route. Later projections trust that prepared snapshot; fabricated invalid internal notifications are not a second supported input boundary.
  • Catalog worker dispatch consumes its typed projection instead of re-inspecting row fields. Raw RPC/native pagination admission, source identity, and nonblank cursor handling remain at their existing boundaries.
  • Context ranges and calibration facts are consumed after hook/persisted/wire admission. Invalid fabricated internal ranges and nonfinite calibration fixtures are no longer normalized again; real token counts retain safe-integer admission, sample thresholds, clamping, and fitting policy.
  • Internal model/config, stream, realtime, optional embedding, and normalized duration facts are not checked again merely because a lazy seam used unknown. Actual network/plugin settings, generic JSON variants, model output, and authored configuration still retain their boundary admission.
  • Native abort-reason classification no longer catches hypothetical throwing getters. The helper and synthetic getter test entered with native-search/audit feature f53346944db (feat: correlate native search outcomes in audit history #98704), which does not cite a human abort-getter incident requiring that swallow; an exotic getter now fails visibly. The test solely pinning that containment is retired; ordinary abort, private observer, security, and settlement tests remain.
  • Frozen private scalar receipts and freshly allocated unavailable literals are ordinary values. Two tests' assertions pinning the unavailable literal's removed freeze are retired, while all denial/context/settlement assertions remain. Shared authorization, credential, process-identity, and borrowed cached-fact freezes remain.
  • Bedrock's process-less browser fallback was unreachable: the unchanged runtime-auth owner already reads process.env before the branch. The bundled Node/Bun plugin keeps its actual region/profile/proxy/HTTP1 behavior; no browser support is removed or added.

Evidence

  • Targeted production and changed-test TypeScript graphs pass, including the final HTTP mock cutovers and fal consumer. Formatting, diff-check, line-cap growth, and assertion-safety ratchets pass. Assertion allowances shrink only.
  • Runtime import cycles: 0. Madge import cycles: 0. SDK export and surface-budget checks pass (the existing shipped-inventory age warning is unchanged).
  • Focused owner tests pass: initial catalog/onboarding/discovery selection (33), provider entry (10), SDK provider catalog (17), shared JSON HTTP ownership (30), lint suppressions (3), native projection (3), repaired discovery projection (15), and frozen plugin discovery/lifetime group (29). Partial larger local replays were stopped before editing compiled inputs, not claimed as passing product evidence. The final isolated CI-default Node replay exited zero: five catalog files / 45 tests plus a separate three-test suppression group. Targeted expanded types, lint, format, and diff checks pass.
  • Fresh isolated full-diff review completed. Its single P2 claimed the removed Bedrock branch supported a process-less browser. Rejected after direct source verification: unchanged resolveBedrockRuntimeAuth reads process.env before that branch. The complete first CI repair review and the final two-file generic-preview correction review are clean through P2. Hosted tests caught the overbroad preview omission missed by the earlier review, and that entire production hunk is dropped rather than weakening the unchanged metadata/client assertions.
  • Local proof gaps are explicit: full typed extension lint stopped before diagnostics because SDK declaration preparation exceeded its existing 300-second limit. Focused syntax lint and targeted types pass; no timeout was raised. Broad check:changed was stopped after its SQLite worker ratchet consumed 1,454 seconds; no database behavior changed. Its owned line-cap/assertion findings are repaired, while two stale max-lines allowances name files unchanged by this PR. Exact-head hosted CI remains the broad gate.
  • Full committed-ref SDK API comparison passes: No Plugin SDK API changes, exact base c35dcdd80693e99277eec0fb6752d1aa93076d83 to candidate df833852801f8d2e727efd21888115dfdf8a2858 (digest ff7b090f). Blacksmith Testbox tbx_01m50phr1w3kex9qyqyt509zmh, control-plane run 38808094929, rendered both revisions and finalized the JSON/Markdown report. Payload completed in 16m24.818s on measured 4 CPUs / approximately 16 GB RAM. The wrapper returned 1 only during post-proof settlement, after transferring the report; the lease is independently verified completed and its control-plane run is terminal/cancelled. Local per-file timings are recorded by the focused runner (the unchanged packaged-discovery integration case took 87 seconds under host load).
  • Current plugin/extension boundary checkers pass. Two inventory commands still listed in CONTRIBUTING refer to absent files; the supported check-plugin-extension-import-boundary and check-extension-plugin-sdk-boundary --all owners were used instead. The eager/PR import-closure assertions pass; the pre-push tooling selection passed 24 tests across three files.

Old-head CI attribution (run 38784047744, head 45bb51dc39f2bd90c9df1aca830c00e92c0de409):

Failed job Attribution and repair
checks-fast-baseline-ratchets PR-owned command-rpc mock preservation; actual exports now retained, four stale mock allowances canonically pruned.
checks-node-changed-extensions-bundle-1 Assertion solely pinning the intentionally removed private unavailable-value freeze; remaining finalization/security proof unchanged.
checks-node-changed-extensions-bundle-3-1 Together submission release timing expectation; now asserts exactly one release after JSON admission and after the unchanged polling deadline.
checks-node-changed-extensions-bundle-4-1 Synthetic throwing abort-name getter test pinned the removed speculative guard; retired that test only.
checks-node-changed-extensions-bundle-4-3 Raw router/lifecycle expectations; exact prepared DTO payload/scope/completion expectations now retain counts/order/barriers/warnings.
checks-node-changed-extensions-bundle-6-2 LM Studio configured endpoint fallback restored with typed nullish selection.
checks-node-changed-extensions-bundle-6-3 A throwing getter in a raw mock could not represent decoded native JSON. Keep native admission and cached-preview reuse; replace only that synthetic mechanism with an explicit hidden-text no-sanitize assertion, alongside the visible-text check. Cursor fixture expects the actual existing wire-boundary error.
checks-node-changed-extensions-bundle-9 Second private unavailable-value freeze assertion retired; full supervised model/transport/home/denial checks retained.
check-test-types Four controller fixtures now prepare notification inputs at the same owner boundary as production.

All listed failures are PR-owned, not inherited-red claims. The old-head aggregate CI gate reflects these failures. No hosted job was rerun; the first fixes were batched at 2219f8bb454573e50cbf8a65a06c8cb9aaec2e23. On that head, run 38790597977 additionally failed bundles 5-1 (client preview/worker decoding) and 6-3 (catalog metadata events): the first repair's source-visibility filter dropped legitimate generic previews when source was absent or noninteractive. The entire filter/import is dropped, retaining the unchanged client/event/preview-transition assertions. The resident cache and its measured no-reparse benefit (#150659) remain; only the impossible decoded-JSON throwing-getter fixture is replaced by direct visible/hidden no-sanitize checks.

The final two-file correction is signed and pushed at df833852801f8d2e727efd21888115dfdf8a2858; its fresh review, targeted types, lint, format, diff, two-file line-cap and three-test suppression proof pass. Earlier expanded types, runtime/Madge cycles (both zero), assertion safety and 199-file line-cap pass. The mock baseline canonically shrank from 9,553 to 9,549 exact factories. The final correction only removes an import edge, so cycle proof remains valid. Exact-head hosted CI run 38793616373 completed successfully with no failed jobs. The final catalog replay exited zero; dependency review, sensitive-product review and openclaw/ci-gate all report success. The full SDK API comparison also passes with no changes. No hosted rerun or inherited-red/admin exception was used.

Inventory and retained ownership

The lane ledger covers all 4,249 original mandatory inventory hits in 655 files, correcting eight support-only exclusions. Every candidate is implemented or has a source-backed KEEP decision; no concrete deletion remains outstanding.

Repeated hook names are not automatically repeated policy. Provider-specific Doctor migrations remain with their provider, sharing the existing generic migration owner. Thinking/fast-mode implementations already use the effort/Claude/Gemini owners where semantics match; vendor model availability, mandatory thinking, auth, and effort vocabulary remain distinct. URL/config normalizers retain distinct endpoint/default/loaded-versus-lazy contracts rather than gaining a central vendor switch or convenience wrapper.

Explicitly retained: public LM Studio configured-catalog and xAI runtime-compat parsers; external raw/native/persisted validation; live credential/tool authority; genuine bounded resources; normal desktop/client update ownership; ordinary parallel sessions/tools; accepted-write settlement and durable transcripts. The standalone Phase E session-memory backend and its factory, registry, expiry, federation, and tests are untouched. No schema, durability, retention, permission, dependency, or protocol-shape change is intended.

@clawsweeper

clawsweeper Bot commented Oct 15, 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.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Oct 15, 2026
@clawsweeper

clawsweeper Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR shares admitted provider catalogs, centralizes JSON response cleanup, and removes repeated internal parsing across provider and Codex paths.

Example: MiniMax submits a video-generation task and then polls its status.

  • Before: The submission transport remains retained until polling and downloading finish.
  • After: The shared JSON helper releases the submission transport before polling begins.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The source change is coherent and has supporting harness coverage, but the required persisted-state upgrade evidence is absent.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Repeated internal catalog copies, parsing, and response-lifetime code add runtime work and maintenance cost.
Reason: The maintainer-authored direction consolidates existing owners and explicitly accepts the reference-sharing tradeoffs required by current repository policy.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this PR open: the maintainer-directed consolidation follows the documented ownership contracts, and source review found no concrete introduced bug.

Priority: P3
Reviewed head: 45bb51dc39f2bd90c9df1aca830c00e92c0de409

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: No supplied shipped-CLI fresh-install or latest-stable upgrade run exercises the changed Doctor repairs while verifying retained settings and data; no new bug-fix regression is claimed.
Agent review details

How this fits together

Provider plugins supply catalogs and make guarded HTTP requests; the SDK and Codex bridge turn their results into model selections, session listings, and turn outcomes.

flowchart TD
  A[Provider plugins] --> B[Shared provider SDK]
  B --> C[Guarded HTTP transport]
  C --> D[Bounded JSON response]
  D --> A
  E[Codex app server] --> F[Notification and catalog admission]
  F --> G[Session and turn projections]
Loading

Technical review

Best possible solution:

Keep one guarded JSON response owner and pass admitted catalog and notification facts through their existing consumers without repeated validation.

Do we have a high-confidence way to reproduce the issue?

This PR proposes a refactor rather than reporting a failing user scenario; inspection found no concrete introduced failure, and no target execution was performed.

Is this the best way to solve the issue?

Centralizing status/read/release ownership and trusting admitted internal values fits the repository's existing contracts and avoids a competing implementation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 071c4ad0a4e1.

Provenance checked

  • Defensive catalog and provider-auth projection changes intended behavior with a stated reason (296cd8c: The earlier change isolated unreadable plugin rows so healthy siblings remained usable; the current body explains replacing that isolation with the documented admitted-plugin value contract.)
  • Codex terminal notification validation keeps the original intent (033abf7: Reject malformed native completion events across projections; the PR retains schema admission and terminal-state filtering while preparing the result once.)
  • Ollama legacy authentication repair keeps the original intent (66bfb5d: Migrate legacy local API-key markers and remove the obsolete matching auth profile; the new implementation preserves those conditions and changes copy ownership.)
  • xAI retired model repair keeps the original intent (96a1146: Migrate retired image-model configuration while retaining unrelated entries; the rewritten repair retains the provider, capability, and retired-model predicates.)
  • Guarded provider POST transport keeps the original intent (unknown: Source and available history establish shared request policy and guarded transport ownership, but git log -S and blame encountered unavailable historical blobs before establishing the exact introduction.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 033abf7 adds extensions/codex/src/app-server/protocol-validators.ts:367 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 033abf7530b5; files: extensions/codex/src/app-server/protocol-validators.ts)

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Public SDK addition 1 helper postJsonResponse extends the existing provider-http subpath and is documented with transport ownership and retained alternatives.

Labels

Label changes:

  • add P3: This is a behavior-preserving ownership refactor without an established urgent user-facing defect.
  • add merge-risk: 🚨 compatibility: The PR adds a public SDK helper and changes catalog sharing semantics; the maintainer-authored direction explicitly accepts reference sharing under the existing documented contract.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.

Label justifications:

  • P3: This is a behavior-preserving ownership refactor without an established urgent user-facing defect.
  • merge-risk: 🚨 compatibility: The PR adds a public SDK helper and changes catalog sharing semantics; the maintainer-authored direction explicitly accepts reference sharing under the existing documented contract.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 15, 2026, 2:33 PM ET / 18:33 UTC.

@steipete
steipete merged commit b4fb602 into main Oct 15, 2026
181 of 182 checks passed
@steipete
steipete deleted the deslop/z11-ext-providers-20261015 branch October 15, 2026 21:42
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
…penclaw#173375)

* refactor(providers): share admitted facts and JSON response ownership

* fix(providers): preserve cleanup boundary contracts

* fix(codex): retain previews at native admission
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant