Skip to content

refactor(gateway): retire the Control UI device-auth migration window - #124667

Merged
steipete merged 3 commits into
mainfrom
steipete/delete-controlui-authmigration
Aug 16, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/delete-controlui-authmigration

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Removes migration debt: the one-time remediation window for the retired gateway.controlUi.dangerouslyDisableDeviceAuth break-glass config. The window threaded a pending/claimed/completed state machine through the gateway connect pipeline, startup bootstrap, lifecycle, request context, device management methods, the security audit, the protocol hello frame, and a dedicated Control UI banner flow — ~1,100 lines of steady-state production code owned by a shipped-once transition. The architecture doctrine places retired-shape handling in doctor, not runtime; this was the largest standing violation of that rule in the auth surface.

Why This Change Was Made

The maintainer decision is that the window is closed. The retired key becomes fully inert: doctor still detects it and doctor --fix removes it (message updated to say so), and an install that set the break-glass but never completed the migration simply pairs its browser through the normal device flow — one approval, no data loss, no lockout. With #124589's silent local scope upgrades landed, local installs self-heal without any prompt at all.

Deleted alongside the state machine, because the migration was their only consumer: the config-machine-state import of the legacy flag, the optional deviceAuthMigration hello field (clients validate envelopes only, so an older gateway still emitting it remains compatible in both directions), the migration-bound device-management authz states, the requireNoPairingCapableOperator approval mode and its forbidden reason, the effective-operator pairing event emitter, and the Control UI banner component, loader, overlay wiring, i18n strings, and mock-gateway e2e scenario support. Swift and Kotlin protocol models regenerated from the schema. One leftover: completed/pending rows under the gateway.controlUi.deviceAuthMigration machine-state key become orphaned KV rows with no reader; they are harmless and not worth a doctor migration.

Tests updated rather than weakened: the build-admission raw-WS proof previously used the migration hook as a side door past device identity — it now signs a real device identity, which is also the more realistic scenario for a stale browser.

User Impact

No behavior change for any current install. Installs still carrying the retired key get a clearer doctor message and normal pairing instead of a remediation banner; every other path is byte-identical. Operators get ~1,100 fewer lines of auth-critical code to hold in their heads.

Evidence

Live, isolated gateway (OPENCLAW_STATE_DIR scratch, port 29441) with the retired key present in config:

Tests: full src/gateway/server/ws-connection/, server.auth.control-ui, src/security/, server-methods/, infra state-migration + device-pairing, and ui/src/app/ suites green (5 shards). Migration-specific test files deleted (server.control-ui-device-auth-migration.test.ts, audit-control-ui-device-auth-migration.test.ts, UI banner e2e); sibling tests updated for the removed states. All tsgo core + test shards clean; type-aware oxlint clean; check-protocol-since and protocol event coverage green; Swift/Kotlin/schema.json regenerated via pnpm protocol:gen*.

Production LOC: net −1,111 (+49/−1,160). Tests +90/−1,451. Docs −19.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 16, 2026 15:28
@steipete
steipete requested a review from a team as a code owner August 16, 2026 15:28
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime security Security documentation commands Command implementations size: XL maintainer Maintainer-authored PR labels Aug 16, 2026
…n window

The one-time remediation window for the retired
gateway.controlUi.dangerouslyDisableDeviceAuth break-glass threaded a pending
state machine through the connect pipeline, startup bootstrap, lifecycle,
request context, device management, security audit, the hello frame, and a
Control UI banner flow — steady-state runtime carrying a retired-shape shim
the architecture reserves for doctor. The window is closed: the retired key
is now fully inert, doctor still detects and removes it, and a browser that
never completed the migration pairs through the normal device flow (one
approval, no data loss).

Deleted with it: the config-machine-state import of the legacy flag, the
hello deviceAuthMigration field (optional; clients validate envelopes only,
so older gateways emitting it stay compatible), the migration-bound device
management authz states, the requireNoPairingCapableOperator approval mode,
the effective-operator pairing event emitter whose only subscriber was the
migration completion, and the Control UI banner, loader, overlay wiring,
i18n strings, and e2e scenario support. Swift and Kotlin protocol models
regenerated.

Live-verified on an isolated gateway with the retired key present in config:
clean boot with no migration warning, silent CLI pairing and silent local
scope widening unaffected, and doctor reporting the key as retired-and-inert.

Net -1111 production LOC.
@steipete
steipete force-pushed the steipete/delete-controlui-authmigration branch from 6bcdcad to dc69615 Compare August 16, 2026 15:30
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 12:16 PM ET / 16:16 UTC.

ClawSweeper review

What this changes

This PR removes the retired Control UI device-auth migration window, making its legacy config key inert while retaining Doctor cleanup and normal device pairing.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No new blocking correctness finding. The prior recovery-path concern is an explicit maintainer-approved trade: legacy device-less Control UI access is retired in favor of secure-context pairing and Doctor cleanup; the other prior findings were addressed on the current head.

Priority: P1
Reviewed head: 3e26df98b1890e67c6783794e539400d2c224b6f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The current head coherently deletes the retired path and addresses the earlier mechanical findings; the remaining behavior change is an explicit maintainer decision.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer PR is exempt from the external-contributor proof gate; its body nevertheless records an isolated after-change Gateway run and pairing observations.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer PR is exempt from the external-contributor proof gate; its body nevertheless records an isolated after-change Gateway run and pairing observations.
Evidence reviewed 8 items Current-main behavior: Current main still admits the bounded device-less migration session when the legacy transition is pending; this is the intentionally retired behavior.
Retired boundary on PR head: The PR head sends a concrete secure-context error for device-less Control UI sessions, rather than preserving the migration exception.
Normal pairing remains the owner: Signed unpaired browsers still create a normal pairing request and return a pairing-required response until approval, preserving the canonical owner boundary.
Findings None None.
Security None None.

How this fits together

The Gateway authenticates Control UI WebSocket connections, verifies browser device identity, and either admits or routes the browser into pairing. The Control UI and Doctor expose the resulting recovery path to operators.

flowchart LR
  A[Control UI browser] --> B[Gateway connection]
  B --> C[Device identity check]
  C --> D{Identity present?}
  D -->|Yes| E[Normal device pairing]
  D -->|No| F[Secure-context guidance]
  E --> G[Authenticated Control UI]
  H[Doctor legacy-key cleanup] --> E
Loading

Before merge

  • Resolve merge risk (P1) - Existing installs that relied on the temporary device-less recovery session must now reopen through HTTPS or localhost for normal pairing, or run Doctor; current main still offers the former session, so this is an intentional compatibility and security-boundary change.
  • Complete next step (P2) - No repair lane is appropriate: the remaining compatibility trade is explicitly maintainer-approved, and the PR only needs normal exact-head validation.
Agent review details

Security

None.

PR surface

Source -1183, Tests -1332, Docs -19, Other -4. Total -2538 across 57 files.

View PR surface stats
Area Files Added Removed Net
Source 37 53 1236 -1183
Tests 14 107 1439 -1332
Docs 4 3 22 -19
Config 0 0 0 0
Generated 0 0 0 0
Other 2 1 5 -4
Total 57 164 2702 -2538

Review metrics

Metric Value Why it matters
Production versus tests production +49/-1,160 (net -1,111); tests +90/-1,451 (net -1,361) The PR removes a large retired runtime state machine while retaining focused coverage for the surviving pairing boundary.
Legacy config behavior 1 retired key changed from temporary recovery to inert Doctor-removable input Existing configurations containing the key take a different upgrade path after merge.
Gateway hello contract 1 optional hello payload removed The protocol change requires compatibility review across stale clients and gateways.

Stored data model

Persistent data-model change detected: migration/backfill/repair: docs/gateway/trusted-proxy-auth.md, migration/backfill/repair: docs/web/control-ui.md, migration/backfill/repair: src/commands/doctor/shared/legacy-config-migrations.runtime.gateway.ts, migration/backfill/repair: src/commands/doctor/shared/legacy-config-migrations.runtime.retired.test.ts, migration/backfill/repair: src/gateway/server-methods/device-management-authz.test.ts, migration/backfill/repair: src/gateway/server-startup-bootstrap.ts, and 22 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Accept the explicit retirement (recommended)
    Land the removal after exact-head checks, accepting that legacy device-less recovery is replaced by secure-context pairing and Doctor cleanup.

Technical review

Best possible solution:

Land the retirement only with the documented secure-context pairing and Doctor removal paths intact, after exact-head checks confirm the merged gateway behavior.

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

Not applicable as a bug reproduction: this is a deliberate retirement. The PR body supplies an isolated post-change Gateway run with the legacy key and normal pairing checks.

Is this the best way to solve the issue?

Yes. The chosen design deletes the retired runtime state machine and keeps legacy-shape handling in Doctor; restoring the device-less session would retain the compatibility exception that maintainer authority explicitly closed.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2404d41de234.

Labels

Label justifications:

  • P1: This changes authentication and recovery behavior for Control UI users with an existing legacy configuration.
  • merge-risk: 🚨 compatibility: The retired config key no longer opens the previous device-less remediation session for upgrading installs.
  • merge-risk: 🚨 security-boundary: The PR removes an authentication migration exception and changes how legacy browsers reach device pairing.
  • 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: This maintainer PR is exempt from the external-contributor proof gate; its body nevertheless records an isolated after-change Gateway run and pairing observations.

Evidence

What I checked:

Likely related people:

  • Jason (Json): The migration state and its device-auth upgrade behavior date to the original preservation commit. (role: introduced the upgrade migration; confidence: high; commits: 7eec1345f98e; files: src/state/control-ui-device-auth-migration.ts, src/gateway/server/ws-connection/connect-auth.ts)
  • steipete: A merged local-pairing change supplies the normal silent local pairing behavior this retirement relies on, and this PR continues that gateway work. (role: recent area contributor; confidence: high; commits: 086f5916fad9; files: src/gateway/server/ws-connection/connect-device-pairing.ts)

Rank-up moves

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

  • Wait for exact-head checks before landing the authentication-boundary change.

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-08-16T15:38:33.967Z sha dc69615 :: found issues before merge. :: [P2] Correct Doctor’s removed browser action | [P2] Stop deriving security state from the retired key | [P2] Remove the retired migration-state contract
  • reviewed 2026-08-16T15:49:20.523Z sha 9f1e702 :: found issues before merge. :: [P1] Preserve recovery for persisted pending upgrades | [P2] Stop reporting the retired key as device-auth state | [P3] Clean up the temporary device-identity database

The doctor migration for the retired key kept its "Preserved for remediation"
change text and describe; both now state plain removal, with the retired
tests updated. peekStoredDeviceIdentityId lost its only production consumer
with the deleted banner loader and is removed with its test mock. Also fixes
the unrelated no-unnecessary-boolean-literal-compare lint break that #124636
landed on main in scripts/check-changed.mts (truthiness is equivalent for the
boolean-or-undefined TTY probe).
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Aug 16, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 16, 2026
…mmary

Review findings on the migration-window removal: the Control UI security
summary still derived its "Device auth" row from the retired
dangerouslyDisableDeviceAuth key, rendering device auth as disabled on
configurations that merely retain the inert key. Device auth is now
unconditionally enforced, so the row and its derivation are removed rather
than pinned to a constant. The build-admission test also tracks and removes
its temporary device-identity databases after each run.
@steipete

Copy link
Copy Markdown
Contributor Author

Review findings addressed at 3e26df9:

  • P2 (stale device-auth reader): fixed — the Control UI security summary no longer derives a "Device auth" row from the retired key; the row, its SecurityOverview field, i18n string, and settings-search target are removed, with the UI tests updated.
  • P3 (temp identity databases): fixed — the build-admission test tracks each temporary identity path and removes the SQLite file plus WAL/SHM siblings in afterEach.
  • P1 (persisted pending-upgrade recovery): intentionally skipped under explicit maintainer authority. The maintainer's decision in this change is that the remediation window is closed: the retired key becomes fully inert and affected browsers pair through the normal device flow. The old path's "Secure this browser" completion itself required reopening over HTTPS/localhost; the replacement flow requires exactly the same secure context and ends in the same paired state — the only removed capability is the interim device-less read-only session, which is the accepted trade. Doctor still detects and strips the key.

@clawsweeper clawsweeper Bot added 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 16, 2026
@steipete
steipete merged commit bdcc683 into main Aug 16, 2026
231 checks passed
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete
steipete deleted the steipete/delete-controlui-authmigration branch August 16, 2026 16:39
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 17, 2026
…openclaw#124667)

* refactor(gateway): delete the retired Control UI device-auth migration window

The one-time remediation window for the retired
gateway.controlUi.dangerouslyDisableDeviceAuth break-glass threaded a pending
state machine through the connect pipeline, startup bootstrap, lifecycle,
request context, device management, security audit, the hello frame, and a
Control UI banner flow — steady-state runtime carrying a retired-shape shim
the architecture reserves for doctor. The window is closed: the retired key
is now fully inert, doctor still detects and removes it, and a browser that
never completed the migration pairs through the normal device flow (one
approval, no data loss).

Deleted with it: the config-machine-state import of the legacy flag, the
hello deviceAuthMigration field (optional; clients validate envelopes only,
so older gateways emitting it stay compatible), the migration-bound device
management authz states, the requireNoPairingCapableOperator approval mode,
the effective-operator pairing event emitter whose only subscriber was the
migration completion, and the Control UI banner, loader, overlay wiring,
i18n strings, and e2e scenario support. Swift and Kotlin protocol models
regenerated.

Live-verified on an isolated gateway with the retired key present in config:
clean boot with no migration warning, silent CLI pairing and silent local
scope widening unaffected, and doctor reporting the key as retired-and-inert.

Net -1111 production LOC.

* fix(ci): finish migration-window cleanup surfaced by the gates

The doctor migration for the retired key kept its "Preserved for remediation"
change text and describe; both now state plain removal, with the retired
tests updated. peekStoredDeviceIdentityId lost its only production consumer
with the deleted banner loader and is removed with its test mock. Also fixes
the unrelated no-unnecessary-boolean-literal-compare lint break that openclaw#124636
landed on main in scripts/check-changed.mts (truthiness is equivalent for the
boolean-or-undefined TTY probe).

* fix(ui): drop the retired-key device-auth reader from the security summary

Review findings on the migration-window removal: the Control UI security
summary still derived its "Device auth" row from the retired
dangerouslyDisableDeviceAuth key, rendering device auth as disabled on
configurations that merely retain the inert key. Device auth is now
unconditionally enforced, so the row and its derivation are removed rather
than pinned to a constant. The build-admission test also tracks and removes
its temporary device-identity databases after each run.
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 commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts security Security documentation size: XL 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.

1 participant