Repository navigation
refactor(gateway): retire the Control UI device-auth migration window - #124667
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
…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.
6bcdcad to
dc69615
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 12:16 PM ET / 16:16 UTC. ClawSweeper reviewWhat this changesThis 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 readinessNo 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 Review scores
Verification
How this fits togetherThe 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
Before merge
Agent review detailsSecurityNone. PR surfaceSource -1183, Tests -1332, Docs -19, Other -4. Total -2538 across 57 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest 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. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
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).
…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.
|
Review findings addressed at 3e26df9:
|
|
Merged via squash.
|
…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.
What Problem This Solves
Removes migration debt: the one-time remediation window for the retired
gateway.controlUi.dangerouslyDisableDeviceAuthbreak-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 --fixremoves 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
deviceAuthMigrationhello field (clients validate envelopes only, so an older gateway still emitting it remains compatible in both directions), the migration-bound device-management authz states, therequireNoPairingCapableOperatorapproval 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 thegateway.controlUi.deviceAuthMigrationmachine-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_DIRscratch, port 29441) with the retired key present in config:[gateway] ready, no migration warning, no crash.nodes listpairs atoperator.pairing); silent local scope widening works (gateway call node.listwidens to+operator.read) — the fix(gateway): local devices stall on scope upgrade pending approval despite autoApproveLocal #124589 behavior is unaffected.openclaw doctorreportsgateway.controlUi.dangerouslyDisableDeviceAuth is retired and ignored….Tests: full
src/gateway/server/ws-connection/,server.auth.control-ui,src/security/,server-methods/,infrastate-migration + device-pairing, andui/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-sinceand protocol event coverage green; Swift/Kotlin/schema.json regenerated viapnpm protocol:gen*.Production LOC: net −1,111 (+49/−1,160). Tests +90/−1,451. Docs −19.