Repository navigation
fix: clarify doctor launcher diagnostics and strengthen store checks - #22
Merged
harshsaver merged 1 commit intoSep 11, 2026
Merged
Conversation
harshsaver
approved these changes
Sep 11, 2026
harshsaver
left a comment
Member
There was a problem hiding this comment.
Reviewed the production diff and diagnostics tests against current main. Launcher labels are accurate, filesystem checks remain read-only, and redundant writeChecked state is removed. Local race tests and vet passed; all platform/package CI checks are green.
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
moirai doctorlabels desktop launch programs as ordinary executables, and its troubleshooting documentation says the Unix write-access check always succeeds for root. This follow-up to #19 makes launcher reporting explicit, treats close failures as failed readability checks, simplifies store-kind handling, and expands regression coverage for symlinks, permissions, environment overrides, and JSON omissions.Implementation
launcherin human output. Preserve the programs returned byCommandFor: Cowork usesopenon macOS,cmdon Windows, andclaude-desktopon Linux; Cursor Desktop usescursor.CommandFor(format, SessionRef{})lookup as the sole gate for executable diagnostics.installedstill means only thatexec.LookPathfound the launch program. Amp and Hermes report no executable status, even when similarly named binaries exist.opencode,hermes) instead of coupling the kind check to concrete store implementations.writeCheckedflag. Derive whether a write-status phrase applies from the completed readability check, theSavecapability, and the expected root kind.readable: falseand astore_unreadablewarning.os.Stat→ expected-kind check →os.OpenandClose→ eligible Unix write-access query. Symlinks to legitimate roots are followed; roots identified as FIFOs, sockets, devices, or the wrong kind are rejected before opening.Tests
PATHand fake executables for every supported launch command; verify missing-program warnings and desktop launcher labels.exists,readable, andwritablekeys on stat failure; omitted read/write checks for FIFO roots; no write status for file-backed or source-only stores; Windows write access remains unqueried.APPDATAcase.store_stat_failedwith unknown status. A regular-file target contains invalid database bytes to exercise root-only inspection.formatsfixture captured before the capability formatter extraction.Existing tests continue to cover missing stores with successful command exit, wrong root types, read-only filesystem snapshots, terminal control-character scrubbing, and invalid doctor arguments. Doctor fixtures use temporary homes and stores, clear the store override variables, and replace
PATHwith an isolated fake-bin directory.Documentation
Expand README troubleshooting with the six warning codes and corrective actions, a JSON example, optional-boolean semantics, override precedence, desktop launcher semantics, and the successful exit status for diagnostic warnings.
Explain that Unix writability uses
access(2)withW_OK | X_OKand the process's real user/group credentials, whileos.Openuses effective credentials. The write query is advisory: root can bypass ordinary mode bits, but a read-only filesystem can still reject it. Non-Unix platforms do not query writability; file-backed and source-only stores omit that status.Verification
Run after rebasing onto current upstream
main:go test -race ./...go vet ./...go run honnef.co/go/tools/cmd/staticcheck@2026.1 ./...go build -o /tmp/moirai-doctor-validation/moirai ./cmd/moiraiGOOS=windows GOARCH=amd64 go test -c -o /tmp/moirai-doctor-validation/moirai-windows.test.exe ./cmd/moiraiGOOS=darwin GOARCH=arm64 go test -c -o /tmp/moirai-doctor-validation/moirai-darwin.test ./cmd/moiraiformatsoutput against the originalmainbaseline.git diff --check.Linux tests ran as a non-root user, including the mode-denial cases. Windows and macOS test binaries were cross-compiled, not executed locally. Native zsh/fish completion checks are unavailable in this environment.
Privacy and compatibility
Doctor remains read-only: it inspects and opens/closes store roots without enumerating directories, discovering or loading sessions, parsing transcripts, executing launchers, writing probes, or making network requests. Environment-variable values are not printed separately; the resolved root may still reveal all or part of the active override value. Human paths and warning messages remain terminal-scrubbed; JSON preserves their text.
The JSON field names and optional-value behavior introduced in #19 remain unchanged. Human output now calls desktop programs
launcher, and readability warning text covers both open and close failures. The--json-only flag surface, shell completion,formatsoutput, launch commands, store interfaces/registries, codecs, archive formats, and dependencies are unchanged by this follow-up. No compatibility layer, migration, or stored-data change is introduced.Checklist
closes #10