-
Notifications
You must be signed in to change notification settings - Fork 295
[Bug]: Operator RPC can be sent before connect/hello-ok, causing 1008 PolicyViolation #1418
Copy link
Copy link
Open
Labels
P1Urgent regression or broken agent/channel workflow affecting real users now.Urgent regression or broken agent/channel workflow affecting real users now.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.User-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.no-staleExempts this issue from stale automation.Exempts this issue from stale automation.
Description
Activity
Metadata
Metadata
Assignees
Labels
P1Urgent regression or broken agent/channel workflow affecting real users now.Urgent regression or broken agent/channel workflow affecting real users now.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.User-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.no-staleExempts this issue from stale automation.Exempts this issue from stale automation.
Type
Fields
Priority
None yet
Projects
- StatusShow more project fieldsBacklog
Context
This issue was originally reported in:
openclaw/openclaw#148115
Core triage determined that the Gateway behavior is correct and that the defect belongs to the Windows Companion client maintained in this repository.
The original issue was closed as out-of-repository scope, not because the reported race was considered invalid.
Summary
During Windows Companion startup or reconnect, the operator WebSocket can send RPCs such as
node.list,device.pair.list, ormodels.listbefore the requiredconnecthandshake completes.The Gateway then correctly rejects the request and closes the socket with:
Expected behavior
Application RPCs should only be sent after the operator WebSocket has completed the
connecthandshake and receivedhello-ok.Known-good sequence:
Actual behavior
During reconnects, the operator WebSocket can be open before its protocol handshake is complete.
Another connection event may then trigger an RPC on the operator socket before
connecthas been sent.Observed example:
The
node.listRPC was sent before the operator socket sentconnect.A startup variant was also observed:
Frequency
Historical Companion logs contained 29 occurrences of this
1008 PolicyViolation.node.listdevice.pair.listmodels.listAfter an unrelated WSL lifecycle issue was fixed, a stable 5.5-minute capture showed:
PolicyViolationeventsfirst request must be connectVersion
2026.9.384928c432026.9.24Source-level evidence
The Companion currently exposes gateway readiness as:
IsConnectedToGateway => IsConnectedHowever,
IsConnectedappears to represent WebSocket-open state rather than protocol-handshake completion.A separate handshake state already exists as
_hasHandshakeSnapshot.SendTrackedRequestAsyncalso appears to check socket connectivity without requiringhello-okcompletion.Observed request paths include:
RequestNodesAsyncRequestDevicePairListAsyncmodels.liststartup requestsThis allows RPC admission during the window where the socket is open but the operator handshake has not completed yet.
Possible fix
Gateway readiness could require both socket connectivity and handshake completion, for example:
It may also be useful to add a defensive handshake-readiness guard in tracked RPC send paths so application RPCs cannot be sent before
hello-ok.Gateway behavior
The Gateway appears to be behaving correctly.
It requires the first application frame to be
connect, and rejects other requests with1008 PolicyViolation.The original core triage explicitly identified the Windows Companion as the correct repair location.
Impact
Severity: intermittent reconnect failure / degraded connection reliability.
No data loss was observed.
A failed operator connection is discarded and retried after approximately 4.5 seconds.
During reconnect activity, the Windows Companion may show user-facing states such as:
Authentication failedTransport errorGateway connection failedReproduction
A deterministic current-main reproduction has not yet been performed.
The evidence is based on:
Related issue
openclaw/openclaw#148115
Screenshots
Screenshots below show the user-visible connection/reconnect failure states.