fix(doctor): catch EACCES on shell completion install so optional step does not fail doctor --fix#99300
Conversation
…p does not fail doctor --fix When shell profile files (e.g. ~/.bashrc) are read-only, installCompletion throws EACCES, which propagates up from doctorShellCompletion and causes the entire doctor --fix run to exit with code 1. Shell completion is an optional step — a failed install should not block the rest of doctor. Wrap both installCompletion call sites in try-catch so a non-writable profile logs a friendly message and continues instead of crashing the run. Fixes openclaw#99237
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: #99341 now covers the same doctor shell-completion EACCES bug with sufficient real terminal proof and stronger filesystem regression tests, while this branch still has mock-only proof and an ineffective regression test. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Review and land one canonical doctor-boundary fix, currently best represented by #99341, then let #99237 close on merge. So I’m closing this here and keeping the remaining discussion on #99341 and #99237. Review detailsBest possible solution: Review and land one canonical doctor-boundary fix, currently best represented by #99341, then let #99237 close on merge. Do we have a high-confidence way to reproduce the issue? Yes. The linked issue provides concrete EACCES logs, and current main still routes doctorShellCompletion to installCompletion without catching profile write failures. Is this the best way to solve the issue? No for this branch. The doctor boundary is the right fix location, but the stronger canonical path is the proof-positive overlapping PR with real filesystem coverage. Security review: Security review cleared: The diff only changes local doctor CLI error handling and a unit test, with no dependency, workflow, credential, or supply-chain surface added. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against c5afa92c1f8a. |
… handling Add a test that verifies doctorShellCompletion does not throw when installCompletion fails with EACCES. The test mocks installCompletion to reject with an EACCES error and confirms the function resolves gracefully with no thrown exception.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Superseded by #99540, landed in The canonical fix narrows recovery to wrapped Thanks @yplongapp for working on this bug. |
What Problem This Solves
openclaw doctor --fixexits with code 1 when shell completion install fails on a read-only shell profile (EACCES). Shell completion setup is an optional step — a non-writable profile should not block the rest of the doctor run.Observed error:
Why This Change Was Made
Wrap both
installCompletioncall sites indoctorShellCompletionin try-catch blocks. On EACCES (or any install failure), log a friendly message telling the user to run completion install manually after fixing permissions, then continue instead of crashing.Changes
src/commands/doctor-completion.ts: Wrap twoinstallCompletioncalls in try-catch (+20/-4)src/commands/doctor-completion.test.ts: Add regression test for EACCES handling (+31/-1)Real behavior proof
Behavior addressed: doctor --fix no longer exits 1 when shell completion install fails on read-only profile.
Environment tested: Node 22.x on Linux
Steps run after the patch: Ran focused unit test and compilation check
Evidence after fix:
Test output (5/5 passed):
Observed result: All 5 tests pass. The new EACCES test mocks installCompletion to reject with EACCES and verifies doctorShellCompletion resolves gracefully instead of throwing.
Not tested: Live EACCES scenario with read-only ~/.bashrc on a real system.
Fixes #99237