fix(daemon): correct Claude Code --add-dir capability detection (fix β¦#440
Conversation
β¦exu-io#430) Probe 'claude -p --help' (subcommand help) instead of 'claude --help' (global help), because --add-dir and --include-partial-messages are subcommand-specific flags that do not appear in the global help output. Previously, successful capability probing would set caps.addDir = false because the flag was not found in global help, causing the daemon to never pass --add-dir to spawned Claude Code processes. This broke absolute-path reads for skill seeds and design-system specs, as Claude Code's sandbox policy blocks access to paths outside the project cwd unless explicitly allowed via --add-dir. The probing-failure / timeout path already worked correctly (empty caps object defaults to passing --add-dir). The failure manifested only when help probing succeeded and explicitly failed to locate the subcommand flags.
|
Hi @1119302165! π Thanks for the contribution β this is a precise root-cause fix with thorough testing and impact analysis. I will run a deep review and get back to you within 24h. Thanks for making open-design better! |
mrcfps
left a comment
There was a problem hiding this comment.
@1119302165 I reviewed the Claude Code capability-detection change in apps/daemon/src/agents.ts and the added regression coverage in apps/daemon/tests/agents.test.ts. The fix is tightly scoped to probing the claude -p --help subcommand where --add-dir is advertised, and the tests cover the default add-dir behavior, directory filtering, and the root-cause help arguments. I did not find any actionable issues in the changed ranges; thanks for the clear, focused fix and the helpful regression protection. π
|
I've reviewed the changes as promised. @mrcfps's review above covers all the code correctness and test coverage points comprehensively β the fix is tightly scoped and well-protected by regression tests. No additional actionable issues from my end. Thanks for the clear, focused fix! π |
|
π Merged! Thanks @1119302165 for the precise root-cause fix and thorough regression tests. The capability detection now correctly probes Appreciate the clear analysis and careful implementation! π |
Description
This PR fixes issue #430 where Claude Code failed to read skill files due to incorrect directory access policy enforcement.
Root Cause
The Claude Code agent definition was probing global
claude --helpoutput for capability flags, but--add-dirand--include-partial-messagesare subcommand-specific flags that only appear underclaude -p --help, not in the global help output.This caused:
caps.addDir = falsefor users with working Claude Code installations--add-dirflag was therefore never passed on agent spawnImpact Analysis
Scope
helpArgs+ comment. No logic changes to any other agent.helpArgsis stripped before serialization.Execution Paths Affected
execFile('claude', ['--help'])execFile('claude', ['-p', '--help'])buildArgs--add-dirnever passed when probe succeeded--add-dircorrectly passed when detected/api/agentsendpointhelpArgsinternal-only field strippedChanges Made
apps/daemon/src/agents.tshelpArgsto probe subcommand helpapps/daemon/tests/agents.test.tsRegression Protection
Tests added:
--add-dirpropagation when directories are supplied['-p', '--help']is used for probing (prevents regression)Testing
claude --help | grep --add-dirreturns no matchesclaude -p --help | grep --add-dircorrectly finds the flag