Skip to content

fix(prefill): inject immutable retained-token cap - #201

Merged
FluffyAIcode merged 2 commits into
mainfrom
AgentMemory/explicit-retained-token-cap-0719
Jul 19, 2026
Merged

fix(prefill): inject immutable retained-token cap#201
FluffyAIcode merged 2 commits into
mainfrom
AgentMemory/explicit-retained-token-cap-0719

Conversation

@FluffyAIcode

Copy link
Copy Markdown
Owner

Summary

  • inject sink + window directly into PrefillJobStore as max_retained_tokens
  • use the explicit cap for both submission preflight and runtime reservation
  • retain compatibility-derived capping only as a fallback for generic callers
  • prevent long prompts from reverting to full-token snapshot estimates when a runtime compatibility field is absent

Root cause

The active worker used the correct source and launch arguments, but its runtime capacity path observed a compatibility object with window_size=0. It therefore estimated 2731 * 400000 = 1.0924 GB and rejected the snapshot after a long Prefill. Relying on a serialized compatibility field made the same failure recur after unrelated changes.

The explicit deployed cap is sink + window = 2052, yielding a stable 820.8 MB estimate.

Tests

  • explicit cap overrides a missing compatibility window
  • worker startup injects configured sink/window
  • existing preflight and reservation behavior
  • targeted suite — 19 passed
  • full platform-neutral suite — 885 passed, 1 skipped
  • Python compile and diff checks pass

Made with Cursor

Make snapshot capacity checks use the worker's configured sink and sliding window directly so missing runtime compatibility fields cannot restore full-prompt estimates.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cursor

cursor Bot commented Jul 19, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Exercise constructor validation so the explicit window cap remains fully covered by the strict CI gate.

Co-authored-by: Cursor <cursoragent@cursor.com>
@FluffyAIcode
FluffyAIcode merged commit af849de into main Jul 19, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant