Skip to content

refactor: consolidate provider streams and plugin feature internals - #167227

Merged
steipete merged 5 commits into
mainfrom
deslop/d28-providers-features-20261007
Oct 8, 2026
Merged

steipete merged 5 commits into
mainfrom
deslop/d28-providers-features-20261007

Conversation

@steipete

@steipete steipete commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Provider streams, Policy checks, and Workboard actions repeat lifecycle and validation logic that must stay consistent across variants.

User Impact

No user-visible change. Provider requests, model IDs, authentication precedence, configuration, diagnostic text, and persisted Workboard records remain unchanged.

Why This Change Was Made

Provider adapters share stream construction and content-event handling while keeping transport-specific acceptance, errors, and recovery explicit. Google stream construction sits above its shared request/lifecycle contracts. OpenAI image generation shares auth setup, and route policy removes plumbing for endpoints already rejected by its classifier.

Policy reuses ordered shape validation, finding construction, and check/fix metadata. Workboard shares mutation lifetime, run settlement, notification construction, and bounded string-list validation. Existing owners still control authority checks, write settlement, and cleanup.

Net production LOC: −1,208 across 65 source files (AI −293, OpenAI −123, Workboard −130, Policy −662). Tests, fixtures, test support, generated files, and declarations are excluded. Permanent tests are unchanged; the assertion baseline only shrinks for removed casts.

Evidence

Exact-head hosted CI 37776924956 passed at 4bcab20b29faa67cd886d7409c954a2543c3d1ce, including extension typed lint. The complete check-run census contained no failing or canceled checks, and the CI/security gate passed. ClawSweeper completed its review of that head with no findings.

  • Rebased AI package: 142 files / 2,627 tests passed, including main's new WebSocket-expiry and SSE-limit cases. Runtime and static import cycles: 0.
  • Full Policy directory: 17 files / 448 tests passed.
  • Workboard backend: 27 files / 389 tests passed; full browser directory: 25 files / 246 tests passed after the final local-binding fixes. The tool entry-point suite also passed after the rebase.
  • Full OpenAI directory on Linux: 91 files / 1,262 tests passed; one existing Bun-dependent case skipped because Bun is absent. Final image/auth/plugin/setup follow-up: 72 tests passed. Lint-suppression tests: 3 passed before each push.
  • Core and extension production/test type checks, core lint, and all three export scans passed before the rebase. Extension production/test types passed again on the rebased head. All 49 changed extension files were checked with typed lint; its three Workboard binding-shadow findings were repaired, with focused no-shadow, scoped types, full browser tests, and independent review passing afterward.
  • AI package build passed. Plugin SDK API comparison of a889961d886f → ed25f4f84778 found no API changes; the final Workboard local-binding rename does not change that surface.
  • Exact baseline comparisons: 150,768 OpenAI route cases; 40,008 effort sequences; Policy state, repair, check metadata and attestation cases; 12,360 Workboard list/format/lifecycle cases.

A local changed-gate failure was inherited from main: both production and full-tree Knip report SessionPendingInputState re-exported from src/config/sessions/session-accessor.sqlite-pending-inputs.ts. A fresh, clean main checkout at 8bacf4fe0cb70318567bb7d8bb3a44325af71205, with a frozen install, reproduced both findings. The file's Git blob is identical in main and this candidate (256c9c8c76ee84a26599a352650bb8e548504dc4); this PR does not touch that owner.

Local OpenAI runs initially had seven timing failures involving socket pacing, oversized-error aborts, and speech deadlines. Focused and clean-main investigation retained those failures rather than changing assertions or budgets. Every initially failing case passed in the complete Linux run; this is environment-specific passing evidence, not a claim that the local failures were fixed. Local SDK declaration preparation exceeded its unchanged five-minute deadline; Linux preparation completed successfully.

Independent reviews completed. Three findings were rejected with parent-source and entry-point proof: official HTTP endpoints are rejected before route normalization; the sole Anthropic cache marker remains on the tool-result fallback; and the parent already permits browser-session subscription auth with a broker while retaining separate Platform-only provider readiness. All 32 browser-readiness predicate combinations match, and the unchanged broker-session test passes. Reviews of the Google module boundary and the final lint repairs found no actionable P2-or-higher findings.

@clawsweeper

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

@steipete
steipete marked this pull request as ready for review October 8, 2026 12:26
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Oct 8, 2026
@clawsweeper

clawsweeper Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 8, 2026, 8:33 AM ET / 12:33 UTC.

ClawSweeper review

What this changes

This PR consolidates provider streaming, OpenAI auth setup, Policy diagnostics, and Workboard lifecycle helpers while preserving existing behavior.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful consolidation with no concrete finding; confidence rests on source review and substantial supplemental validation rather than demonstrated end-to-end behavior.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: The maintainer-authored exemption applies, supported by verified repository admin permission and prior area history. Supplied validation covers changed stream, Policy, and Workboard code through tests and baseline comparisons, without establishing a live end-to-end run; stored record contracts remain unchanged, so no migration is required.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes
Reason: The consolidation reduces repeated lifecycle and validation logic in actively maintained owners. Prior merged work by the same area contributor supports the direction, with existing contracts retained.

Merge readiness

✅ Ready for maintainer review

Keep open: this is useful, maintainer-authored consolidation, and no concrete introduced defect was found. Current main still contains the duplication this PR removes.

Priority: P3
Reviewed head: 4bcab20b29faa67cd886d7409c954a2543c3d1ce

Before merge

None.

Findings

None.

Provenance

  • packages/ai/src/providers/google.ts and google-vertex.ts: original intent not found (unknown: Recent file history was available, but git log -S and -G introduction searches failed on an unavailable historical blob in the partial clone.)
  • packages/ai/src/providers/anthropic-usage.ts, mistral.ts, schema helpers, and Anthropic transports: original intent not found (unknown: Recent merged provider cleanup preserves identity ambiguity checks, request bytes, and explicit stream ownership; the exact original introduction of all consolidated mechanics could not be established from available history.)

Tests

  • Missing end-to-end proof: No supplied shipped-entry-point trace establishes provider streaming, Policy CLI output, or Workboard execution after the refactor; reported suites and equivalence comparisons remain supplemental.
Agent review details

How this fits together

Provider adapters turn model requests into streamed replies. Policy evaluates operator requirements, while Workboard manages task cards and their execution records.

flowchart TD
  A[User and operator inputs] --> B[Provider stream adapters]
  A --> C[Policy checks and repairs]
  A --> D[Workboard actions and storage]
  B --> E[Streamed model replies]
  C --> F[Diagnostics and repair recommendations]
  D --> G[Updated task cards and notifications]
Loading

Technical review

Best possible solution:

Keep shared mechanics with their existing owners while preserving provider-specific transport decisions, Policy repair classifications, and Workboard settlement contracts.

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

Not applicable: this PR proposes behavior-preserving consolidation rather than a reported user-facing defect.

Is this the best way to solve the issue?

Yes: the reviewed changes reuse existing owners and remove duplicate mechanics without introducing a competing public API or configuration path.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • packages/ai/src/providers/openai-chatgpt-responses.ts and Responses transports keeps the original intent (refactor: internalize OpenClaw agent runtime #85341: Internalize the agent runtime under OpenClaw ownership and consolidate provider/runtime mechanics while retaining real public boundaries.)
  • extensions/openai route, auth descriptor, image, and realtime internals keeps the original intent (fix(openai): align auth availability with effective routes #104685: Keep effective backend, authentication requirements, and runtime execution aligned while separating API-key and subscription routes.)
  • extensions/policy/src/doctor check, rule, and repair metadata keeps the original intent (refactor(plugins): deslop feature plugins fourth pass #161187: Use one ordered health-check catalog while preserving Policy decisions, fail-closed defaults, and public surfaces.)
  • extensions/policy state evidence, shape validation, and finding projection keeps the original intent (refactor(policy): split policy state evidence #108210: Split evidence collection by domain, preserve runtime/type contracts, and keep shared dependencies acyclic without changing policy behavior.)
  • extensions/policy/src/policy-conformance.ts keeps the original intent (Policy: add policy file comparison command #86768: Compare operator policy syntax against an organization baseline using the same strictness metadata as scoped overlays.)
  • extensions/workboard browser mutations, normalization, formatting, and store settlement keeps the original intent (refactor(workboard): deslop workboard #165350: Remove duplicate persistence and browser adapters while preserving authority checks, ordering, tolerant normalization, and storage contracts.)

Testing

Proof path: unit tests only. Added test files: 0.

Security

None.

Evidence

What I checked:

  • Introduced diff and merge identity: Read the merge-base-to-head introduced diff. The raw test-merge commit records the pinned main parent followed by the exact reviewed head; its resulting changes match the introduced areas. (fb5614730048)
  • Current main still has separate stream construction: Current main retains Google-specific stream construction that the candidate consolidates with Vertex, preserving the existing lifecycle owner and provider-specific client construction. (packages/ai/src/providers/google.ts:21, b3196dfda335)
  • Policy repair classification preserved: The consolidated catalog retains automatic repair assignments, the denied-channel special case, and the two review-required preview checks; existing metadata tests explicitly cover these classifications. (extensions/policy/src/doctor/checks.ts:34, 4bcab20b29fa)
  • Workboard stored-state compatibility: The shared settlement helper preserves execution transitions, claim removal, attempt closure, failure counters, and bounded notifications. No storage schema, migration, or serialized field contract is introduced. (extensions/workboard/src/store-enrichment.ts:45, 4bcab20b29fa)
  • Official HTTP route rejection remains: The unchanged endpoint classifier rejects plaintext official endpoints before normalization, supporting removal of the redundant source-protocol plumbing without weakening credential routing. (extensions/openai/base-url.ts:48, 4bcab20b29fa)
  • Maintainer status verified: GitHub's collaborator-permission endpoint reports admin permission for steipete, resolving the supplied association discrepancy and supporting maintainer-authored treatment.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Dallin Romney: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

PR surface

Source -1208, Other 0. Total -1208 across 66 files.

View PR surface stats
Area Files Added Removed Net
Source 65 2208 3416 -1208
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 4 4 0
Total 66 2212 3420 -1208

Stored data model

Persistent data-model change detected: migration/backfill/repair: extensions/policy/src/doctor/agent-workspace-findings.ts, migration/backfill/repair: extensions/policy/src/doctor/automatic-repairs.ts, migration/backfill/repair: extensions/policy/src/doctor/checks.ts, migration/backfill/repair: extensions/policy/src/doctor/data-auth-findings.ts, migration/backfill/repair: extensions/policy/src/doctor/data-auth-shapes.ts, migration/backfill/repair: extensions/policy/src/doctor/fix-metadata.ts, and 20 more. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Labels

Label changes:

  • add P3: This is internal maintenance with no intended user-visible change or established urgent runtime defect.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is internal maintenance with no intended user-visible change or established urgent runtime defect.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

@steipete
steipete merged commit 89c01cd into main Oct 8, 2026
213 of 217 checks passed
@steipete
steipete deleted the deslop/d28-providers-features-20261007 branch October 8, 2026 12:39
steipete added a commit that referenced this pull request Oct 8, 2026
Regenerate the manifest after #167227 changed Workboard browser code.
Refresh controlUi.entry and controlUi.styles to the current immutable bundle
hash so the build-artifacts generated-assets check matches source again.

Only generated metadata changes; plugin behavior and assertions are intact.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 9, 2026
…penclaw#167227)

* refactor: consolidate provider streams and plugin feature internals

* refactor: isolate Google provider stream construction

* refactor: keep response state updates explicit

* refactor: preserve image logging and auth descriptor copies

* refactor: distinguish Workboard mutation bindings
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 9, 2026
Regenerate the manifest after openclaw#167227 changed Workboard browser code.
Refresh controlUi.entry and controlUi.styles to the current immutable bundle
hash so the build-artifacts generated-assets check matches source again.

Only generated metadata changes; plugin behavior and assertions are intact.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui extensions: openai extensions: policy P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. plugin: workboard rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant