fix(devices): refresh paired device last-seen metadata#81189
fix(devices): refresh paired device last-seen metadata#81189vyctorbrzezowski wants to merge 1 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed May 29, 2026, 12:55 AM ET / 04:55 UTC. Summary PR surface: Source +10, Tests +20. Total +30 across 4 files. Reproducibility: yes. source-level: current main accepts device-token auth but only refreshes token Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep this focused implementation path, then merge after redacted real gateway/device-token reconnect or installed pairing proof confirms paired metadata updates in an actual setup. Do we have a high-confidence way to reproduce the issue? Yes, source-level: current main accepts device-token auth but only refreshes token Is this the best way to solve the issue? Yes for the central timestamp bug: the PR uses existing paired-device metadata persistence after successful auth/reconnect without changing pairing approval, token verification, scopes, config, or protocol. The later TTL cleanup/read-retry ideas from the linked discussion would be separate follow-up work if maintainers want them. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 59cec74d89ff. Label changesLabel justifications:
Evidence reviewedPR surface: Source +10, Tests +20. Total +30 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
|
This pull request has been automatically marked as stale due to inactivity. |
|
ClawSweeper PR egg: ✨ hatched 🥚 common Pearl Clawlet. Rarity: 🥚 common. Trait: sleeps inside passing CI. DetailsShare on X: post this hatch
About:
|
4322db2 to
a1668d9
Compare
a1668d9 to
447e069
Compare
Refresh paired-device last-seen metadata on successful device-token auth, paired reconnect, and first silent auto-approved connect. Centralize approved paired-device record construction so normal and bootstrap approvals preserve existing last-seen state unless the gateway passes explicit access metadata. Fixes #81169. Supersedes #81189. Proof: - node scripts/run-vitest.mjs src/infra/device-pairing.test.ts --reporter=verbose - node scripts/run-vitest.mjs src/gateway/server.auth.control-ui.test.ts --reporter=verbose - git diff --check - pnpm exec oxfmt --check --threads=1 src/infra/device-pairing.ts src/infra/device-pairing.test.ts src/gateway/server/ws-connection/message-handler.ts src/gateway/server.auth.control-ui.suite.ts - pnpm check:changed passed before final rebase; post-rebase rerun blocked before checks by local Crabbox 0.21.0 needing >=0.22.0 - autoreview clean: .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main Known unrelated CI failure on latest origin/main/PR base: extensions/discord/src/monitor/gateway-plugin.ts TS2367 in check-prod-types/check-lint/check-test-types/extension-channel checks. Co-authored-by: vyctorbrzezowski <krzyszchweski@gmail.com>
|
Thanks @vyctorbrzezowski. I landed this fix through the maintainer follow-up PR #88607 so we could include the first silent auto-approved connect path and centralize approved paired-device record construction. Landed commit: 703fae1 Your original device-token and reconnect fix was preserved and credited in the landed squash commit. |
Refresh paired-device last-seen metadata on successful device-token auth, paired reconnect, and first silent auto-approved connect. Centralize approved paired-device record construction so normal and bootstrap approvals preserve existing last-seen state unless the gateway passes explicit access metadata. Fixes openclaw#81169. Supersedes openclaw#81189. Proof: - node scripts/run-vitest.mjs src/infra/device-pairing.test.ts --reporter=verbose - node scripts/run-vitest.mjs src/gateway/server.auth.control-ui.test.ts --reporter=verbose - git diff --check - pnpm exec oxfmt --check --threads=1 src/infra/device-pairing.ts src/infra/device-pairing.test.ts src/gateway/server/ws-connection/message-handler.ts src/gateway/server.auth.control-ui.suite.ts - pnpm check:changed passed before final rebase; post-rebase rerun blocked before checks by local Crabbox 0.21.0 needing >=0.22.0 - autoreview clean: .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main Known unrelated CI failure on latest origin/main/PR base: extensions/discord/src/monitor/gateway-plugin.ts TS2367 in check-prod-types/check-lint/check-test-types/extension-channel checks. Co-authored-by: vyctorbrzezowski <krzyszchweski@gmail.com>
Refresh paired-device last-seen metadata on successful device-token auth, paired reconnect, and first silent auto-approved connect. Centralize approved paired-device record construction so normal and bootstrap approvals preserve existing last-seen state unless the gateway passes explicit access metadata. Fixes openclaw#81169. Supersedes openclaw#81189. Proof: - node scripts/run-vitest.mjs src/infra/device-pairing.test.ts --reporter=verbose - node scripts/run-vitest.mjs src/gateway/server.auth.control-ui.test.ts --reporter=verbose - git diff --check - pnpm exec oxfmt --check --threads=1 src/infra/device-pairing.ts src/infra/device-pairing.test.ts src/gateway/server/ws-connection/message-handler.ts src/gateway/server.auth.control-ui.suite.ts - pnpm check:changed passed before final rebase; post-rebase rerun blocked before checks by local Crabbox 0.21.0 needing >=0.22.0 - autoreview clean: .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main Known unrelated CI failure on latest origin/main/PR base: extensions/discord/src/monitor/gateway-plugin.ts TS2367 in check-prod-types/check-lint/check-test-types/extension-channel checks. Co-authored-by: vyctorbrzezowski <krzyszchweski@gmail.com>
Refresh paired-device last-seen metadata on successful device-token auth, paired reconnect, and first silent auto-approved connect. Centralize approved paired-device record construction so normal and bootstrap approvals preserve existing last-seen state unless the gateway passes explicit access metadata. Fixes openclaw#81169. Supersedes openclaw#81189. Proof: - node scripts/run-vitest.mjs src/infra/device-pairing.test.ts --reporter=verbose - node scripts/run-vitest.mjs src/gateway/server.auth.control-ui.test.ts --reporter=verbose - git diff --check - pnpm exec oxfmt --check --threads=1 src/infra/device-pairing.ts src/infra/device-pairing.test.ts src/gateway/server/ws-connection/message-handler.ts src/gateway/server.auth.control-ui.suite.ts - pnpm check:changed passed before final rebase; post-rebase rerun blocked before checks by local Crabbox 0.21.0 needing >=0.22.0 - autoreview clean: .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main Known unrelated CI failure on latest origin/main/PR base: extensions/discord/src/monitor/gateway-plugin.ts TS2367 in check-prod-types/check-lint/check-test-types/extension-channel checks. Co-authored-by: vyctorbrzezowski <krzyszchweski@gmail.com>
Summary
lastSeenAtMsandlastSeenReasonwhen accepted device-token auth succeeds.lastSeenReason: "connect"through the existing paired metadata update path.Real behavior proof
Behavior addressed: Accepted paired-device auth now refreshes device-level last-seen metadata so stale paired clients can be audited.
Real environment tested: Local OpenClaw source checkout at PR head on macOS, using isolated temporary pairing state from the focused Vitest/gateway harness.
Exact steps or command run after this patch: Ran the focused paired-device auth and gateway reconnect tests after applying the patch.
Evidence after fix: Terminal output from the focused tests:
Observed result after fix: The pairing test confirmed accepted device-token verification writes numeric
lastSeenAtMsandlastSeenReason: "device-token-auth"; the gateway auth matrix confirmed a successful reconnect writeslastSeenReason: "connect"with numericlastSeenAtMs.What was not tested: No physical mobile client or installed user pairing state was used; the proof uses OpenClaw's isolated pairing and gateway harnesses.
Verification
pnpm exec oxfmt --check --threads=1 src/infra/device-pairing.ts src/gateway/server/ws-connection/message-handler.ts src/infra/device-pairing.test.ts src/gateway/server.auth.control-ui.suite.tsgit diff --checknode scripts/run-vitest.mjs src/infra/device-pairing.test.ts --reporter=verbosenode scripts/run-vitest.mjs src/gateway/server.auth.control-ui.test.ts --reporter=verbosepnpm check:changed.agents/skills/autoreview/scripts/autoreview --mode local(clean: no accepted/actionable findings)