Repository navigation
Conversation
`_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
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.
Fix #575: an unmapped Antigravity step type no longer loses data silently
pipeline/host.py's_ANTIGRAVITY_STEP_ROLESmap only recognises two steptypes (USER_INPUT,PLANNER_RESPONSE). Every other step silentlyreturned
None. Becausesniff_envelopestill resolved the file as theknown host
"antigravity",scripts/save-session.shtook the plain "0exchanges, skip" branch instead of the existing
#450quarantine branchthat an
"unrecognised"envelope gets -- so a span made entirely ofunmapped 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'sown
typeis a real string foreign to the map (distinct from a mappedstep with blank content, which is a legitimate skip).
pipeline.extract.extract_messages()gains an optionalstats: dict | None = Noneparameter (defaultNone, so no existing caller'sbehaviour or type changes) that counts unmapped steps for the
"antigravity"envelope.extract_session()threads this into a newExtractResult.envelope_has_unmapped_step: boolfield, printed on theshell bridge as
ENVELOPE_HAS_UNMAPPED_STEP.scripts/save-session.sh, in theEXCHANGE_COUNT -eq 0branch, nowpasses the literal string
"unrecognised"as the envelopesave-positionacts on whenever that flag is set -- reusing theexisting
mark_unread_envelope/clear_unread_envelopemachinery --while the logged message and
$ENVELOPEitself keep saying the honest"antigravity"name.that needs a human-run
agy --dangerously-skip-permissionssessionnobody 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_sessionround trip with paired positive andnegative controls),
tests/test_shell.py(shell bridge print, on andoff), and
tests/test_save_session_gates.py(end-to-end shell-scriptbehaviour via the existing stubbed-
pipeline.shellharness, with a pairednegative 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.mdadded and checked with.oss/assemble_changelog.py --check.docs/install-antigravity.mdgaineda bullet under "Not established" describing the map's own remaining gap
and this fix's mitigation.
README.md(the repo's onlydocs_targetsentry) already points readers at
docs/install-antigravity.mdfor thiskind 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
Explorepass and anoss:auditorpass)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, soscripts/save-session.shnever reaches the newquarantine check at all, and the three OTHER
save-positioncall sites inthat 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 markpoint 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]