refactor(gateway): consolidate client contracts#101012
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 8, 2026, 12:54 PM ET / 16:54 UTC. Summary PR surface: Source -134, Tests +94, Config +8, Other +1. Total -31 across 11 files. Reproducibility: not applicable. This PR is an internal refactor, not a user-visible bug report. Source inspection on current main confirms the duplicated gateway client and protocol contracts that the PR targets. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land this gateway slice after maintainer review and exact-head checks, keeping package-owned client contracts and protocol-owned lightweight frame guards aligned across exports, build entries, and aliases. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR is an internal refactor, not a user-visible bug report. Source inspection on current main confirms the duplicated gateway client and protocol contracts that the PR targets. Is this the best way to solve the issue? Yes. Moving shared client contracts to AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 534ace4d8a49. Label changesLabel justifications:
Evidence reviewedPR surface: Source -134, Tests +94, Config +8, Other +1. Total -31 across 11 files. View PR surface stats
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
Review history (4 earlier review cycles)
|
9629daf to
b6563c9
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
b6563c9 to
e62ab45
Compare
Related: #100977
What Problem This Solves
The core gateway client and the shared gateway-client package maintained parallel option, event, error, validation, and connection-metadata contracts. That duplication made the internal client boundary easy to drift and required core-specific casts and repeated frame guards.
Why This Change Was Made
This makes
@openclaw/gateway-clientthe canonical client contract owner and moves lightweight inbound frame validation to the published@openclaw/gateway-protocol/frame-guardsleaf. The core facade retains only OpenClaw-owned dependency injection and defaults. The dedicated leaf avoids pulling the large TypeBox schema runtime into the reusable client, while package build, TS/Vitest resolution, and plugin source-loader entries cover the repository's existing resolution modes.The request method stays validated directly at the client boundary because request IDs are generated internally with
randomUUID(); no exported one-caller request validator or unreachable ID branch remains. The complete PR is net negative: 208 additions / 239 deletions (net -31).User Impact
No user-visible runtime behavior changes. Maintainers get one canonical gateway client contract path, preserved permissive inbound frame handling, private connection secrets, and fewer duplicate declarations and one-use helpers.
Evidence
origin/main534ace4d8a4988c8fbcd54ada1209a86eb12dcc4; current PR heade62ab453dd2dea832f7c6d735e0395c3eb1dcaef.tbx_01kx1944meqepwmps1watngd1g(violet-prawn), Actions run https://github.com/openclaw/openclaw/actions/runs/28958947642: 278 focused tests passed (18 package/protocol unit, 183 gateway, 77 plugin loader aliases).@openclaw/gateway-protocolbuild,@openclaw/gateway-clientbuild, and repository root tsdown build passed.check:changedpassed, including full tsgo project typecheck, core/extensions/scripts lint, guards, and runtime import-cycle check.patch is correct, confidence 0.86).