Skip to content

Fix: suppress the cross-plugin promo on the Antigravity delegation path (#596) - #606

Merged
fdaviddpt merged 1 commit into
mainfrom
fix/596
Sep 6, 2026
Merged

fdaviddpt merged 1 commit into
mainfrom
fix/596

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

What

agy-session-start-hook.sh delegates to session-start-hook.sh with the
delegate's own stdout piped to /dev/null (#563 -- Antigravity parses a
command hook's stdout as protojson against its own schema, and the
plain-text/hookSpecificOutput shape session-start-hook.sh emits does not fit
it). But session-start-hook.sh's emit block committed the
$HOME/.remember/tmp/promo-notice throttle/rotation marker on any successful
printf, and printf to /dev/null succeeds -- so one Antigravity SessionStart
silently burned the whole cooldowns.promo_seconds window for every OTHER
Claude Code session on the same machine, for a promo nobody ever saw.

Approach

Of the two shapes the issue posed, this picks suppression at the point stdout
is known to be discarded (the agy delegation call itself) over having the
emitter detect its own stdout target. session-start-hook.sh has no reliable
way to do the latter: [ -t 1 ] cannot tell "discarded" from "captured
normally", because a real Claude Code invocation also reads this hook's
stdout through a non-tty pipe -- gating the marker on a tty check would
suppress it for every legitimate caller too, not just this one.
agy-session-start-hook.sh is the one place that knows its delegate's stdout
goes nowhere, so it is the one place that turns the whole promo feature off
for that call, via REMEMBER_SUPPRESS_PROMO=1.

Verification

  • Observed: tests/test_agy_promo_suppression_596.py pins a must-not-fire
    case driving the real agy-session-start-hook.sh delegation (marker not
    written, cooldown left untouched for the next real session), paired with a
    must-fire positive control driving session-start-hook.sh directly (marker
    still committed when the promo genuinely reaches stdout) -- so a fix that
    disabled the marker everywhere could not pass both.

Docs / changelog

docs/install-antigravity.md and changelog.d/596.fixed.md updated;
docs/windows-skip-triage.md gets the new test module's row.

Closes #596

This PR was assembled by a maintainer tick from an already-committed and
pushed commit (a developer lane dispatched in a prior tick whose handback
never opened the pull request) -- the commit message above is that
developer's own record of the work.

🤖 Generated with Claude Code

https://claude.ai/code/session_01P9WexZb39yUjQgJ53Zmf1c

[AI-generated]

…th (#596)

agy-session-start-hook.sh delegates to session-start-hook.sh with the
delegate's own stdout piped to /dev/null (#563 -- Antigravity parses a
command hook's stdout as protojson against its own schema, and the
plain-text/hookSpecificOutput shape session-start-hook.sh emits does not
fit it). But session-start-hook.sh's emit block committed the
$HOME/.remember/tmp/promo-notice throttle/rotation marker on any
successful `printf`, and `printf` to /dev/null succeeds -- so one
Antigravity SessionStart silently burned the whole
`cooldowns.promo_seconds` window for every OTHER Claude Code session on
the same machine, for a promo nobody ever saw.

Of the two shapes the issue posed, this picks suppression at the point
stdout is known to be discarded (the agy delegation call itself) over
having the emitter detect its own stdout target. session-start-hook.sh
has no reliable way to do the latter: `[ -t 1 ]` cannot tell "discarded"
from "captured normally", because a real Claude Code invocation also
reads this hook's stdout through a non-tty pipe -- gating the marker on a
tty check would suppress it for every legitimate caller too, not just
this one. agy-session-start-hook.sh is the one place that KNOWS its
delegate's stdout goes nowhere, so it is the one place that turns the
whole promo feature off for that call, via REMEMBER_SUPPRESS_PROMO=1.

Pinned by tests/test_agy_promo_suppression_596.py: a must-not-fire case
driving the real agy-session-start-hook.sh delegation (marker not
written, cooldown left untouched for the next real session), paired with
a must-fire positive control driving session-start-hook.sh directly
(marker still committed when the promo genuinely reaches stdout) -- so a
fix that disabled the marker everywhere could not pass both.

docs/install-antigravity.md and changelog.d/596.fixed.md updated;
docs/windows-skip-triage.md gets the new test module's row (blanket
win32 skip, same bash-subprocess convention as its siblings).

Co-Authored-By: Max <noreply>
@fdaviddpt
fdaviddpt merged commit d5123ee into main Sep 6, 2026
16 checks passed
@fdaviddpt
fdaviddpt deleted the fix/596 branch September 6, 2026 23:22
fdaviddpt added a commit that referenced this pull request Sep 7, 2026
…ne row further by #610

CI on PR #611 (windows-latest, py3.11) failed in
tests/test_windows_skip_triage_prose_totals_595.py: this PR's own new row
(tests/test_post_tool_dry_flag_injection_610.py) grew the table to 104
rows / 84 unclear, but four prose sentences elsewhere in the doc still
cited the pre-existing stale totals (102 / 82) -- a pre-existing drift
already filed as #612 (two earlier PRs, #605 and #606, each merged green
against their own base and left the prose one row further behind), which
this PR's own table addition made one row worse and is why the failure
surfaced specifically on this branch.

Re-derived the correct totals directly from the table itself (104 total
rows, 84 unclear, 8 convertible, 12 not-convertible -- the latter two
already matched) rather than trusting any externally-reported numbers,
and updated all four prose citations: "## The count: 104, not 107",
"finds **104** modules", "not that read. 84 modules.", "bulk of these
104 reasons". Confirmed against the live table rather than assumed.

tests/test_windows_skip_triage_prose_totals_595.py: 3 failed, 2 passed
before this fix (confirmed locally); 7 passed (that module plus its
sibling table-diff guard, test_windows_skip_triage_497.py) after.

This also resolves the concern #612 was filed for -- the prose now
matches the table exactly, with no residual drift.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9WexZb39yUjQgJ53Zmf1c
fdaviddpt added a commit that referenced this pull request Sep 7, 2026
…611)

* Reject a leading dash in post-tool-hook.sh's session_id guard (#610)

STDIN_SESSION_ID reaches save-session.sh's argv on the background nohup
save path (`nohup "$SAVE_SCRIPT" "$SESSION_ID" ... &`), and that script's
own arg loop reads a leading-dash value as a FLAG rather than a
positional session id -- the character class this guard applied
(`[!A-Za-z0-9._-]`) already allowed a leading dash, so a session_id
shaped exactly like "--dry", paired with a real transcript_path, passed
through untouched and was trusted by the STDIN_SESSION_ID_TRUSTED branch
(which verifies only that a transcript_path was supplied, not that this
id actually names it -- an established #468 trust decision this fix does
not revisit). save-session.sh's own auto-detect fallback then correctly
identified the real session from the transcript_path, but with DRY_RUN
silently true: no summary written, no position advanced, log line reads
like an ordinary run. Third call site in this class, after #576
(agy-stop-hook.sh) and #600 (session-end-hook.sh).

A new end-to-end fixture drives the real post-tool-hook.sh and reaps the
forked save-session.sh, pinned red against the unpatched guard (the "===
DRY RUN ===" banner reaching the autonomous log for a crafted
session_id) and green after, with a positive control proving an ordinary
session_id still produces a genuine save.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9WexZb39yUjQgJ53Zmf1c

* Fix stale line numbers and #600 merge-status overclaim in the #610 fix

Self-review (Explore) caught the new test's docstrings/messages citing
pre-comment-insertion line numbers for post-tool-hook.sh (off by +15,
the exact width of the #610 rationale comment this same commit inserted).
Corrected to the actual committed line numbers: the guard case statement
at 419-421 (was cited 404-406), STDIN_SESSION_ID_TRUSTED at 564-576 (was
549-557), and the nohup dispatch at 908 (was 893).

Audit (oss:auditor) caught a second, more substantive overclaim: the
original commit message, changelog fragment and test docstring described
#576 and #600 as both "already closed" siblings. #576 (agy-stop-hook.sh)
is merged into this branch's history; #600 (session-end-hook.sh, PR #609)
is not -- `git merge-base --is-ancestor 511e3d3 HEAD` fails, and #609 is
still open. session-end-hook.sh in this tree still carries the pre-#600
vulnerable pattern; that is a fact about an unmerged sibling PR, not
something this commit introduces or is responsible for fixing, but this
commit's own prose should not have implied it was already fixed.

Both are documentation-only corrections: the guard fix and its test's
assertions are unchanged and still pass (2 passed).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9WexZb39yUjQgJ53Zmf1c

* Fix docs/windows-skip-triage.md prose-vs-table drift (#612), pushed one row further by #610

CI on PR #611 (windows-latest, py3.11) failed in
tests/test_windows_skip_triage_prose_totals_595.py: this PR's own new row
(tests/test_post_tool_dry_flag_injection_610.py) grew the table to 104
rows / 84 unclear, but four prose sentences elsewhere in the doc still
cited the pre-existing stale totals (102 / 82) -- a pre-existing drift
already filed as #612 (two earlier PRs, #605 and #606, each merged green
against their own base and left the prose one row further behind), which
this PR's own table addition made one row worse and is why the failure
surfaced specifically on this branch.

Re-derived the correct totals directly from the table itself (104 total
rows, 84 unclear, 8 convertible, 12 not-convertible -- the latter two
already matched) rather than trusting any externally-reported numbers,
and updated all four prose citations: "## The count: 104, not 107",
"finds **104** modules", "not that read. 84 modules.", "bulk of these
104 reasons". Confirmed against the live table rather than assumed.

tests/test_windows_skip_triage_prose_totals_595.py: 3 failed, 2 passed
before this fix (confirmed locally); 7 passed (that module plus its
sibling table-diff guard, test_windows_skip_triage_497.py) after.

This also resolves the concern #612 was filed for -- the prose now
matches the table exactly, with no residual drift.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P9WexZb39yUjQgJ53Zmf1c

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The promo throttle marker is written on an Antigravity session start whose stdout is discarded, burning the whole cooldown window on a promo nobody saw

1 participant