Repository navigation
fix: address jq escaping and Step 5 dismissal ordering in CI skills - #1241
Conversation
1. Add jq `!=` escaping warning to running-in-ci skill. Despite the pre-flight template fix in #1152, Claude still generates `!=` in ad-hoc jq queries during CI polling — 4 of 6 review sessions in the past 24 hours hit this bug. The new guidance tells Claude to use `| not` instead of `!=` in all jq expressions. 2. Swap Step 5 dismissal ordering in pr-review. Previously: dismiss approval first, then post analysis. If the session times out between these, the PR author gets a bare dismissal with no context (happened on PR #1238, run 22536752559). Now: post analysis first, dismiss second — the safer ordering. Closes #1239 Closes #1240 Co-Authored-By: Claude Opus 4.6 <[email protected]>
| )" | ||
| ``` | ||
|
|
||
| 3. **`!=` in jq expressions** — `jq 'select(.x != "y")'` breaks because `!` |
There was a problem hiding this comment.
can we instead suggest the heredoc approach, or whatever approach allows for ! to work OK?
There was a problem hiding this comment.
Good call — updated to suggest storing the filter in a variable instead:
filter='select(.status != "COMPLETED")'
gh api ... --jq "$filter"Single-quoted assignment is safe from history expansion, and this keeps the natural != syntax.
There was a problem hiding this comment.
does a heredoc work here? or no?
test it out yourself. my concern is that filter='select(.status != "COMPLETED")' doesn't actually help
There was a problem hiding this comment.
Tested it — you're right, the variable approach doesn't reliably help. The ! gets escaped to \! at the tool level before bash even processes the command, so moving it into a variable doesn't change anything.
The heredoc approach does work consistently:
jq_filter=$(cat <<'EOF'
select(.status != "COMPLETED")
EOF
)
gh api ... --jq "$jq_filter"Updated the guidance to use heredocs instead of variables in 4f733f1.
Store jq filters in a variable to sidestep bash history expansion, keeping the natural != syntax rather than requiring an alternate jq idiom. Co-Authored-By: Claude Opus 4.6 <[email protected]>
worktrunk-bot
left a comment
There was a problem hiding this comment.
The general rule on line 142 now has a third valid approach (the variable technique from item 3) that it doesn't mention — could confuse the LLM about which pattern to use.
Testing confirmed max-sixty's concern: the variable approach (`filter='select(.status != "COMPLETED")'`) doesn't reliably prevent `!` escaping — the escaping happens at the tool level before bash processes the command. The heredoc approach (`<<'EOF'`) works consistently because the content is treated as a literal string. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
can we do a pass and simplify? maybe just "always write commands containing ! to a file before exciutijg the file", or similar? |
Collapses three enumerated failure modes into a single rule: "write it to a file or heredoc first." One example for $, one for ! — covers all cases without the repetition. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
Simplified — collapsed the three enumerated cases into one rule ("write it to a file or heredoc first") with two examples: one for |
|
does it work to write the file with a heredoc? or does the file need to be written with the FileEdit tool to avoid the |
|
Tested — heredocs with quoted delimiters ( # File write — works
cat > /tmp/test.txt << 'EOF'
select(.status != "COMPLETED")
query($owner: String!, $repo: String!)
EOF
# Variable capture — works
jq_filter=$(cat <<'EOF'
select(.status != "COMPLETED")
EOF
)The key is the quoted delimiter ( The Write/Edit tools would also work (they bypass the shell entirely), but the heredoc approach is sufficient and keeps the guidance self-contained within bash — no need to mix tool types. |
Summary
!=→| notguidance to the running-in-ci skill's shell quoting section, fixing the most common jq escaping failure that hit 4 of 6 review sessions in the past 24 hours (refinement of pr-review skill: jq escaping failures and LGTM dedup bug waste ~21% of review tool calls #1152)wt switch ^when resolvable after CWD removal #1238)Closes #1239
Closes #1240
Test plan
🤖 Generated with Claude Code