Skip to content

fix(gateway): deterministic channels.status ordering with probe-contract tests - #114362

Merged
steipete merged 1 commit into
mainfrom
perf/gateway-channels-status-parallel
Jul 27, 2026
Merged

steipete merged 1 commit into
mainfrom
perf/gateway-channels-status-parallel

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Investigating a 2441ms channels.status response on team.openclaw.ai (near-zero CPU in the same window — await-bound). The investigation found the handler already probes channels with five-wide bounded concurrency and 1–30s per-probe timeouts; the latency came from a slow probe batch within budget, not a serialization bug. What the investigation did surface: status-map insertion order followed completion order, and none of the concurrency/isolation behavior was locked by tests.

Why This Change Was Made

  • Status-map insertion is now deterministic by channel id (registry-defined UI order preserved in the response) — keyed maps feed prompt-cache inputs, and the repo's determinism rule requires stable ordering for map/registry payloads.
  • Regression coverage now locks the existing contract: two 1s probes complete in ~1s (concurrency), stable ordering, and a hanging probe yields its channel's timeout state while peers succeed (isolation). Network/API, socket/process, and filesystem probes stay isolated.

Honest scope note: this is a determinism fix plus contract-locking tests, not a latency change — the concurrency the original evidence asked for already existed.

User Impact

Stable channel ordering in status payloads (prompt-cache friendly, no UI reorder flicker); the probe concurrency/isolation contract can no longer regress silently.

Evidence

  • Prod diff is 5 lines (channels.ts): sort probe tasks by channel id.
  • 10/10 focused tests including the new concurrency, ordering, and hanging-probe isolation regressions; re-run post-rebase green.
  • oxfmt/oxlint clean; no CHANGELOG edit; no new exports (knip-safe).
  • Autoreview (Codex gpt-5.6-sol, xhigh): clean.

@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Jul 27, 2026
@steipete
steipete marked this pull request as ready for review July 27, 2026 06:06
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Jul 27, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 27, 2026
@clawsweeper

clawsweeper Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 2:10 AM ET / 06:10 UTC.

ClawSweeper review

What this changes

This PR sorts channel-status probe tasks by channel ID so keyed status maps are deterministic, while adding gateway tests for concurrent probes, stable map ordering, and per-channel timeout isolation.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 2 items remain

Keep this PR open for maintainer handling. The proposed sort is a narrow determinism change that preserves the separate registry-defined channelOrder, and the added tests target concurrency and timeout isolation; however, the supplied PR record provides test-only evidence rather than inspectable after-fix runtime output, and the maintainer label requires explicit human handling.

Priority: P3
Reviewed head: 852a602e17de695db9bb756e9d28104641b8cb7e

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is focused and has relevant contract coverage, but the provided evidence is test-only rather than a directly inspectable after-fix runtime demonstration.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body reports focused tests and quality checks, but the supplied record has no inspectable after-fix live gateway response, terminal transcript, log, recording, or linked artifact. Please add redacted real behavior proof; after updating the body, a maintainer can request @clawsweeper re-review if a fresh review does not start automatically. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body reports focused tests and quality checks, but the supplied record has no inspectable after-fix live gateway response, terminal transcript, log, recording, or linked artifact. Please add redacted real behavior proof; after updating the body, a maintainer can request @clawsweeper re-review if a fresh review does not start automatically. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 4 items Narrow runtime change: The PR sorts only the probe-task input by channel ID and leaves selectedPlugins available for the registry-defined UI order, matching the stated separation between deterministic keyed maps and UI ordering.
Contract coverage added: The PR adds focused tests asserting simultaneous delayed probes start together, the response retains the supplied UI order, keyed channel-map keys are stable, and a hanging probe produces a timeout state without failing peers.
Repository policy applied: The full repository guidance supplied for this review requires deterministic ordering for maps and registries feeding model or cache payloads, while also requiring a dedicated real-behavior proof assessment for external PRs.
Findings None None.
Security None None.

How this fits together

The Gateway channels.status endpoint combines registered channel metadata with optional account-probe results into a status response. The registry order remains the UI-facing channel order, while the keyed status maps are constructed from probe work and can affect downstream consumers that serialize or cache the payload.

flowchart LR
  A[Channel registry] --> B[Gateway status request]
  B --> C[Requested channel selection]
  C --> D[Sorted probe task list]
  D --> E[Bounded concurrent probes]
  E --> F[Keyed channel status maps]
  A --> G[Registry UI order]
  F --> H[Gateway status response]
  G --> H
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports focused tests and quality checks, but the supplied record has no inspectable after-fix live gateway response, terminal transcript, log, recording, or linked artifact. Please add redacted real behavior proof; after updating the body, a maintainer can request @clawsweeper re-review if a fresh review does not start automatically. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Complete next step (P2) - The protected maintainer label requires explicit maintainer handling, and the remaining merge gate is contributor-supplied real behavior proof rather than a mechanical code repair.
Agent review details

Security

None.

PR surface

Source +4, Tests +53. Total +57 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 1 +4
Tests 1 63 10 +53
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 68 11 +57

Review metrics

None.

Technical review

Best possible solution:

Preserve the split between registry-defined channelOrder and deterministic keyed status maps, and attach a redacted after-fix gateway response or live terminal transcript showing a multi-channel probe result before merge.

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

Yes from source-level evidence: configure two delayed channel probes and compare the keyed channels map order with the registry UI order while advancing the probe timers. The supplied context does not include an independently run current-main reproduction.

Is this the best way to solve the issue?

Likely yes: sorting the probe-task input is a contained way to stabilize keyed map construction while retaining the separately returned registry UI order. A live response artifact should confirm that no client relies on the old completion-dependent object enumeration order.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0406e6636916.

Labels

Label changes:

  • add P3: This is a small determinism and regression-coverage improvement with no evidence of an urgent user-facing regression.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports focused tests and quality checks, but the supplied record has no inspectable after-fix live gateway response, terminal transcript, log, recording, or linked artifact. Please add redacted real behavior proof; after updating the body, a maintainer can request @clawsweeper re-review if a fresh review does not start automatically. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P3: This is a small determinism and regression-coverage improvement with no evidence of an urgent user-facing regression.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports focused tests and quality checks, but the supplied record has no inspectable after-fix live gateway response, terminal transcript, log, recording, or linked artifact. Please add redacted real behavior proof; after updating the body, a maintainer can request @clawsweeper re-review if a fresh review does not start automatically. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Narrow runtime change: The PR sorts only the probe-task input by channel ID and leaves selectedPlugins available for the registry-defined UI order, matching the stated separation between deterministic keyed maps and UI ordering. (src/gateway/server-methods/channels.ts:361, 852a602e17de)
  • Contract coverage added: The PR adds focused tests asserting simultaneous delayed probes start together, the response retains the supplied UI order, keyed channel-map keys are stable, and a hanging probe produces a timeout state without failing peers. (src/gateway/server-methods/channels.status.test.ts:249, 852a602e17de)
  • Repository policy applied: The full repository guidance supplied for this review requires deterministic ordering for maps and registries feeding model or cache payloads, while also requiring a dedicated real-behavior proof assessment for external PRs. (AGENTS.md:1, 0406e6636916)
  • PR checks and discussion state: The provided PR context shows the focused test and lint claims in the body, a successful Real behavior proof check, and several still-running CI lanes; it does not include a linked runtime transcript, response artifact, recording, or redacted gateway output that independently demonstrates the changed behavior. (852a602e17de)

Likely related people:

  • steipete: The available commit metadata ties this contributor directly to the proposed gateway handler and focused contract tests; no broader current-main history was available in the supplied review record. (role: recent gateway contributor; confidence: low; commits: 852a602e17de; files: src/gateway/server-methods/channels.ts, src/gateway/server-methods/channels.status.test.ts)

Rank-up moves

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

  • Add a redacted terminal transcript or captured gateway response showing several channel probes and the stable keyed-map order.
  • Let the remaining required CI lanes finish on the reviewed head.

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.

@steipete
steipete merged commit 2ce0362 into main Jul 27, 2026
221 of 226 checks passed
@steipete
steipete deleted the perf/gateway-channels-status-parallel branch July 27, 2026 06:15
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant