Skip to content

fix(antigravity): persist replay expiry - #1613

Merged
Wibias merged 1 commit into
lidge-jun:devfrom
luvs01:agent/persist-expired-antigravity-replay
Aug 14, 2026
Merged

fix(antigravity): persist replay expiry#1613
Wibias merged 1 commit into
lidge-jun:devfrom
luvs01:agent/persist-expired-antigravity-replay

Conversation

@luvs01

@luvs01 luvs01 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Mark Antigravity replay snapshot state dirty when the periodic or lazy TTL sweep removes at least one in-memory session.
  • Coalesce a sweep into one durable mutation generation while preserving the existing per-session deletion and byte-accounting path.
  • Add a deterministic regression proving that a signature already flushed to disk is removed by the next explicit sweep and flush.

The replay cache already expired entries in memory, but expiry did not advance the snapshot mutation generation. During an idle period, the protected antigravity-replay.json file could therefore retain an opaque thought signature after its one-hour in-memory lifetime until some unrelated replay mutation or a later load rewrote the file.

Verification

  • Bun 1.3.14: bun test --isolate tests/google-antigravity-replay.test.ts tests/state-store-sweeper.test.ts (72 pass)
  • Bun 1.4.0-canary.1: the same focused command (72 pass)
  • Bun 1.3.14 and Bun 1.4.0-canary.1: bun run typecheck
  • Bun 1.3.14: bun run privacy:scan
  • Latest-base integration sanity: bun test --isolate tests/model-rename-migration.test.ts (9 pass)
  • Related lifecycle tests: bun test --isolate tests/state-store-sweeper.test.ts tests/shutdown-drain.test.ts tests/server-background-lifecycle.test.ts tests/storage-mutation-race.test.ts (43 pass)
  • Regression activation: with only the production fix hunk removed, the new test fails because the durable snapshot still contains one session; restoring the fix makes it pass.
  • Independent exact-diff review found no P0/P1/P2 issue in generation, debounce, flush, load, clear, or eviction interactions.
  • Exact head f9036a80798aeda68bfaa5f85b05a611b30256ba is rebased onto dev at a1e5192b75edbf6dcacae51a30912fab93906f87; the replay+sweeper focused set passes on Bun 1.3.14 and Bun 1.4.0-canary.1 (72 pass each), with typecheck passing on both runtimes and privacy scan passing on Bun 1.3.14.
  • Full Bun 1.3.14 suite was attempted and is not claimed green: unrelated Windows effective-account lookup failures and existing 5-second integration timeouts cascaded before Bun crashed after 1,355 seconds with an internal index-out-of-bounds panic (exit 3, peak RSS 2.08 GB). The changed subsystem and lifecycle suites above pass on the exact head.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed. This is an internal persistence-lifecycle correction with no user-facing configuration or command change.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. The regression uses a synthetic signature and the implementation adds no logging or response fields.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • Bug Fixes

    • Expired replay sessions are now removed individually and their associated stored signatures are deleted from durable storage.
    • Persisted snapshots are updated automatically when expired sessions are swept.
  • Tests

    • Added coverage confirming expired sessions and signatures are removed from saved snapshots.

@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 423338d5-a8c7-4a4e-8553-065849e3c1bb

📥 Commits

Reviewing files that changed from the base of the PR and between 3982dae and eb9fa39.

📒 Files selected for processing (2)
  • src/adapters/google-antigravity-replay.ts
  • tests/google-antigravity-replay.test.ts

📝 Walkthrough

Walkthrough

The replay expiry sweep now marks the durable snapshot dirty when it deletes sessions. A durability test verifies that flushing the snapshot removes expired sessions and their stored signatures.

Changes

Replay expiry persistence

Layer / File(s) Summary
Mark expired-session deletions for persistence
src/adapters/google-antigravity-replay.ts, tests/google-antigravity-replay.test.ts
deleteExpiredReplaySessions tracks deletions and marks the replay snapshot dirty at lines 525–533. The asynchronous test at lines 607–620 verifies that flushing after expiry removes all sessions and stored signatures.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: 🟡 Moderate · up to eb9fa

The replay expiry fix is localized and its targeted validation passes, but the PR is still marked draft with required readiness checks incomplete, including a non-green full-suite result. Merge should wait for those checks to be completed or explicitly accepted by the owner.

Possibly related PRs

Suggested reviewers: lidge-jun, yuxin-qiao

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: persisting the removal of expired Antigravity replay entries.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the bug Something isn't working label Aug 13, 2026
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed; the review readiness checklist is complete.

Review readiness checklist

  • ✅ All CI tests are green on my local testing.
  • ✅ I pushed my PR to the latest dev commit.
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ✅ My PR is ready for review.

4/4 boxes ticked.

This pull request is already Ready for Review.
The review-ready label marks this PR as ready; review automation runs independently.
Maintainers: @lidge-jun @Ingwannu @Wibias

@luvs01

luvs01 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@luvs01
luvs01 force-pushed the agent/persist-expired-antigravity-replay branch from eb9fa39 to a2878cd Compare August 13, 2026 14:36
@luvs01

luvs01 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

No files to review.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@luvs01
luvs01 force-pushed the agent/persist-expired-antigravity-replay branch 2 times, most recently from 067c4a7 to ec2f7e1 Compare August 13, 2026 15:48
@lidge-jun

lidge-jun commented Aug 13, 2026

Copy link
Copy Markdown
Owner

The implementation closes the reported persistence gap with the right mutation boundary. deleteExpiredReplaySessions() now calls markReplayDirty() once after deleting one or more expired sessions (src/adapters/google-antigravity-replay.ts:524-534), preserving the existing per-session deletion and byte-accounting path while ensuring the next flush rewrites the durable snapshot.

The regression is meaningful rather than tautological: it flushes a real observed signature, performs the public expiry sweep, flushes again, and verifies both an empty persisted session list and removal of the signature text (tests/google-antigravity-replay.test.ts:607-619). Removing the new dirty-mark hunk leaves the stale on-disk session behind, so the test exercises the actual failure mode.

This is not merge-ready for today's cut. The PR remains draft, its head is based on b583d649 rather than the current dev tip, and the exact-head Cross-platform CI and React Doctor runs are action_required, not green. Please rebase onto current dev and obtain the required exact-head CI. No docs update is needed for this internal snapshot-lifecycle correction, and the patch adds no logging or credential exposure.

DISPOSITION: NEEDS-CHANGE

@luvs01
luvs01 force-pushed the agent/persist-expired-antigravity-replay branch from ec2f7e1 to 809348f Compare August 14, 2026 01:28
@luvs01

luvs01 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

No files to review.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@luvs01
luvs01 force-pushed the agent/persist-expired-antigravity-replay branch from 809348f to f9036a8 Compare August 14, 2026 03:56
@luvs01
luvs01 marked this pull request as ready for review August 14, 2026 03:57
@github-actions
github-actions Bot marked this pull request as draft August 14, 2026 03:57
@github-actions
github-actions Bot marked this pull request as ready for review August 14, 2026 04:04

Wibias commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Thanks for this fix. This closes a subtle but important durability gap: expired Antigravity replay sessions are no longer only removed from memory while their stored signatures can survive on disk until some unrelated later mutation. Persisting the expiry makes the one-hour replay lifetime real across restarts and idle periods too, which is cleaner both for correctness and for retained sensitive state. 🙏

@Wibias
Wibias merged commit 0713b9a into lidge-jun:dev Aug 14, 2026
31 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working review-ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants