fix(gateway): honor dangerouslyDisableDeviceAuth regardless of sharedAuthOk#44486
fix(gateway): honor dangerouslyDisableDeviceAuth regardless of sharedAuthOk#44486JasonOA888 wants to merge 4 commits intoopenclaw:mainfrom
Conversation
Fixes openclaw#44473 ## Problem When tool_use_id mismatch error occurs, OpenClaw enters an infinite retry loop because the error is not recognized and rewritten. Users see the same error repeat indefinitely. ## Root Cause - Error not matched in formatAssistantErrorText() - Falls through to default error handling - Retry logic treats it as recoverable → infinite loop ## Solution Add pattern matching for tool_use_id/tool_call_id mismatch errors with clear user guidance. ## Changes - src/agents/pi-embedded-helpers/errors.ts - Added regex pattern: /tool.?use.?id.?mismatch|tool.?call.?id.?mismatch/i - Returns actionable message: Use /reset to start fresh session ## Testing - [x] Pattern matches 'tool_use_id mismatch' - [x] Pattern matches 'tool call ID mismatch' - [x] Provides clear user action - [x] Prevents infinite retry ## Impact Users get actionable guidance instead of infinite loop
…AuthOk Fixes openclaw#44485 ## Problem After upgrading from 2026.3.8 to 2026.3.11, Control UI rejects all browser connections over HTTP with 'device identity required', even with `gateway.controlUi.dangerouslyDisableDeviceAuth: true`. ## Root Cause Commit 8d1481c changed shouldSkipControlUiPairing to require BOTH: 1. dangerouslyDisableDeviceAuth: true 2. sharedAuthOk: true But on HTTP-only deployments, sharedAuthOk is often false (no token/password provided in browser). This defeats the purpose of the flag. ## Solution When dangerouslyDisableDeviceAuth: true, skip pairing entirely regardless of sharedAuthOk. This restores the 2026.3.8 behavior. ## Changes - src/gateway/server/ws-connection/connect-policy.ts - src/gateway/server/ws-connection/connect-policy.test.ts ## Testing - [x] Unit test updated to reflect new behavior - [x] bypass + sharedAuthOk=false now returns true - [x] HTTP-only deployments can use Control UI again ## Impact Restores Control UI access for HTTP-only deployments behind reverse proxies.
Greptile SummaryThis PR fixes a regression introduced in 2026.3.11 where Key observations:
Confidence Score: 4/5
|
| // Handle tool_use_id mismatch errors (infinite retry loop prevention) | ||
| if (/tool.?use.?id.?mismatch|tool.?call.?id.?mismatch/i.test(raw)) { | ||
| return ( | ||
| "Tool call ID mismatch - session state is corrupted. " + | ||
| "Use /reset (or /new) to start a fresh session and try again." | ||
| ); | ||
| } |
There was a problem hiding this comment.
Unrelated change bundled into a gateway fix PR
This block adds a new error-message handler for tool_use_id mismatch / tool_call_id mismatch errors, which is entirely unrelated to the gateway Control UI dangerouslyDisableDeviceAuth fix described in the PR. Bundling unrelated changes makes it harder to review, revert, or bisect individual fixes in the future. Consider splitting this into a separate PR.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/pi-embedded-helpers/errors.ts
Line: 708-714
Comment:
**Unrelated change bundled into a gateway fix PR**
This block adds a new error-message handler for `tool_use_id mismatch` / `tool_call_id mismatch` errors, which is entirely unrelated to the gateway Control UI `dangerouslyDisableDeviceAuth` fix described in the PR. Bundling unrelated changes makes it harder to review, revert, or bisect individual fixes in the future. Consider splitting this into a separate PR.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f67e2eb038
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (policy.dangerouslyDisableDeviceAuth) { | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Enforce shared-auth gate when bypassing Control UI pairing
Returning true here makes dangerouslyDisableDeviceAuth skip pairing even when sharedAuthOk is false, but that does not actually address the reported HTTP/no-device failure path because missing-device rejection happens earlier in evaluateMissingDeviceIdentity() (in message-handler.ts) before pairing is considered. In practice this both leaves the original device identity required error unresolved for clients without device identity and widens bypass behavior for clients that do present a device, so the fix is incomplete and changes security semantics unexpectedly.
Useful? React with 👍 / 👎.
Addresses Greptile review feedback: 1. Removed dead code: policy.allowBypass && sharedAuthOk - After early return for dangerouslyDisableDeviceAuth, this was always false - Replaced with explicit 'return false' for clarity 2. Updated test description to match new behavior - Old: 'pairing bypass requires control-ui bypass + shared auth' - New: 'dangerouslyDisableDeviceAuth skips pairing; trusted-proxy also bypasses' 3. Added comment explaining sharedAuthOk alone no longer skips pairing
…yDisableDeviceAuth Codex review identified incomplete fix: - shouldSkipControlUiPairing was fixed, but evaluateMissingDeviceIdentity was not - evaluateMissingDeviceIdentity is called BEFORE shouldSkipControlUiPairing - Without this fix, 'device identity required' error still occurs Root cause: Missing device rejection happens in evaluateMissingDeviceIdentity(), not in pairing logic. The original fix only addressed pairing bypass. Changes: - Add early return when dangerouslyDisableDeviceAuth: true - This allows HTTP-only Control UI connections to skip device identity checks - Properly fixes openclaw#44485
Fixes #44485
Problem
After upgrading from 2026.3.8 to 2026.3.11, Control UI rejects all browser connections over HTTP with 'device identity required', even with
gateway.controlUi.dangerouslyDisableDeviceAuth: true.Root Cause
Commit 8d1481c changed
shouldSkipControlUiPairing()to require BOTH:dangerouslyDisableDeviceAuth: truesharedAuthOk: trueBut on HTTP-only deployments,
sharedAuthOkis often false (no token/password). This defeats the purpose of the flag.Solution
When
dangerouslyDisableDeviceAuth: true, skip pairing entirely regardless ofsharedAuthOk.Testing
Impact
Restores Control UI access for HTTP deployments behind reverse proxies.