fix: remove empty --allowedTools arg that breaks Claude Code ask mode#46
fix: remove empty --allowedTools arg that breaks Claude Code ask mode#46yicheny wants to merge 1 commit intoDoctor-wu:mainfrom
Conversation
Claude Code 2.1.80 treats the empty string from `--allowedTools ""` as the positional prompt argument, causing the actual prompt to be silently dropped and producing: Error: Input must be provided either through stdin or as a prompt argument when using --print Remove the empty `--allowedTools` flag from ask-mode args so the prompt is passed correctly. Fixes Doctor-wu#45
📝 WalkthroughWalkthroughThe changes fix a bug in Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can disable poems in the walkthrough.Disable the |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/core/src/agent/__tests__/session.test.ts (1)
74-74: Add a direct assertion against empty string args.Line 74 verifies the flag is gone, but the original failure mode also depended on an empty positional token. Add a guard for
''to make the regression test tighter.Suggested test hardening
expect(args).not.toContain('--allowedTools'); + expect(args).not.toContain(''); expect(args).toContain('--resume');🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/core/src/agent/__tests__/session.test.ts` at line 74, The test verifies the --allowedTools flag was removed but misses the regression where an empty positional token ('') could remain; update the test in session.test.ts to also assert that args does not contain the empty string by adding an assertion against args (the variable used in the test) ensuring it does not include '' in addition to the existing expect(args).not.toContain('--allowedTools').
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/core/src/agent/__tests__/session.test.ts`:
- Line 74: The test verifies the --allowedTools flag was removed but misses the
regression where an empty positional token ('') could remain; update the test in
session.test.ts to also assert that args does not contain the empty string by
adding an assertion against args (the variable used in the test) ensuring it
does not include '' in addition to the existing
expect(args).not.toContain('--allowedTools').
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 09e5b5bc-a8c1-46e7-b46f-7617f04ba3af
📒 Files selected for processing (3)
packages/core/src/agent/__tests__/session.test.tspackages/core/src/agent/__tests__/tools.test.tspackages/core/src/agent/tools.ts
Problem
/askmode in Discord always fails with:Root Cause
askModeArgsis set to["--allowedTools", ""]. When Claude Code is invoked inautopermission mode, the final command becomes:Claude Code 2.1.80 treats the empty string
""from--allowedToolsas the positional prompt argument, causing the actual prompt to be silently dropped.Fix
Remove the empty
--allowedToolsflag from ask-mode args. The resulting command correctly passes the prompt as the positional argument:Changes
packages/core/src/agent/tools.ts— ChangedaskModeArgsfrom["--allowedTools", ""]to[]tools.test.tsandsession.test.tsFixes #45
Summary by CodeRabbit
--allowedToolsflag from generated arguments