Skip to content

fix(gateway): expose missing worker RPC latency diagnostics - #145602

Merged
vincentkoc merged 1 commit into
mainfrom
fix/worker-rpc-timing-20260912
Sep 12, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/worker-rpc-timing-20260912

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

Closes #145587

Follows merged #145600. This main-targeted PR contains only worker RPC diagnostic coverage.

What Problem This Solves

Resolves a problem where operators investigating cloud-worker pauses cannot distinguish Gateway queue wait, request handling, and response delay because dedicated worker ingress bypasses Gateway RPC diagnostics.

Why This Change Was Made

Reuse the existing gateway.rpc lifecycle at the dedicated worker ingress boundary. Capture receipt before its FIFO, preserve the dequeue time through validation, and record handler settlement and the actual sender result. Method dimensions come from the canonical closed worker method tuples; unknown methods use one fixed label.

Existing scheduling, inference acknowledgment ordering, durable transcript commits, and connection ownership stay intact. Production delta: +69 lines to cover the previously unobserved ingress boundary; tests: +271; docs: +10. No new metric names, configuration, protocol fields, or storage are introduced.

User Impact

Existing Gateway RPC dashboards can distinguish worker FIFO admission, handler work, and response sending. A successful send records acceptance by the WebSocket sender; client receipt is outside this measurement. Timing starts at the JavaScript socket callback. It excludes preceding network/event-loop delay; inference-start measures acceptance/setup rather than provider completion. Socket closure alone does not prove execution cancellation. This enables diagnosis and makes no measured latency-reduction claim.

Evidence

  • 87 worker/Gateway tests pass, including nine new metric cases plus existing admission, transcript, media, duplicate request, shutdown, durable-session, and generic RPC coverage.
  • Six diagnostics plugin tests pass with real OpenTelemetry SDK aggregation.
  • New cases prove deterministic FIFO/handler timings, ACK-before-launch, detached computer lifetime, failed/suppressed sends, service throws, bounded labels, and the disabled fast path.
  • 15 composed worker fault-injection cases pass, covering disconnects, replay, restart fencing, and durable transcript settlement.
  • Five computer connection-lifetime cases pass through real WebSockets, including policy/pairing fencing, completed input, and durable work during ordinary close.
  • Selected typechecks and scoped static checks/lint pass; the production UI build also passes for the combined stack.
  • Independent exact-commit review and autoreview: no actionable findings.

Development proof at the original telemetry head 3b599b2eca3d3e1f450d5ae79ea05bcd97730329 used Node 24.19.0 on Blacksmith Testbox, with all 41,132 source blobs and the frozen dependency lock verified. Testbox hydration run.

The signed restack d34c45bf00da3015543d14fa9989c1ef7fb8b5a0 is based on the UI squash merge ef217a415fea44500c19b9434db2ec40fa288547. git range-diff confirms the telemetry patch is unchanged; current main's WebSocket test import is preserved. Required hosted CI passed for this exact head: 115 successful jobs, 16 scope-based skips, and no failures. The required openclaw/ci-gate is green. Fresh exact-head ClawSweeper review found no actionable findings or remaining before-merge actions.

@vincentkoc vincentkoc self-assigned this Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime extensions: diagnostics-otel Extension: diagnostics-otel size: M maintainer Maintainer-authored PR labels Sep 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 12:12 PM ET / 16:12 UTC (Revision 3).

ClawSweeper review

What this changes

Adds worker request queue, handler, and response timing to existing Gateway diagnostics, with bounded method labels, regression tests, and documentation.

Merge readiness

✅ Ready for maintainer review

This PR remains necessary: current main still lacks dedicated worker RPC timing coverage. The reviewed patch has no actionable correctness or security findings.

Priority: P2
Reviewed head: d34c45bf00da3015543d14fa9989c1ef7fb8b5a0

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with meaningful boundary coverage, successful hosted CI, and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate and does not materially change authority; ingress tests and hosted CI support the timing change without establishing a live exporter observation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate and does not materially change authority; ingress tests and hosted CI support the timing change without establishing a live exporter observation.
Evidence reviewed 8 items Current-main necessity: The worker connection and shared diagnostics modules are unchanged between fetched main and the PR merge base; that baseline dispatches worker requests without creating RPC diagnostics.
Introduced lifecycle instrumentation: The pinned introduced diff captures receipt before the FIFO, wraps the existing dispatcher, records actual sender outcomes, and finishes detached operations when they settle. Existing admission, ownership checks, and cancellation signals remain in their original paths.
Bounded telemetry and existing export contract: Worker method labels come from repository-owned protocol tuples; arbitrary names become unknown. The existing exporter consumes the same lifecycle events and metric fields, without a new plugin API or persistent store.
Findings None None.
Security None None.

How this fits together

Dedicated worker WebSockets carry inference, transcript, and computer requests into the Gateway. The shared diagnostics lifecycle turns request timing and sender outcomes into events consumed by the OpenTelemetry plugin.

flowchart LR
  A[Worker RPC frame] --> B[Socket FIFO]
  B --> C[Frame validation]
  C --> D[Worker dispatcher]
  D --> E[Response sender]
  B --> F[Shared RPC diagnostics]
  D --> F
  E --> F
  F --> G[OpenTelemetry metrics]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +69, Tests +271, Docs +10. Total +350 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 3 91 22 +69
Tests 4 282 11 +271
Docs 1 17 7 +10
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 390 40 +350

Review metrics

Metric Value Why it matters
Production versus regression coverage production +69 net lines; tests and test support +271 Production growth is justified by instrumenting the previously uncovered ingress while reusing the existing diagnostics lifecycle.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #145587
Summary: This PR is the candidate implementation for the worker diagnostics gap; the merged UI work addresses a separate problem.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep worker timing in the shared RPC diagnostics owner, preserving existing dispatch semantics and documenting the limits of sender-acceptance measurements.

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

Yes, from source: admitted worker requests bypass the generic dispatcher and its diagnostics on current main. Runtime reproduction was not executed in this read-only review.

Is this the best way to solve the issue?

Yes. Instrumenting the dedicated ingress through the existing lifecycle is a focused repair that preserves the closed worker dispatcher and existing exporter contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5ba72cc78e39.

Labels

Label justifications:

  • P2: The missing measurements hinder worker-pause diagnosis but do not establish a runtime outage or latency regression.
  • 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 MEMBER-authored PR is exempt from the external-contributor proof gate and does not materially change authority; ingress tests and hosted CI support the timing change without establishing a live exporter observation.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 068ef71 adds src/gateway/server/ws-connection/request-diagnostics.ts:77 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 068ef71bd20e; files: src/gateway/server/ws-connection/request-diagnostics.ts)

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 (2 earlier review cycles)
  • reviewed 2026-09-12T04:57:15.535Z sha 3b599b2 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-12T14:53:01.941Z sha d34c45b :: needs maintainer review before merge. :: none

Base automatically changed from fix/cloud-cua-latency-20260912 to main September 12, 2026 14:42
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: L and removed size: M labels Sep 12, 2026
@vincentkoc
vincentkoc force-pushed the fix/worker-rpc-timing-20260912 branch from 3b599b2 to d34c45b Compare September 12, 2026 14:46
@vincentkoc
vincentkoc marked this pull request as ready for review September 12, 2026 14:47
@vincentkoc
vincentkoc merged commit 31c8b99 into main Sep 12, 2026
256 of 257 checks passed
@vincentkoc
vincentkoc deleted the fix/worker-rpc-timing-20260912 branch September 12, 2026 16:25
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 12, 2026
Restore Gateway test typecheck headroom by moving the complete nested server test subtree into the existing gateway-server compiler graph. Matching include/exclude patterns preserve exact root coverage, compiler concurrency, and the 700-root headroom guard and 720-root hard cap. Update the CI ownership documentation.

The existing inventory regression failed before at 701 gateway-other roots and passed all 24 tests afterward. Both affected compiler graphs and changed-file checks passed. Hosted CI run 34706250754 is green on ce1965c, reconfirmed by the exact-head watcher. No runtime behavior changes.

Refs #145602, #145461, #145431.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 13, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 13, 2026
Restore Gateway test typecheck headroom by moving the complete nested server test subtree into the existing gateway-server compiler graph. Matching include/exclude patterns preserve exact root coverage, compiler concurrency, and the 700-root headroom guard and 720-root hard cap. Update the CI ownership documentation.

The existing inventory regression failed before at 701 gateway-other roots and passed all 24 tests afterward. Both affected compiler graphs and changed-file checks passed. Hosted CI run 34706250754 is green on ce1965c, reconfirmed by the exact-head watcher. No runtime behavior changes.

Refs openclaw#145602, openclaw#145461, openclaw#145431.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation extensions: diagnostics-otel Extension: diagnostics-otel gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

[Bug]: Dedicated worker RPCs are missing Gateway latency diagnostics

1 participant