Skip to content

fix(antigravity): persist replay expiry - #1613

Draft
luvs01 wants to merge 1 commit into
lidge-jun:devfrom
luvs01:agent/persist-expired-antigravity-replay
Draft

fix(antigravity): persist replay expiry#1613
luvs01 wants to merge 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.
  • Rebased onto dev at b583d64970e087bb85fa04b7356889070e06a0b5; the replay/sweeper plus latest usage/settings focused set passes on Bun 1.3.14 and Bun 1.4.0-canary.1 (120 pass each), with typecheck passing on both runtimes.
  • 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 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

⏳ DRAFT

  • review readiness checklist open (2/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 2/4).

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.

2/4 boxes ticked.

This PR stays in draft until every box above is ticked.

@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 from a2878cd to 067c4a7 Compare August 13, 2026 14:59
@luvs01
luvs01 force-pushed the agent/persist-expired-antigravity-replay branch from 067c4a7 to ec2f7e1 Compare August 13, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant