refactor: extract gateway client package#87797
Conversation
Dependency Changes DetectedThis PR changes dependency-related files. Maintainers should confirm these changes are intentional. Changed files:
Maintainer follow-up:
|
|
Codex review: needs real behavior proof before merge. Reviewed May 28, 2026, 9:19 PM ET / 01:19 UTC. Summary Reproducibility: yes. for the review blockers by source inspection: PR head shows the public SDK export pointing at packages/gateway-protocol/src while package metadata ships dist only, and CI/ownership maps omit packages/gateway-client/src. I did not run build or live gateway tests because this review is read-only. Review metrics: 3 noteworthy metrics.
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
Security Review findings
Review detailsBest possible solution: Land only after the plugin SDK gateway-runtime export resolves through shipped artifacts, gateway-client paths are wired into CI/ownership/labels, and a redacted live gateway/device-pairing proof confirms the refactor preserves runtime behavior. Do we have a high-confidence way to reproduce the issue? Yes for the review blockers by source inspection: PR head shows the public SDK export pointing at packages/gateway-protocol/src while package metadata ships dist only, and CI/ownership maps omit packages/gateway-client/src. I did not run build or live gateway tests because this review is read-only. Is this the best way to solve the issue? No; the package extraction is a reasonable direction, but the current implementation should first preserve the packaged plugin SDK contract, route the new gateway-client package through review automation, and add live gateway proof. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 92051f6746c6. Label changesLabel changes:
Label justifications:
Evidence reviewedSecurity concerns:
What 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
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 88b9cf3294
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /^(Dockerfile$|\.npmrc$|package\.json$|pnpm-lock\.yaml$|pnpm-workspace\.yaml$|scripts\/ci-changed-scope\.mjs$|scripts\/install(?:-cli)?\.sh$|scripts\/install\.ps1$|scripts\/test-install-sh-docker\.sh$|scripts\/docker\/|scripts\/e2e\/(?:Dockerfile(?:\.qr-import)?|qr-import-docker\.sh|bun-global-install-smoke\.sh)$|\.github\/workflows\/(?:install-smoke|website-installer-sync)\.yml$|\.github\/actions\/setup-node-env\/action\.yml$)/; | ||
| const FAST_INSTALL_SMOKE_RUNTIME_SCOPE_RE = /^src\/(?:channels|gateway|plugin-sdk|plugins)\//; | ||
| const FAST_INSTALL_SMOKE_RUNTIME_SCOPE_RE = | ||
| /^(?:src\/(?:channels|gateway|plugin-sdk|plugins)\/|packages\/gateway-protocol\/src\/)/; |
There was a problem hiding this comment.
Include gateway-client runtime in changed-smoke scope
With the client implementation now moved under packages/gateway-client/src, a PR that edits only that package no longer matches FAST_INSTALL_SMOKE_RUNTIME_SCOPE_RE, so detectInstallSmokeScopeForPath() leaves runFastInstallSmoke/runChangedSmoke false even though the changed code is part of the installed gateway client runtime. This misses the same install-smoke coverage that src/gateway/** and the extracted protocol package still get; include packages/gateway-client/src/ in this runtime scope and add a routing test alongside the new protocol case.
Useful? React with 👍 / 👎.
88b9cf3 to
0477290
Compare
There was a problem hiding this comment.
💡 Codex Review
openclaw/scripts/run-node-watch-paths.mjs
Lines 7 to 9 in 0477290
Because the extracted gateway client/protocol are now first-class build inputs, leaving runNodeSourceRoots limited to src and bundled plugins lets pnpm openclaw gateway call/status use a stamped dist without rebuilding after edits under packages/gateway-client/src or packages/gateway-protocol/src when tsconfig.json/tsdown.config.ts did not change. I checked scripts/run-node.mjs: shouldFastPathExistingDistForGatewayClient() only validates these sourceRoots plus config files before skipping the build, while tsdown.config.ts now builds dist entries directly from those package paths, so source changes there can run stale gateway client/protocol code until a config file or src/ changes.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| - "src/gateway/server-startup-memory.ts" | ||
| - "src/gateway/method-scopes.ts" | ||
| - "src/gateway/protocol/**" | ||
| - "packages/gateway-protocol/src/**" | ||
| - "src/gateway/server-methods/**" |
There was a problem hiding this comment.
Route gateway-client changes through CodeQL gateway checks
With the client runtime moved into packages/gateway-client/src, edits to that package no longer trigger this workflow and also won't set the gateway profile in the file-classification case below; I checked the workflow paths and profile routing, and only packages/gateway-protocol/src/** was added alongside the old gateway surfaces. That means PRs that change the installed gateway client's auth/TLS/plaintext WebSocket handling can bypass the critical gateway CodeQL lane unless they also touch src/gateway/** or the protocol package.
Useful? React with 👍 / 👎.
7f82575 to
b6f4d6a
Compare
|
Verification before merge: Behavior addressed: gateway client/protocol package extraction without changing the public OpenClaw gateway client contract. node scripts/run-vitest.mjs run src/agents/embedded-agent-runner/run/attempt.cwd-split.test.ts
node scripts/run-vitest.mjs run src/gateway/client.test.ts packages/gateway-protocol/src/index.test.ts packages/gateway-protocol/src/native-protocol-levels.guard.test.ts packages/gateway-protocol/src/primitives.secretref.test.ts
node scripts/run-tsgo.mjs -b tsconfig.core.json
OPENCLAW_LOCAL_CHECK=0 pnpm deadcode:dependencies
git diff --check
.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/mainEvidence after fix: focused embedded-runner test passed 1 file / 2 tests; focused gateway/protocol Vitest passed 8 files / 190 tests; core tsgo passed; dependency deadcode check passed; git diff check passed; autoreview reported no accepted/actionable findings. GitHub Actions passed on CI run 26611855150, CodeQL run 26611855119 after rerunning a wedged shard, Real behavior proof run 26612185810, Blacksmith Testbox run 26611855096, Blacksmith Build Artifacts Testbox run 26611855102, and OpenGrep run 26611855098. |
* refactor: extract gateway client package * chore: drop generated gateway package artifacts * refactor: move gateway protocol package * refactor: remove old gateway protocol tree * test: keep auth compat split in run mode * test: expose gateway wrapper options for internals * fix: watch moved gateway package sources * test: normalize slash command import guard * chore: teach knip gateway package entries * ci: route gateway client package checks * fix: reuse ipaddr for gateway client hosts * fix: sync gateway protocol usage schema
* refactor: extract gateway client package * chore: drop generated gateway package artifacts * refactor: move gateway protocol package * refactor: remove old gateway protocol tree * test: keep auth compat split in run mode * test: expose gateway wrapper options for internals * fix: watch moved gateway package sources * test: normalize slash command import guard * chore: teach knip gateway package entries * ci: route gateway client package checks * fix: reuse ipaddr for gateway client hosts * fix: sync gateway protocol usage schema
* refactor: extract gateway client package * chore: drop generated gateway package artifacts * refactor: move gateway protocol package * refactor: remove old gateway protocol tree * test: keep auth compat split in run mode * test: expose gateway wrapper options for internals * fix: watch moved gateway package sources * test: normalize slash command import guard * chore: teach knip gateway package entries * ci: route gateway client package checks * fix: reuse ipaddr for gateway client hosts * fix: sync gateway protocol usage schema
Summary
packages/gateway-protocoland gateway client/runtime helpers intopackages/gateway-client.src/gateway/client.tsas the OpenClaw host wrapper that injects signing, logging redaction, proxy bypass, and host-specific gateway dependencies.Real behavior proof
Behavior addressed: gateway client/protocol package extraction without changing the public OpenClaw gateway client contract.
Real environment tested: local macOS source checkout on the rebased PR branch; GitHub Actions started for head
b6f4d6a9d94de3d698a88eedd0874f07bcf28bca.Exact steps or command run after this patch:
Evidence after fix: focused embedded-runner test passed 1 file / 2 tests; focused gateway/protocol Vitest passed 8 files / 190 tests; core tsgo passed; dependency deadcode check passed;
git diff --checkpassed.Observed result after fix: gateway protocol types resolve from
packages/gateway-protocol, gateway client host checks useipaddr.jsinstead of hand-rolled IPv6 parsing, and the root gateway client wrapper preserves existing OpenClaw host behavior.What was not tested: no live gateway/device pairing scenario was run.
Verification
node scripts/run-vitest.mjs run src/agents/embedded-agent-runner/run/attempt.cwd-split.test.tsnode scripts/run-vitest.mjs run src/gateway/client.test.ts packages/gateway-protocol/src/index.test.ts packages/gateway-protocol/src/native-protocol-levels.guard.test.ts packages/gateway-protocol/src/primitives.secretref.test.tsnode scripts/run-tsgo.mjs -b tsconfig.core.jsonOPENCLAW_LOCAL_CHECK=0 pnpm deadcode:dependenciesgit diff --check.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/mainrunning for final closeout on the pushed head