Skip to content

fix(server): reduce retained thread memory in PR lookups and turn startup - #13304

Merged
juliusmarminge merged 3 commits into
t3code/codex-turn-mappingfrom
automation/perf-audit-20260923-131035
Sep 23, 2026
Merged

juliusmarminge merged 3 commits into
t3code/codex-turn-mappingfrom
automation/perf-audit-20260923-131035

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

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:

  • The isolated GC regression retains the caller snapshot with the original cache and releases it with this implementation, for both successful and failed lookups, while keeping the result cached.
  • 114 GitManager tests, six cache behavior/retention tests, and 28 handoff/turn-start tests passed. The 15 cache-related GitManager tests passed again after the final stack-handling change.
  • Server typecheck, scoped lint, formatting, and diff checks passed.

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.


Devin Review

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Sep 23, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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 nodeBuiltinImport:off static-analysis suppression in a test, requiring human review under the applicable policy.

You can add or adjust custom eligibility rules. Learn more.

@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire — 4.9 KiB — 6.8 KiB ✅
Codex Thread snapshot wire — 3.7 KiB — 4.9 KiB ✅
Codex Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅
Codex Live turn WebSocket decoded — 20.4 KiB — 29.3 KiB ✅
Codex Live turn messages — 2 — 8 ✅
Claude Total thread wire — 4.9 KiB — 6.8 KiB ✅
Claude Thread snapshot wire — 3.7 KiB — 4.9 KiB ✅
Claude Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅
Claude Live turn WebSocket decoded — 20.8 KiB — 29.3 KiB ✅
Claude Live turn messages — 2 — 8 ✅

Baseline: unavailable · PR result: 5b09254 · Source CI: success

Scenario and decoded snapshot size

10 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.

  • Codex decoded thread snapshot: 106.1 KiB
  • Claude decoded thread snapshot: 106.4 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@juliusmarminge
juliusmarminge merged commit f55e3a2 into t3code/codex-turn-mapping Sep 23, 2026
24 checks passed
@juliusmarminge
juliusmarminge deleted the automation/perf-audit-20260923-131035 branch September 23, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant