fix(doctor): avoid impossible device token rotation advice#77688
fix(doctor): avoid impossible device token rotation advice#77688obviyus merged 3 commits intoopenclaw:mainfrom
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. Current main's local cached auth branch can print rotate advice for an unapproved role with no paired token, while the gateway rotation path rejects roles outside the approved pairing contract. Real behavior proof Next step before merge Security Review detailsBest possible solution: Merge the narrow doctor messaging, regression test, and changelog change after required checks pass while preserving the existing rotation authorization contract. Do we have a high-confidence way to reproduce the issue? Yes. Current main's local cached auth branch can print rotate advice for an unapproved role with no paired token, while the gateway rotation path rejects roles outside the approved pairing contract. Is this the best way to solve the issue? Yes. The PR changes only the unapproved no-token doctor guidance branch and keeps rotate advice for approved stale-token and stale-scope cases, which is the narrow maintainable fix. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 5a8ccb6fe0ef. |
|
Added both requested pieces:
The proof run confirms the doctor warning still appears for the stale local cache, but no longer suggests |
bd05539 to
809092f
Compare
809092f to
606408b
Compare
obviyus
left a comment
There was a problem hiding this comment.
Verified the doctor device-pairing path no longer suggests openclaw devices rotate --role <role> when the cached local role is no longer approved by the gateway pairing record.
Maintainer follow-up: rebased onto latest main and moved the changelog note to the end of the active Fixes block with the PR reference.
Local gate: pnpm test src/commands/doctor-device-pairing.test.ts, plus targeted format/changelog/diff checks.
|
Landed on main. Thanks @Conan-Scott. |
…ainer-hardening * origin/main: (843 commits) docs(changelog): relocate openclaw#77046 and openclaw#77280 entries from 2026.5.3 to Unreleased (openclaw#77728) docs: reorder unreleased changelog fix: expose ollama thinking profile before activation (openclaw#77617) (thanks @yfge) fix: expose ollama thinking profile before activation test(gateway): preserve dispatch timers in waiter test(gateway): keep startup context timer live docs: document cache-friendly activity helper ci: install ffmpeg for Mantis media previews fix: avoid impossible device token rotation advice (openclaw#77688) (thanks @Conan-Scott) docs(changelog): note doctor device pairing advice fix fix(doctor): avoid impossible device token rotation advice ci: use Crabbox media previews for Mantis docs: filter maintainer-owned triage noise test: cover GitHub activity helper fix(session-file-repair): drop null-role message entries instead of preserving them (openclaw#77288) fix: prune orphan session artifacts perf: reduce GitHub activity cache misses fix: cache session list model resolution (openclaw#77650) (thanks @ragesaq) ci: embed Mantis desktop previews fix(replay-history): drop trailing stream-error placeholder before provider send (openclaw#77287) ... # Conflicts: # CHANGELOG.md
Summary
openclaw doctorcould adviseopenclaw devices rotate --role <role>for a stale local cached device-auth role that the gateway pairing record no longer approves.device token rotation denied, sending the user down the wrong recovery path.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
nodeauth on a device currently approved only asoperator.Regression Test Plan (if applicable)
src/commands/doctor-device-pairing.test.tsidentity/device-auth.jsonhas cachednodeauth for a device whose gateway pairing record is approved only asoperator; doctor warns about the stale local auth but does not suggest--role noderotation.User-visible / Behavior Changes
openclaw doctorgives different recovery advice for stale local cached device auth when the cached role is no longer approved. Instead of recommending an impossible token rotation, it says the role is no longer approved and suggests reconnecting shared gateway auth or removing the stale cached role entry.Diagram (if applicable)
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation: N/ARepro + Verification
Environment
identity/device-auth.jsonwith cachednoderole; gateway pairing record for same device approved asoperatoronlySteps
operatoronly.nodetoken inidentity/device-auth.jsonfor the same device.openclaw doctor.Expected
nodeauth.openclaw devices rotate --role node, because that role is not approved and rotation will be denied.Actual
openclaw devices rotate --role nodeeven though the gateway pairing record did not approvenodefor that device.device token rotation denied.Real behavior proof
openclaw doctorshould not suggestopenclaw devices rotate --role nodewhen local cachednodedevice auth exists but the gateway pairing record no longer approves thenoderole for that device.node scripts/run-node.mjs doctor) against copied real local OpenClaw pairing/auth state. The copied state restored stale cachednodeauth from/tmp/openclaw-device-auth-backup-20260505-142808.jsonand used the current gateway pairing store for devicedfe20bd46232a79ecf28cefa5adc9777f699d8cb4f1e358cab3ac2175704848a, which is approved asoperatoronly.openclaw doctorrun:Additional proof checks from that same captured output:
nodeauth, but the after-fix output no longer suggestsopenclaw devices rotate --role node; it instead says the role is no longer approved and points to refreshing/removing stale local auth.Evidence
Attach at least one:
Added regression test:
does not suggest rotating local auth for a role that is no longer approvedLocal verification:
pnpm exec oxfmt --check src/commands/doctor-device-pairing.ts src/commands/doctor-device-pairing.test.tsnode scripts/run-vitest.mjs run --config test/vitest/vitest.commands.config.ts src/commands/doctor-device-pairing.test.tsgit diff --checknode scripts/check-changelog-attributions.mjsReal behavior proof from my setup:
I ran this branch's real
openclaw doctorcommand against a copy of my local device-pairing state with the stale cachednodeauth restored. The gateway pairing record for the same device is operator-only, matching the field report that produced the bad advice.Command shape:
Relevant after-fix doctor output:
Proof checks from that run:
node scripts/check-changelog-attributions.mjsopenclaw doctorrun via this branch against a copy of my local device-pairing setup containing the stale cachednoderoleHuman Verification (required)
openclaw doctoroutput from a copied local pairing setup no longer suggests--role nodedoctor-device-pairing.tsconfirmed rotate guidance remains valid for approved-role stale token/scope cases--role noderotation adviceReview Conversations
No review conversations have been addressed yet.
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations