Repository navigation
feat(ai): scope transport hosts per runtime - #158901
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 6:30 AM ET / 10:30 UTC (Revision 44). ClawSweeper reviewWhat this changesThe branch isolates each model runtime’s transport policy, credentials, cached connections, fallback history, and cleanup while preserving process-default runtimes. Merge readiness✅ Ready for maintainer review Keep open: current main still lacks runtime-local transport ownership, the previous custom-browser-stream finding is repaired, and no remaining blocking defect was identified. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s AI transport library converts model requests into provider HTTP or WebSocket traffic and streams replies back to agents. Runtime-owned hosts supply transport and credential policy and delimit retained connection resources. flowchart TD
A[Model request] --> B[Runtime selects host]
B --> C[Credential and transport policy]
C --> D[HTTP or WebSocket provider]
D --> E[Host-bound reply stream]
B --> F[Owner-scoped connection cache]
F --> D
G[Runtime cleanup] --> F
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +742, Tests +1812, Docs +3, Other 0. Total +2557 across 26 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Retain one captured transport owner throughout provider work, connection reuse, and cleanup, with ordinary runtimes continuing to select the process default. Do we have a high-confidence way to reproduce the issue? Not applicable to the feature itself. The prior custom-browser defect has a focused bundled-runtime regression, and the current source repairs its identified mechanism; this reviewer did not execute tests. Is this the best way to solve the issue? Yes: extending the existing runtime and transport-resource owners avoids a competing manager, and the explicit-host defaults match the recorded maintainer decision. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a8652880e3c3. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (43 earlier review cycles; latest 8 shown)
|
Security-sensitive guard clearedCurrent revision: This PR no longer changes files in the maintainer security-review tier. Separate CODEOWNERS requirements still apply to security policy and enforcement files. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
1271f20 to
ebc19a2
Compare
|
@clawsweeper re-review The rebased head is |
|
🦞👀 Re-review progress:
|
Co-authored-by: sallyom <[email protected]> Co-authored-by: steipete <[email protected]> Co-authored-by: roboclaw-bot <[email protected]>
Related: #154388
What Problem This Solves
Independent model runtimes need transport policy that cannot replace or inherit another runtime’s provider, authentication, routing, fallback state, or cached connection.
User Impact
Remote and native harnesses can run concurrently without leaking transport authority or connection state. Ordinary runtimes and browser imports keep their current defaults.
Why This Change Was Made
This adds a runtime-owned
@openclaw/aitransport host. Explicit Node runtimes usecreateNodeLlmRuntime; ordinary runtimes keep the process default. Provider factories remain synchronous, while runtime scope is retained across lazy stream operations.ChatGPT WebSocket reuse and SSE fallback are scoped by runtime host, endpoint, and authority-bearing headers. Managed-transport policy disables direct WebSocket paths, and process-default state remains reachable across host reconfiguration. Fallback history retains eight recent authorities per session, bounding credential retention while avoiding repeat upgrades during normal token/header rotation.
This is the transport-contract slice of the original native worker inference change, based on work by @sallyom and @roboclaw-bot, with contributions from @steipete.
Maintainer Decision
The public
createNodeLlmRuntimecontract and its inert omitted/partial-host defaults are accepted. Embeddings must supply the managed fetch and credential policy they require; an explicit runtime must not silently inherit process transport authority. This is the intended foundation for the later worker-lifecycle and native-inference slices.Evidence
result()or iterator work to a different transport host, drop completion metadata, or make a completed native stream unreadable.Scoped AI transport hosts require Node.js async context support; the named browser/host-scope suite passes 13/13 in 2.56s wall.202ace18b2d.autotransport falls back to SSE when a relative endpoint cannot form a WebSocket URL.patch is correct, 0.79 confidence), the real-client proof (patch is correct, 0.88 confidence), the completed native/delegated browser-stream repair (patch is correct, 0.72 confidence), or the final custom-stream lifetime/replay repair (patch is correct, 0.83 confidence).34a0d304a8d) and currentmain(558d38a3db5): unresolved database types and.sort()diagnostics in untouchedsrc/**files. The PR does not modify those files; this is inherited red-main evidence.mainby test(ci): include infra in shared Windows partitions #162310; this head is rebased over that fix.