fix(rpc): allow root path in bash handler for CLI detection
Previous behavior:
- Bash handler validated all cwd paths against working directory
- validatePath("/", workingDir) failed security check (/ outside working dir)
- CLI detection command sent with cwd="/" was rejected
- Handler returned { success: false, error: "Access denied..." } immediately
- Never executed "command -v claude/codex/gemini"
- GUI received failure, set all cliAvailability to null (unknown)
- Profile greying used wrong logic: codex profiles enabled, claude greyed
What changed:
- registerCommonHandlers.ts:157: Add special case for cwd="/" in validation
- registerCommonHandlers.ts:169: Map cwd="/" to undefined (shell default)
- registerCommonHandlers.ts:172: Log actual cwd value used in options
- registerCommonHandlers.ts:173-186: Add complete result logging (executing, result)
- registerCommonHandlers.ts:204-224: Add timeout and error logging
- RpcHandlerManager.ts:72-77: Add handler call/return/response logging
- codexMcpClient.ts:21-48: Return null when codex not installed (conservative)
- codexMcpClient.ts:92-105: Add clear error when codex CLI missing
Why:
- CLI detection needs to run with shell default PATH (cwd="/")
- Security preserved: all non-root paths still validated
- Follows Node.js convention: undefined cwd = shell default
- Enables proper CLI detection for claude, codex, gemini
Files affected:
- src/modules/common/registerCommonHandlers.ts: Path validation special case + logging
- src/api/rpc/RpcHandlerManager.ts: RPC lifecycle logging
- src/codex/codexMcpClient.ts: Null return on detection failure + clear error
Testable:
- Open new session wizard in GUI
- Daemon log shows: "Shell command executing... { cwd: undefined }"
- Daemon log shows: "Shell command result: { success: true, exitCode: 0 }"
- GUI console shows: "Parsed CLI status: { claude: true, codex: false, ... }"
- Claude profiles enabled, codex profiles greyed with warning banner A
Andrew Hundt committed
17c44aa2ea35c876026d4bca1e139937dd7f7e9c
Parent: a42d0b6