fix(server): reduce retained thread memory in PR lookups and turn startup - #13304
juliusmarminge merged 3 commits into
Conversation
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR changes an existing server PR-lookup cache with new fiber, TTL, invalidation, and retention behavior, and also changes turn-start history loading. It additionally adds a You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
Targets #2829.
PR lookups retained caller thread snapshots through completed cache fibers and lazy diagnostic stacks. A live heap capture attributed about 310 MiB to this ownership chain. The cache now stores lookup results in deferred values and materializes diagnostic stack strings, releasing the caller snapshot while preserving shared lookups, expiry, invalidation, and failure backoff.
Turn startup also loaded history to estimate a handoff budget before discovering that delivery was already complete or deferred. Budget evaluation now happens after those checks.
Verification:
These fixes need an updated server build for live comparison. They do not establish that all multi-gigabyte spikes are resolved; required full-history reads remain a separate investigation. No wire contracts or client streaming behavior change.