refactor: move provider transports into packages/ai behind a typed host port#111669
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 20, 2026, 3:10 AM ET / 07:10 UTC. Summary Reproducibility: not applicable. as a bug reproduction: this PR is an architectural refactor plus a new package API surface. The relevant proof is a configured-provider runtime exercise, which the PR body does not supply. Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review findings
Review detailsBest possible solution: Keep transport implementations package-private unless an owner explicitly approves Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this PR is an architectural refactor plus a new package API surface. The relevant proof is a configured-provider runtime exercise, which the PR body does not supply. Is this the best way to solve the issue? Unclear: the typed host-port direction is plausible, but publicly exporting the broad transport barrel is not shown to be the best solution over private package implementation plus existing stable facades. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 873c2a0c3205. Label changesLabel justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (2 earlier review cycles)
|
7566e76 to
b6eae1c
Compare
b6eae1c to
b54a462
Compare
dadf0b7 to
565201b
Compare
565201b to
1fe10b0
Compare
|
Merged via squash.
|
…st port (openclaw#111669) * refactor(ai): invert plugin coupling behind the transport host port * fix(ai): queue custom transport registrations until the host is configured * refactor(ai): remove relocated transport sources from src/agents * fix(ai): source core stream types from canonical packages and fix tarball fixtures * fix(ai): invert plugin transport host wiring * fix(ai): harden managed transport projection * test(ai): register synchronous stream in transport mock * fix(ai): lazily install transport runtime host * fix(ai): preserve completion compat detection
* origin/main: (24 commits) fix(agents): keep compaction on live session model (#95713) fix(plugin-sdk): guard provider catalog live URL parsing against malformed responses (#109986) chore(cli): drop dead classifiers and single-use wrappers left by fallback removal (#112191) feat(ui): expand the lobster pet's random universe (#112073) chore(ci): audit dependency fingerprint exports (#112190) fix(ui): preserve graphemes in provider icons (#109509) fix(ui): align settings search with navigation rows (#112172) fix(agents): allow configless gateway rebind to activate standalone owner (#111841) fix(secrets): register secret targets for installed-origin plugins (#104347) improve(ui): show real machine identity in the place picker (#112162) fix: webChat scrollback history is too limited — older assistant replies and tool outputs disappear when scrolling… (#104250) test(ui): run DOM-free suites in Node (#112031) feat(nodes): make computer.act eligibility capability-based for desktop nodes (#112107) fix(apps): harden mobile gateway and watch state fix(ci): restore Z.AI API Platform validation (#112171) fix(ui): prevent Logs controls from overlapping (#112170) fix #95291: message tool fails to deliver files/images on Feishu (400 volc-dcdn / write ECONNRESET) while same Lark SDK upload succeeds standalone (#95514) refactor(cli)!: remove automatic gateway→embedded fallback from openclaw agent (#112074) refactor: move provider transports into packages/ai behind a typed host port (#111669) fix(anthropic): complete transcript reverse-scan windows across short reads (#109431) ...
…re + restore dropped fork symbols - provider-transport-fetch: adopt upstream (transports moved to packages/ai in openclaw#111669) and re-apply the fork's provider concurrency gate. - Skill Workshop: the fork deleted skill-workshop-prompt.ts, so drop the prompt section and SDK re-export upstream still carries instead of resurrecting it. - Legacy JSON store (openclaw#113075): repoint reassign-runtime, auto-title-generator and preserve-reset-discovery at session-accessor.entry / session-store-runtime. - Re-add fork-only exports the upstream rebase drops because they predate the merge base: appendJsonlEntrySync, snapshotSessionOrigin, OsSandboxSettings, BashDisciplineConfig, ToolLoopPostCompactionGuardConfig, and the chat send-timing / side-result schemas plus deltaThinking. tsgo:core 99 -> 79.
What Problem This Solves
packages/aiexported a wildcard./internal/*surface consumed by ~6,700 lines of provider transports parked insrc/agents— the package boundary existed but didn't isolate anything, and the transports reached back into core plugin hooks, coupling provider wire logic to the application layer.Why This Change Was Made
The five transports (OpenAI Responses/Completions, Anthropic stream, simple-completion, provider-stream) plus 17 supporting modules and their tests move into
packages/ai/src/transports/, with the plugin/runtime coupling inverted through the package's existing host-port pattern: a typedAiTransportPluginHost(provider-stream resolution, transport turn-state, simple-completion wrapping, Vertex stream construction) plus the non-plugin policies the transports need, all wired bysrc/llm/ai-transport-host.ts.packages/ainow has zero imports into coresrc/**. The wildcardinternal/*export is gone; five entries remain as exact exports with cited external consumers, two became package-private. Two modules stayed in core deliberately — they are shipped plugin-SDK surface (provider-transport-runtime), and SDK removals take the deprecation path, not a refactor.During review, a real initialization-order regression was caught and fixed structurally: import-time custom-API registration could run against the inert host and be permanently lost to module caching. Registrations made before host configuration now queue (deduplicated, bounded at 32, loud on overflow) and replay exactly once when the real registrar installs — no import-order requirement — with a regression test proving the previously-broken order. A runtime import cycle exposed by the gates was also removed (Google payload normalizer extracted; public exports preserved), deleting one stale max-lines suppression.
User Impact
No behavior change. Provider transport code now lives with its package, future provider work happens behind one typed seam, and the lost-registration failure mode is structurally impossible.
Evidence
pnpm buildgreen (140 SDK declaration entries, no[INEFFECTIVE_DYNAMIC_IMPORT]);pnpm plugin-sdk:surface:check(140 entrypoints, zero forbidden subpaths) andplugin-sdk:api:checkhash unchanged; changed-file gate green incl. import cycles: 0 runtime value cycles.