Skip to content

test(gateway): prove RPC wire and agent contracts - #118794

Merged
vincentkoc merged 5 commits into
mainfrom
gateway-b1-rpc-contracts
Aug 3, 2026
Merged

vincentkoc merged 5 commits into
mainfrom
gateway-b1-rpc-contracts

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 3, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Gateway QA coverage did not directly exercise seven RPC/event contracts at the
real WebSocket boundary: frame envelopes, method/event discovery, per-client
event ordering, delivery fallback, accepted/final responses, and idempotent
replay.

Why This Change Was Made

This adds two focused real-Gateway WebSocket scenarios. The wire scenario uses
two clients to validate handshake and health envelopes, hello discovery
metadata, and monotonic heartbeat sequences. The agent scenario validates
session-only fallback, accepted/final ordering, and reconnect replay while
mocking only the downstream provider command.

No production code, taxonomy, QA internals, or existing broad tests are changed.

User Impact

No runtime behavior changes. Maintainers gain executable primary evidence for
seven existing Gateway maturity targets.

Review Disposition

  • Applied the response-ordering finding: one raw receive log now proves the
    exact accepted, then ok frame order for the request ID.
  • Retained the focused agent scenario. This is the approved cohesive QA
    evidence owner for three exact maturity IDs: one real Gateway lifecycle
    proves fallback, ordered responses, and reconnect replay while mocking only
    downstream agentCommand. Existing broad tests cover those behaviors
    separately; they do not provide this single catalog evidence unit.

Repair Doctrine

  • Root cause: the Gateway QA catalog lacked direct, executable real-WebSocket
    evidence for these seven existing contracts.
  • Architectural owner: Gateway server contract tests plus QA runtime scenario
    metadata.
  • Canonical fix: two focused real-Gateway tests, split between wire-level and
    agent-lifecycle ownership.
  • Removed paths: none; this is additive test evidence only.
  • Production LOC delta: +0.
  • Test and QA metadata delta: +378 lines across two tests and two scenarios.
  • Sibling coverage: two raw clients prove independent event sequences; the
    agent path proves fallback, ordered terminal results, reconnect replay, and
    one downstream side effect.

Evidence

  • Rebased once onto frozen origin/main
    682f60ce56b37c5cd3205fdcbbf25b21d48708f2, which contains security
    prerequisite 25aa29d7a15ed6402543fe48680853d7637f2b36.
  • Exact PR head: 25b820c3b46e2ac952439783a8a731ca3a78f673.
  • Trusted AWS Crabbox focused proof:
    • lease cbx_19fb48ce19cd
    • run run_e8f0c2496053
    • src/gateway/server.rpc-wire-contracts.test.ts: passed
    • src/gateway/server.agent.rpc-contracts.test.ts: passed
    • total: 2 files, 2 tests passed
  • Scoped changed gate passed on Blacksmith Testbox
    tbx_01kz4pdhhq8dss6x0znyj4e8p5: formatting, repository guards, full
    tsgo typecheck, full lint, and runtime import-cycle checks all passed.
  • QA suite source runs passed at the exact PR head:
    • gateway-rpc-wire-contracts: four exact primary IDs
    • gateway-agent-rpc-contracts: three exact primary IDs
  • Each of the seven coverage IDs occurs in exactly one intended runtime
    scenario.
  • git diff --check: passed.
  • Exact touched-file oxlint: passed.
  • Full branch autoreview: clean, no accepted/actionable findings; correctness
    score 0.99.

@vincentkoc vincentkoc self-assigned this Aug 3, 2026
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime extensions: qa-lab size: M maintainer Maintainer-authored PR labels Aug 3, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 5:13 PM ET / 21:13 UTC.

ClawSweeper review

What this changes

Adds two real-Gateway WebSocket contract tests and two runtime QA scenarios covering RPC envelopes, discovery, per-client heartbeat order, best-effort delivery fallback, accepted/final response order, and reconnect idempotency.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This PR remains necessary as a focused QA-evidence addition. The earlier duplicate-coverage concern is resolved by the explicit member decision to retain one cohesive real-Gateway lifecycle scenario for the three catalog targets, while current main continues to own the broader behavioral regressions; the patch introduces no production behavior change or concrete correctness finding. Final merge should wait for the behind-branch merge result and in-progress required checks to refresh.

Priority: P3
Reviewed head: 25b820c3b46e2ac952439783a8a731ca3a78f673

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, production-neutral test and QA-evidence patch with the prior overlap concern explicitly resolved by the stated evidence-boundary decision.
Proof confidence 🌊 off-meta tidepool Not applicable: The author is a repository MEMBER, so the external-contributor proof gate does not apply; the PR body additionally reports focused real-Gateway and remote validation evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The author is a repository MEMBER, so the external-contributor proof gate does not apply; the PR body additionally reports focused real-Gateway and remote validation evidence.
Evidence reviewed 6 items Current delivery owner: Current main downgrades best-effort requests with no deliverable channel to session-only execution and records the resulting non-delivery state, which is the runtime behavior the new agent contract test observes.
Existing regression ownership: Current main already covers the individual best-effort webchat fallback, accepted/final response, and idempotency behaviors in the broad Gateway agent suite; the PR's distinct value is a single real-WebSocket catalog evidence unit spanning their lifecycle.
Approved separate evidence boundary: The member comment explicitly retains the focused agent scenario as the canonical QA catalog evidence for delivery fallback, accepted-then-final results, and idempotent side effects; it also confirms the previous response-ordering concern was addressed.
Findings None None.
Security None None.

How this fits together

Gateway accepts WebSocket RPC requests, resolves delivery and agent execution, then emits response and event frames to connected clients. The added tests exercise that live loopback boundary and register the resulting evidence in the QA scenario catalog.

flowchart LR
  Client[WebSocket clients] --> Gateway[Gateway server]
  Gateway --> Handshake[Handshake and RPC envelopes]
  Gateway --> Delivery[Delivery resolution]
  Delivery --> AgentRun[Agent execution]
  AgentRun --> Responses[Accepted and final responses]
  Gateway --> Events[Heartbeat event broadcast]
  Responses --> Client
  Events --> Client
Loading

Before merge

  • Resolve merge risk (P1) - GitHub reports the branch behind current main and several required checks are still in progress; refresh the three-way merge result and required-check status before merging, without treating ordinary base drift as a patch defect.
  • Complete next step (P2) - No repair lane is needed: the reviewed patch has no discrete actionable defect, and normal merge refresh/check completion is not an automated code-repair task.
Agent review details

Security

None.

PR surface

Tests +321, Other +57. Total +378 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 321 0 +321
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 57 0 +57
Total 4 378 0 +378

Review metrics

Metric Value Why it matters
Production vs. evidence LOC production +0, tests +321, QA metadata +57 The additive growth is confined to executable Gateway evidence and catalog records, with no runtime behavior surface added.
Catalog contract coverage 7 existing targets across 2 focused WebSocket scenarios The PR is intentionally organized around a small, approved evidence boundary rather than broad new Gateway behavior.

Stored data model

Persistent data-model change detected: serialized state: src/gateway/server.agent.rpc-contracts.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the two focused tests and their QA records after the branch is refreshed against current main and required checks confirm the exact merge result; retain the broader agent suite as the behavioral regression owner.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the two focused tests and their QA records after the branch is refreshed against current main and required checks confirm the exact merge result; retain the broader agent suite as the behavioral regression owner.

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

Not applicable: this PR adds executable regression and QA evidence rather than fixing a newly reported runtime defect. The PR body reports focused real-Gateway runs, and the source directly shows the loopback WebSocket path under test.

Is this the best way to solve the issue?

Yes: keeping the focused lifecycle test while preserving the existing broad suite follows the explicitly approved evidence-owner split and avoids changing production routing or duplicating a second runtime implementation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5b1b1e063225.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The author is a repository MEMBER, so the external-contributor proof gate does not apply; the PR body additionally reports focused real-Gateway and remote validation evidence.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.
  • remove merge-risk: 🚨 other: Current PR review selected no merge-risk labels.

Label justifications:

  • P3: This is low-urgency, test-only Gateway QA coverage with no asserted runtime behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The author is a repository MEMBER, so the external-contributor proof gate does not apply; the PR body additionally reports focused real-Gateway and remote validation evidence.

Evidence

What I checked:

Likely related people:

  • steipete: Current delivery-resolution lines blame to Peter Steinberger's recent Gateway work, and the preceding phase-splitting commit established this execution boundary. (role: recent Gateway owner and refactor author; confidence: high; commits: d1fff1afc6a8, 5a65c96fc708; files: src/gateway/server-methods/agent-delivery-phase.ts, src/gateway/server.agent.gateway-server-agent-b.test.ts)
  • vincentkoc: The member discussion explicitly states the decision to keep the cohesive agent scenario as the canonical catalog evidence unit, and the branch implements that boundary. (role: QA evidence-boundary decision author; confidence: high; commits: 832b11b66bf8, f3b8d6b3ae1f, 25b820c3b46e; files: src/gateway/server.agent.rpc-contracts.test.ts, src/gateway/server.rpc-wire-contracts.test.ts, qa/scenarios/runtime/gateway-agent-rpc-contracts.yaml)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Refresh the branch against current main and confirm required checks on the resulting merge state.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-08-03T17:34:26.029Z sha 9a85a07 :: found issues before merge. :: [P2] Record response arrival order before asserting it
  • reviewed 2026-08-03T18:01:42.629Z sha c262de7 :: needs changes before merge. :: [P2] Record response arrival order before asserting it
  • reviewed 2026-08-03T18:23:20.115Z sha e8e278b :: found issues before merge. :: [P1] Consolidate duplicate agent WebSocket coverage | [P2] Record response arrival order before asserting it
  • reviewed 2026-08-03T19:18:25.327Z sha f10e0dd6b07da059db33d1e297d934b4642c0f6e :: found issues before merge. :: [P1] Consolidate duplicate agent WebSocket coverage

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. label Aug 3, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

Maintainer decision: retain the separate agent RPC scenario as the canonical QA
catalog evidence unit for:

  • gateway.delivery-fallback-behavior
  • gateway.accepted-then-final-results
  • gateway.idempotent-side-effects

The existing broad Gateway suite remains the behavioral regression owner for
its individual cases. This focused scenario owns the cohesive catalog evidence:
one real Gateway lifecycle proves fallback, actual accepted-before-terminal
frame order, and reconnect replay while mocking only downstream
agentCommand.

The response-ordering finding is fixed in f10e0dd6b07. Consolidation is
skipped deliberately because it would remove the approved single-scenario
evidence boundary for these three IDs.

@vincentkoc
vincentkoc force-pushed the gateway-b1-rpc-contracts branch from f10e0dd to ce5f09f Compare August 3, 2026 20:26
@vincentkoc
vincentkoc marked this pull request as ready for review August 3, 2026 20:30
@vincentkoc
vincentkoc force-pushed the gateway-b1-rpc-contracts branch from ce5f09f to 25b820c Compare August 3, 2026 21:07
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 3, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

Rank-up move disposition:

  • The required prerequisite refresh was completed once: this head is based on
    682f60ce56b37c5cd3205fdcbbf25b21d48708f2, which contains
    25aa29d7a15ed6402543fe48680853d7637f2b36.
  • Required checks are now complete on exact head
    25b820c3b46e2ac952439783a8a731ca3a78f673: 78 successful, 0 failing,
    0 pending.
  • I am not rebasing again for ordinary subsequent main drift. The reviewed
    patch is frozen, ClawSweeper reports no actionable defect, and the current
    three-way merge result is the remaining merge-time check.

@vincentkoc
vincentkoc enabled auto-merge (squash) August 3, 2026 21:17
@vincentkoc
vincentkoc merged commit e4ab08c into main Aug 3, 2026
132 of 141 checks passed
@vincentkoc
vincentkoc deleted the gateway-b1-rpc-contracts branch August 3, 2026 21:17
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper automerge

@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper could not enable automerge for this PR.

Reason: automerge requires an open PR.

Draft PRs stay fix-only until GitHub marks them ready for review. Pause with /clawsweeper stop.

Automerge progress:

  • 2026-08-03 21:17:55 UTC review queued 25b820c3b46e (queued)

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
* test(gateway): cover RPC wire contracts

* test(gateway): cover agent RPC contracts

* test(gateway): satisfy heartbeat type safety

* test(gateway): satisfy agent RPC lint

* test(gateway): assert agent response ordering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: qa-lab gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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