Repository navigation
fix: keep claude_args flags when the block opens with a comment line - #1893
Open
MuhammadMehroz786 wants to merge 1 commit into
Open
MuhammadMehroz786 wants to merge 1 commit into
MuhammadMehroz786 wants to merge 1 commit into
Conversation
Tag mode and agent mode appended the user's claude_args to their own flag line with a space. stripShellComments only drops a `#` comment that starts its own line, so when the user's block opened with a comment the comment no longer started a line of the joined string, shell-quote treated everything from that `#` to the end of the string as one comment, and every flag in the block was silently lost. Join on a newline instead, so the user's first line is always its own line and a leading comment is stripped like any other. Fixes anthropics#1892
This branch has not been deployed
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.
Fixes #1892
Problem
stripShellComments(base-action/src/parse-sdk-options.ts) only drops a#comment that starts its own line. Tag mode and agent mode, however, append the user'sclaude_argsto their own flag line with a space:When the block opens with a comment line, that comment no longer starts a line of the joined string, so it survives
stripShellComments, andshell-quotetreats everything from the#to the end of the string as one comment, newlines included. Every user flag is silently lost and the run proceeds on the action's defaults. MeanwhileparseAllowedToolstokenizes the user's block on its own, so the inline-comment server is still installed while the SDK never receives--allowedTools(the disagreementparse-tools.tssays to avoid, #1357).Reproduced through
parseSdkOptionson the currentmain:Fix
Join the user's block on a newline instead of a space in both modes. The user's first line is then always its own line, so a leading full-line comment is stripped exactly like one anywhere else in the block.
shell-quotealready treats a newline as whitespace between tokens, and the joined string goes straight fromprepareResult.claudeArgstorunClaudein-process, so nothing else on the path needs to change.Tests
Added one test per mode that sets
CLAUDE_ARGSto a block opening with a comment line, runs the mode'sprepare*, and feeds the result throughparseSdkOptions. Both fail onmain(modelcomes backundefined) and pass with the fix.bun test: 968 pass, 0 failbun run typecheck: cleanbun run format:check: clean🤖 Generated with Claude Code