fix(global-settings): push auth lost when the message carries an image (v2.5.1) - #792
Open
WilcoLouwerse wants to merge 1 commit into
Open
WilcoLouwerse wants to merge 1 commit into
WilcoLouwerse wants to merge 1 commit into
Conversation
…e (v2.5.1)
git_push_authorized() read the last type=="user" transcript entry with a
text block as "the last human message". Claude Code also writes isMeta
entries of that shape: after a message with a pasted image it appends
"[Image: source: …/images/1.png]", and an invoked skill's body lands as
one too. The meta entry therefore became the last message, so:
- a push phrase typed alongside a screenshot was never seen — every push
in that turn was denied;
- a skill body that mentions a phrase ("commit and push the fixes")
authorized a push the human never asked for.
The check now skips isMeta entries. Skipping them alone would let an older
phrase survive a later slash command (typed commands are string content,
which the check ignored), so a typed slash command now counts as a human
message with its <command-args> as the text — it can grant and revoke.
Other string content (task notifications, other-session messages,
compaction summaries) stays ignored, as before.
Tests: eight new push-auth layouts (I–P) covering the image message, a
later image message revoking, slash-command args granting and revoking,
phrases inside a skill body / isMeta entry / task notification not
authorizing, and a task notification not revoking. Against the old hook
I, K, M and N fail; with the fix all suites pass (7556/7556, 29/29,
80/80). Also checked on real transcripts: the typed text is found after
an image message and after a skill invocation; a 39 MB transcript takes
0.4 s.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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.
Problem
A push phrase (
push for me,commit and push, …) typed in a message that also carries a pasted image is never recognised: every push in that turn is denied.git_push_authorized()treats the lasttype=="user"transcript entry with a text block as "the last human message". Claude Code also writesisMetaentries of that shape:[Image: source: /tmp/…/images/1.png]Base directory for this skill: …)The meta entry therefore wins. Side effect in the other direction: a skill body that mentions a phrase (e.g. "commit and push the fixes") authorizes a push the human never asked for.
Fix
isMetaentries.<command-name>/<command-args>) as a human message, with its arguments as the text. Without this, skippingisMetaalone would let an older phrase survive a later slash command, because string content was ignored entirely.jq -c … | tail -n 1) instead of slurping; a 39 MB transcript takes 0.4 s.Version bump to 2.5.1; one paragraph added to
docs/claude/global-claude-settings.md.Tests
Eight new push-auth layouts (I–P) in
test-block-write-commands.sh;make_transcriptgained tokens that mirror the real transcript shapes (image message, image meta, slash command, skill meta, task notification, attachment).isMetaentryWith the fix: 7556/7556, block-polling 29/29, block-config-tool-writes 80/80. Also checked against real transcripts (typed text found after an image message and after a skill invocation).
shellcheckwas not run locally.🤖 Generated with Claude Code