Skip to content

Quarantine an Antigravity span made of unmapped step types (#575) - #582

Merged
fdaviddpt merged 1 commit into
mainfrom
fix/575
Sep 5, 2026
Merged

fdaviddpt merged 1 commit into
mainfrom
fix/575

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Fix #575: an unmapped Antigravity step type no longer loses data silently

pipeline/host.py's _ANTIGRAVITY_STEP_ROLES map only recognises two step
types (USER_INPUT, PLANNER_RESPONSE). Every other step silently
returned None. Because sniff_envelope still resolved the file as the
known host "antigravity", scripts/save-session.sh took the plain "0
exchanges, skip" branch instead of the existing #450 quarantine branch
that an "unrecognised" envelope gets -- so a span made entirely of
unmapped step types advanced the saved position and became permanently
unrecoverable the moment a later build learned that step type.

What changed

  • pipeline.host.antigravity_step_is_unmapped(obj) -- true when a step's
    own type is a real string foreign to the map (distinct from a mapped
    step with blank content, which is a legitimate skip).
  • pipeline.extract.extract_messages() gains an optional stats: dict | None = None parameter (default None, so no existing caller's
    behaviour or type changes) that counts unmapped steps for the
    "antigravity" envelope.
  • extract_session() threads this into a new
    ExtractResult.envelope_has_unmapped_step: bool field, printed on the
    shell bridge as ENVELOPE_HAS_UNMAPPED_STEP.
  • scripts/save-session.sh, in the EXCHANGE_COUNT -eq 0 branch, now
    passes the literal string "unrecognised" as the envelope
    save-position acts on whenever that flag is set -- reusing the
    existing mark_unread_envelope/clear_unread_envelope machinery --
    while the logged message and $ENVELOPE itself keep saying the honest
    "antigravity" name.
  • Deliberately does not attempt to fill in the step-type map itself:
    that needs a human-run agy --dangerously-skip-permissions session
    nobody has access to (the issue's own "what would settle it" note). What
    changes is that a gap in the map can no longer silently lose data.

Tests

New tests in tests/test_antigravity_envelope_563.py (host/extract level,
including a full extract_session round trip with paired positive and
negative controls), tests/test_shell.py (shell bridge print, on and
off), and tests/test_save_session_gates.py (end-to-end shell-script
behaviour via the existing stubbed-pipeline.shell harness, with a paired
negative control proving a genuinely-quiet antigravity span is NOT
quarantined). All red before the fix, green after; narrowed runs only
(151 tests across the four touched files), never the whole suite locally
-- CI is the gate.

Docs / changelog

changelog.d/575.fixed.md added and checked with
.oss/assemble_changelog.py --check. docs/install-antigravity.md gained
a bullet under "Not established" describing the map's own remaining gap
and this fix's mitigation. README.md (the repo's only docs_targets
entry) already points readers at docs/install-antigravity.md for this
kind of detail rather than describing extraction internals itself --
opened and confirmed still true, no change needed.

A known gap this diff does NOT close (see below-bar item)

Both spawned reviewers (an Explore pass and an oss:auditor pass)
independently found the same real gap: a mixed read span -- some
steps map to a role, at least one does not, in the same span -- produces
EXCHANGE_COUNT > 0, so scripts/save-session.sh never reaches the new
quarantine check at all, and the three OTHER save-position call sites in
that script (the give-up paths and the ordinary successful-save path)
still pass the real envelope name straight through, silently dropping the
unmapped step's content and clearing any pre-existing quarantine mark.

This is reported for filing rather than fixed here: the existing #450
quarantine machinery (unread-envelope.json) tracks one quarantine mark
point per session, not a set of unread ranges. Naively quarantining a
mixed span the same way the all-unmapped case is handled would make a
future recovery re-extract and re-save messages that were ALREADY
extracted and saved in THIS run, producing duplicate summarized content --
a different, and arguably worse, bug than the one this issue closes.
Whether to accept that duplication risk, build per-step-range tracking,
or do something else needs a design decision this lane was not briefed to
make.

Closes #575

🤖 Generated with Claude Code

[AI-generated]

`_ANTIGRAVITY_STEP_ROLES` only maps `USER_INPUT`/`PLANNER_RESPONSE`; a step
with any other `type` (a future tool-call/reasoning step no probe has
captured live) silently returned None. Because `sniff_envelope` still
resolved the file as "antigravity" (a known host), save-session.sh took the
plain "0 exchanges, skip" branch instead of the #450 quarantine branch, so
the span advanced past and became unrecoverable the moment a later build
learned that step type -- indistinguishable from a genuinely quiet session.

`pipeline.host.antigravity_step_is_unmapped()` flags a step whose own `type`
is foreign to the map, distinct from a mapped step with blank content.
`extract_messages()` takes an optional `stats` dict to count these without
changing its return type for any existing caller, and `extract_session()`
threads the result into a new `ExtractResult.envelope_has_unmapped_step`
field, printed on the shell bridge as `ENVELOPE_HAS_UNMAPPED_STEP`.
`save-session.sh` now passes "unrecognised" as the envelope save-position
acts on whenever that flag is set, reusing the existing #450 quarantine
machinery, while the logged and reported envelope stays the honest
"antigravity" name.

The map itself still only knows two step types -- filling it in for a real
tool-calling turn needs a human-run `agy --dangerously-skip-permissions`
session, which this fix does not have access to. What changes is that a gap
in the map can no longer silently lose data.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Bv6BGZD2EdZ9EuJ7tPDTb7
@fdaviddpt
fdaviddpt merged commit 0990eb5 into main Sep 5, 2026
16 checks passed
@fdaviddpt
fdaviddpt deleted the fix/575 branch September 5, 2026 20:56
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.

Antigravity step-type map silently drops unrecognised tool-call step types (fails-to-preserve)

1 participant