-
Notifications
You must be signed in to change notification settings - Fork 866
fix(google): scale antigravity replay capacity and TTL for deep sessions #2375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -298,6 +298,50 @@ describe("antigravity reasoning-replay cache", () => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(contents.every(c => typeof (c.parts[0] as { thoughtSignature?: string }).thoughtSignature === "string")).toBe(true); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test("preserves and restores signatures in deep 1500+ call sessions under production default limits", async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const totalCalls = 1_500; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (let i = 0; i < totalCalls; i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| observeAntigravityReplay(MODEL, SESSION, [fcPart("exec", { cmd: `cmd-${i}` }, `sig-call-${i}-${"a".repeat(24)}`)]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const metricsBefore = antigravityReplayMetrics(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(metricsBefore.calls).toBe(totalCalls); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Both earliest (position 0) and latest (position 1499) calls must restore under default limits: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const testContents = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { role: "model", parts: [fcPart("exec", { cmd: "cmd-0" })] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { role: "model", parts: [fcPart("exec", { cmd: `cmd-${totalCalls - 1}` })] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| applyAntigravityReplay(MODEL, SESSION, testContents); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect((testContents[0].parts[0] as { thoughtSignature?: string }).thoughtSignature).toContain("sig-call-0-"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect((testContents[1].parts[0] as { thoughtSignature?: string }).thoughtSignature).toContain(`sig-call-${totalCalls - 1}-`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Verify survival across durable snapshot flush, reset, and reload: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await flushAntigravityReplay(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setAntigravityReplayLimitsForTests(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const reloadedContents = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { role: "model", parts: [fcPart("exec", { cmd: "cmd-0" })] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { role: "model", parts: [fcPart("exec", { cmd: `cmd-${totalCalls - 1}` })] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| applyAntigravityReplay(MODEL, SESSION, reloadedContents); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect((reloadedContents[0].parts[0] as { thoughtSignature?: string }).thoughtSignature).toContain("sig-call-0-"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect((reloadedContents[1].parts[0] as { thoughtSignature?: string }).thoughtSignature).toContain(`sig-call-${totalCalls - 1}-`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test("retains session between 2 MiB and 8 MiB without tripping the old 2 MiB cap", () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 5000 calls x (64 key bytes + 500 signature bytes) = ~2.8 MiB (exceeds the old 2 MiB session cap): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const callCount = 5_000; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (let i = 0; i < callCount; i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| observeAntigravityReplay(MODEL, SESSION, [fcPart("exec", { index: i }, `sig-${i}-${"s".repeat(500)}`)]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const metrics = antigravityReplayMetrics(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(metrics.calls).toBe(callCount); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(metrics.totalBytes).toBeGreaterThan(2 * 1024 * 1024); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(metrics.totalBytes).toBeLessThanOrEqual(8 * 1024 * 1024); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const contents = [{ role: "model", parts: [fcPart("exec", { index: 0 })] }]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| applyAntigravityReplay(MODEL, SESSION, contents); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect((contents[0].parts[0] as { thoughtSignature?: string }).thoughtSignature).toContain("sig-0-"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+330
to
+343
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Assert the per-session byte metric.
Suggested test adjustment const metrics = antigravityReplayMetrics();
+ expect(metrics.sessions).toBe(1);
expect(metrics.calls).toBe(callCount);
- expect(metrics.totalBytes).toBeGreaterThan(2 * 1024 * 1024);
- expect(metrics.totalBytes).toBeLessThanOrEqual(8 * 1024 * 1024);
+ expect(metrics.largestSessionBytes).toBeGreaterThan(2 * 1024 * 1024);
+ expect(metrics.largestSessionBytes).toBeLessThanOrEqual(8 * 1024 * 1024);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test("evicts oldest inner call at the exact per-session count boundary", () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setAntigravityReplayLimitsForTests({ maxCallsPerSession: 2 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| observeAntigravityReplay(MODEL, SESSION, [fcPart("one", {}, "sig-one-aaaaaaaaaaaa")]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Hyphenate the session-cap compound.
Change
10,240 session capto10,240-session capat Line 785. This makes the numeric phrase a clear modifier ofcap.🧰 Tools
🪛 LanguageTool
[grammar] ~785-~785: Use a hyphen to join words.
Context: ... the unchanged 64 MiB global cap, 10,240 session cap, and 24 MiB snapshot write b...
(QB_NEW_EN_HYPHEN)
🤖 Prompt for AI Agents
Source: Linters/SAST tools