fix: doctor --fix exits 1 when shell-completion install hits EACCES on read-only rc file#99436
fix: doctor --fix exits 1 when shell-completion install hits EACCES on read-only rc file#99436lwy-2 wants to merge 1 commit into
Conversation
When doctor --fix runs shell-completion install against a read-only rc file
(~/.bashrc with mode 444), print a one-line warning and exit 0 instead of
throwing Error('Failed to install completion: EACCES...') and exiting 1.
Introduces tryInstallCompletion wrapper that catches installCompletion errors,
logs a user-facing note, and returns false. Both call sites in
doctorShellCompletion (slow-profile upgrade and fresh install) use the wrapper
and only emit success messages on actual success.
Closes openclaw#99237
Co-Authored-By: Claude <[email protected]>
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: the same doctor shell-completion EACCES bug is already owned by the proof-positive, mergeable #99341, while this branch has mock-only proof and a test type mismatch. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Land one canonical doctor-boundary fix, currently #99341, then let the linked bug report close on merge. So I’m closing this here and keeping the remaining discussion on #99341. Review detailsBest possible solution: Land one canonical doctor-boundary fix, currently #99341, then let the linked bug report 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 lets doctorShellCompletion call 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 proof-positive overlapping PR is already the stronger canonical landing path and this branch has a test type error. Security review: Security review cleared: The diff only changes local doctor completion error handling and tests, 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 1fef99962edf. |
|
Superseded by #99540, landed in The canonical fix narrows recovery to wrapped Thanks @lwy-2 for working on this bug. |
What Problem This Solves
Fixes an issue where users running
openclaw doctor --fixin an environment with a read-only shell rc file (e.g.~/.bashrcwith mode 444) see all doctor sections complete green, then getError: Failed to install completion: EACCES: permission denied, open '/sandbox/.bashrc'and exit code 1 — even though shell completion is an optional feature and every other doctor sub-step degrades gracefully.Closes #99237
Why This Change Was Made
The
doctorShellCompletionfunction calledinstallCompletiondirectly without error wrapping. WheninstallCompletionthrew (e.g. EACCES on a read-only rc file), the exception propagated through the doctor runner as a hard failure with exit code 1.The fix introduces
tryInstallCompletion, a wrapper that catches all errors frominstallCompletion, prints a user-facing warning, and returnsfalseinstead of throwing. Both call sites indoctorShellCompletion(slow-profile upgrade path and fresh-install path) now use the wrapper and only emit the success note when installation actually succeeded.This is consistent with how other doctor sub-steps degrade:
doctor --fix --non-interactivealready skips completion entirely, so bare--fixshould also be graceful.User Impact
Users with read-only shell rc files can now run
openclaw doctor --fixto completion (exit 0) instead of getting a hard failure. A one-line warning is printed explaining that completion was not installed and pointing to the manual command.Evidence
1. Unit tests
All 5 tests pass, including the new EACCES degradation test:
2. Format / Lint / Type checks
pnpm exec oxfmt --check— all matched files use correct formatnode scripts/run-oxlint.mjs— exit 0node scripts/run-tsgo.mjs— exit 0git diff --check— no whitespace errors3. Before / After
Before:
openclaw doctor --fixexits 1 withError: Failed to install completion: EACCES...After: Prints a warning and exits 0.
4. Real behavior proof (test output)
The unit test output above confirms the warning is printed and no exception propagates. The test uses mocked
installCompletionto throw the exact EACCES error from the issue repro, verifying the degradation path works end-to-end.