Skip to content

Antigravity: warn before falling back to claude, and stop hiding malformed hook payloads (#567, #568) - #570

Merged
fdaviddpt merged 3 commits into
mainfrom
fix/567
Sep 5, 2026
Merged

fdaviddpt merged 3 commits into
mainfrom
fix/567

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Both issues came out of the 0.28.0 release audit (round 1, dispatch token e1a766657500), both on the Antigravity (agy) capture path added by #566.

#567 -- silent routing to the claude summarizer

Closes #567

pipeline/haiku.py's _choose_summarizer_provider() fell silently to return "claude" for a recognised Antigravity transcript, with no warning that a different vendor's session was being billed to Anthropic -- the exact shape #460/#477 already warn about elsewhere in the same function (a vanished Codex transcript, and a genuinely unrecognised envelope shape, both already warn before falling back). Teaching sniff_envelope() the Antigravity shape (#563) had moved this case out of the only arm that used to warn, apparently as a side effect rather than a decision.

Decision made in this PR, with evidence: there is no antigravity-native summarizer (_SUMMARIZER_PROVIDERS is still {claude, codex, auto}), so claude stays the correct routing target -- the bug was the missing receipt, not the routing itself. Fixed by adding a warning before the fallback, matching the two existing sibling arms. Docs updated in docs/install-antigravity.md and docs/configuration.md.

#568 -- malformed hook payload indistinguishable from an empty one

Closes #568

scripts/agy-stop-hook.sh, scripts/agy-session-start-hook.sh and scripts/agy-pre-invocation-hook.sh each rendered a malformed stdin payload (bad JSON, or no python3 at all) identically to a genuinely empty-but-valid {} payload -- the stop hook then exited 0 having captured nothing, with no receipt anywhere. Each script now distinguishes the two and logs a warning to stderr only on the malformed arm, staying silent for the ordinary empty case -- safe, since agy only ever parses these hooks' stdout as protojson and stdout already goes nowhere on this path.

Self-review findings

Both spawned reviewers (Explore and oss:auditor) independently found the same real defect in the first draft: an unguarded mktemp call under set -e in all three scripts, which could abort the whole hook (violating its own documented "exit 0 always" contract) if TMPDIR were unwritable or full. Fixed by guarding the mktemp call and, in agy-stop-hook.sh, removing the mktemp dependency entirely by routing the diagnostic message through the same stdout channel the parse-status field already uses. The reviewer also caught that agy-stop-hook.sh's warning message was built from the wrong variable (python's stderr, which a plain JSON-syntax error never writes to) -- also fixed.

Not fixed, reported here instead (below the bar for this PR): agy-stop-hook.sh's line-based field parsing (pre-existing, not introduced by this diff) silently misroutes conversationId/transcriptPath/workspacePaths if either JSON string contains a literal embedded newline -- confirmed identical behavior on the pre-#568 code via git show HEAD~1. Reachable in principle (a host emitting such a value), but redesigning the field-passing scheme (e.g. NUL-delimited output, or one python call per field) is a larger, separate change than this issue's own scope, and the underlying fragility already existed before this diff touched the file. report-for-filing.

Self-review anchor for the tree-mutation check: both spawns were explicitly told not to edit or mutate the tree; git reflog and git status --short after both returned show only this branch's own two commits and a clean working tree.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Bv6BGZD2EdZ9EuJ7tPDTb7

[AI-generated]

fdaviddpt and others added 3 commits September 5, 2026 18:49
#567: pipeline.haiku._choose_summarizer_provider() now warns before
falling back to `claude` for a recognised Antigravity transcript, the
same as it already does for a vanished Codex transcript -- teaching
sniff_envelope() the Antigravity shape (#563) had silently moved this
case out of the only arm that used to warn, with no discussion of the
tradeoff. Confirmed by evidence in this repo (no antigravity-native
summarizer provider exists, and every other "recognised non-default
host, still falls back to claude" arm in this function already warns)
that silent routing was an accidental side effect, not a decision --
so the fix restores the warning rather than documenting the silence as
intended. docs/install-antigravity.md and docs/configuration.md updated
to describe it.

#568: scripts/agy-stop-hook.sh, scripts/agy-session-start-hook.sh and
scripts/agy-pre-invocation-hook.sh each rendered a malformed stdin
payload identically to a genuinely empty-but-valid one. Each script now
distinguishes the two and logs a warning to stderr on the malformed
arm -- safe, since agy only ever parses these hooks' stdout as
protojson and stdout already goes nowhere on this path.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Bv6BGZD2EdZ9EuJ7tPDTb7
Both self-review spawns (Explore and oss:auditor) independently found
the same real defect in the first pass of the #568 fix: an unguarded
`mktemp` call, under `set -e`, in all three agy-*-hook.sh scripts --
turning an unwritable/full TMPDIR into an interpreter-level script abort
instead of these scripts' own documented "0 Always" exit contract.
Guarded following the pattern already established in
save-session.sh's own `mktemp ... || { ...; exit 1; }`.

The reviewer additionally caught that agy-stop-hook.sh's warning message
was built from the wrong variable: a plain JSON-syntax error never
writes to python's stderr (only to the new 4th stdout line), so the
operator-facing message always fell back to the generic "python3
unavailable" text even when python ran fine and had already computed
the real reason. Fixed by routing agy-stop-hook.sh's message through
that same stdout line instead of a separate mktemp-captured stderr
file, which also removes its mktemp dependency (and thus the first
finding) entirely for that script.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Bv6BGZD2EdZ9EuJ7tPDTb7
CI (job 101342578203) failed tests/test_windows_skip_triage_497.py on
windows-latest for 3.10/3.11/3.12: the meta-guard requires every module
that blanket-skips on win32 to carry a triage row in
docs/windows-skip-triage.md, and tests/test_agy_hooks_malformed_payload_568.py
(added in 2e9534a) had none.

Added a row using tests/test_agy_hooks_563.py's identical skip reason
("bash hook subprocess + POSIX semantics -- not portable to Windows
runners") as the template, since it hit this same guard earlier today
and its own entry already follows this form -- same verdict (unclear),
same basis (a templated reason that bundles the bash-subprocess
dependency with an unspecified "POSIX semantics/layout" claim).

Reproduced locally first: `pytest tests/test_windows_skip_triage_497.py`
failed with the identical assertion CI reported before this change, and
passes after it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Bv6BGZD2EdZ9EuJ7tPDTb7
@fdaviddpt
fdaviddpt merged commit d19a900 into main Sep 5, 2026
16 checks passed
@fdaviddpt
fdaviddpt deleted the fix/567 branch September 5, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant