Skip to content

fix(ui): login screen reports "Gateway unreachable" when the account has no Gateway access - #159948

Merged
steipete merged 1 commit into
mainfrom
steipete/gateway-unreachable-openclaw-6748f7
Sep 28, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/gateway-unreachable-openclaw-6748f7

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: the Control UI login screen says "Gateway unreachable" and tells people to check whether the Gateway is running when the Gateway is actually up and refusing them because their account has no active access (for example, a newly signed-in teammate whose profile has no role yet on a Gateway whose default role requires an access-policy grant).

User Impact

User impact: a signed-in person without Gateway access now sees "No access to this Gateway" with the next useful step: ask an administrator to assign a role or grant access, with the exact openclaw users list --json command for the administrator. The page still reconnects on its own once access is granted. The server's denial text no longer says "no longer active" to people who never had access.

Why This Change Was Made

The Gateway already rejected these connections deliberately (FORBIDDEN, close 1008, cause operator-access-denied), but sent no structured detail, so the login gate's classifier fell through to its network bucket. The rejection now carries a new OPERATOR_ACCESS_DENIED connect-error detail code, and the login gate keys a dedicated access-denied state on that code rather than on message text. The shared denial message is neutral ("not active for this account … grant or restore access") because the same text serves first-time denial, later revocation (4001), and HTTP 403 paths.

The new code is deliberately not a reconnect-pause code: clients keep their normal backoff, so access granted by an administrator applies without user action. Native clients ignore unknown detail codes and are unchanged.

Release-note context: Control UI now explains Gateway access-policy denials ("No access to this Gateway") instead of reporting the Gateway as unreachable.

Evidence

Observed in production on 2026-09-27: a newly signed-in teammate on a production trusted-proxy Gateway (default role bound to accessPolicyPlugin: "visitor-access", profile had no role yet) had 62 connects refused with code=1008 cause=operator-access-denied while the browser showed "Gateway unreachable". After the administrator assigned the role, the same open tab reconnected by itself within seconds, which is the reconnect behavior this change keeps.

Before/after, rendered by the Control UI E2E harness with a mocked Gateway replaying each era's real rejection (before: old message, no detail; after: new message plus OPERATOR_ACCESS_DENIED). Fixture data only.

Before After
Before: Gateway unreachable After: No access to this Gateway

After, dark theme:

After, dark theme

Focused checks:

  • pnpm test ui/src/components/login-gate.test.ts --maxWorkers=1: 29 passed (4.5 s wall). The new case fails on the original classifier (expected access-denied, received network).
  • pnpm test src/gateway/server.auth.identity-scopes.test.ts --maxWorkers=1: 23 passed. Two existing connect-denial assertions now also require details.code === "OPERATOR_ACCESS_DENIED"; no new Gateway boots or test cases, so the suite's existing ~2.5 min wall is unchanged. Fails without the server detail.
  • pnpm tsgo:core, pnpm tsgo:ui, changed test typecheck shards, pnpm ui:i18n:baseline (unchanged), pnpm ui:i18n:verify, oxfmt, git diff --check: pass.
  • Autoreview (Codex, P0–P2): scoped-clean, patch correct (0.91).

…way unreachable

A signed-in person whose account has no active Gateway access (for example a
profile without a role on a Gateway whose default role requires an access-policy
grant) was refused with FORBIDDEN and close 1008, but the rejection carried no
structured detail, so the login gate fell through to "Gateway unreachable" and
told them to check whether the Gateway was running.

The rejection now carries an OPERATOR_ACCESS_DENIED connect-error detail code,
and the login gate shows "No access to this Gateway" with administrator guidance.
The code stays retryable so the page reconnects on its own once access is
granted. The shared denial message is now neutral for first-time and revoked
access.
@clawsweeper

clawsweeper Bot commented Sep 27, 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 app: web-ui App: web-ui gateway Gateway runtime size: S labels Sep 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: 53427232a8a75a26e3ac74e3fdf310dcf68853b3
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/server/ws-connection/connect-operator-access.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@steipete
steipete enabled auto-merge (squash) September 27, 2026 23:06
@clawsweeper

clawsweeper Bot commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 27, 2026, 7:09 PM ET / 23:09 UTC.

ClawSweeper review

What this changes

The branch adds a structured Gateway access-denial response and uses it to show account-specific recovery guidance on the Control UI login screen.

Merge readiness

✅ Ready for maintainer review

Keep this PR open. Current main and the latest release still classify an operator access denial as a network failure in the Control UI; the proposed fix addresses that distinct, observed problem.

Priority: P2
Reviewed head: 53427232a8a75a26e3ac74e3fdf310dcf68853b3

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused patch and boundary checks are strong, and inspected browser captures demonstrate the UI change within their mocked-Gateway scope.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The Gateway denial detail feeds the login gate; inspected before/after browser screenshots show the changed guidance with a mocked Gateway in light and dark themes. No live after-fix Gateway-to-browser trace is supplied, but the maintainer-author contributor-proof gate does not apply, and no stored-data contract changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The Gateway denial detail feeds the login gate; inspected before/after browser screenshots show the changed guidance with a mocked Gateway in light and dark themes. No live after-fix Gateway-to-browser trace is supplied, but the maintainer-author contributor-proof gate does not apply, and no stored-data contract changes.
Evidence reviewed 11 items Current main denial: The Gateway sends FORBIDDEN without a structured detail for this existing operator-access rejection.
Current main UI fallback: Without a recognized detail, the login classifier reaches its network guidance, including instructions to check whether the Gateway is running.
Introduced response and classifier: The pinned PR diff adds OPERATOR_ACCESS_DENIED to the existing FORBIDDEN response and maps that detail to dedicated Control UI guidance.
Findings None None.
Security None None.

How this fits together

The Gateway authenticates a browser connection and checks the person's current operator access before admitting it. The Control UI turns a rejected connection into login guidance and retries when access is later granted.

flowchart LR
A[Signed-in browser] --> B[Gateway handshake]
B --> C{Operator access policy}
C -->|Denied| D[Structured denial]
D --> E[Control UI login gate]
E --> F[Administrator guidance]
C -->|Granted| G[Connected dashboard]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +34, Tests +25, Docs +7. Total +66 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 5 36 2 +34
Tests 2 27 2 +25
Docs 2 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 70 4 +66

Review metrics

Metric Value Why it matters
Connection recovery vocabulary 1 new protocol detail code; 1 new login failure state The new wire signal gives the UI a specific recovery path without changing the access decision.

Technical review

Best possible solution:

Keep the access decision in the Gateway and present its stable denial signal as administrator-guided login recovery while preserving automatic retry.

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

Yes. A verified user denied by a role-bound access policy follows a source-proven current-main path from an unstructured FORBIDDEN response to the network message; this reviewer did not execute that path.

Is this the best way to solve the issue?

Yes. An additive detail on the existing rejection and a matching UI classification address the misleading message without adding another access-policy owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 9133dc399322.

Labels

Label changes:

  • add P2: This corrects misleading login guidance for role-gated team Gateways while leaving the intentional access denial intact.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The Gateway denial detail feeds the login gate; inspected before/after browser screenshots show the changed guidance with a mocked Gateway in light and dark themes. No live after-fix Gateway-to-browser trace is supplied, but the maintainer-author contributor-proof gate does not apply, and no stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.

Label justifications:

  • P2: This corrects misleading login guidance for role-gated team Gateways while leaving the intentional access denial intact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The Gateway denial detail feeds the login gate; inspected before/after browser screenshots show the changed guidance with a mocked Gateway in light and dark themes. No live after-fix Gateway-to-browser trace is supplied, but the maintainer-author contributor-proof gate does not apply, and no stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • shakkernerd: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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

Copy link
Copy Markdown
Contributor Author

CI note: the first run on head 53427232a8a7 failed one unrelated UI E2E case, ui/src/e2e/chat-flow.history-recovery.e2e.test.ts › "shows persisted user messages after opening History and scrolling mixed history" (job). After a successful connect and a session switch, both history messages existed in the DOM, but the visible-bubble poll stayed false for 10 s.

This PR only changes how a refused connect is classified on the login gate, so it cannot reach that path. The case is green on current main (the latest red main UI E2E shard, run 36371252696, failed a different test, native-plugin-ui.e2e.test.ts). Failed jobs were rerun once. A separate root-cause lane is investigating the history-recovery visibility race and will open its own PR; this PR does not wait on it.

@steipete
steipete merged commit e264eaf into main Sep 28, 2026
337 of 391 checks passed
@steipete
steipete deleted the steipete/gateway-unreachable-openclaw-6748f7 branch September 28, 2026 04:18
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
…way unreachable (openclaw#159948)

A signed-in person whose account has no active Gateway access (for example a
profile without a role on a Gateway whose default role requires an access-policy
grant) was refused with FORBIDDEN and close 1008, but the rejection carried no
structured detail, so the login gate fell through to "Gateway unreachable" and
told them to check whether the Gateway was running.

The rejection now carries an OPERATOR_ACCESS_DENIED connect-error detail code,
and the login gate shows "No access to this Gateway" with administrator guidance.
The code stays retryable so the page reconnects on its own once access is
granted. The shared denial message is now neutral for first-time and revoked
access.
@steipete

Copy link
Copy Markdown
Contributor Author

Follow-up on the history-recovery failure: it was a real product scroll-geometry race that #159924 (ac5891921c34) had already fixed on main after this branch point. When a short prefetched transcript expands, non-smooth automatic follow replaced smooth end-follow and skipped remeasuring rows the virtualizer had deferred, leaving the viewport above the latest reply. Removing only that fix's measurement replay reproduced the same E2E timeout on the first attempt; with it restored the file passed 20/20 standalone and 3/3 in the original co-packed shard. No further change needed.

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 gateway Gateway runtime security-sensitive-changed size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant