Skip to content

Stream live span operations directly to routes and reclaim delivered payloads - #218

Merged
Stephen Belanger (Qard) merged 11 commits into
mainfrom
t3/daemon-memory-leak
Oct 26, 2026
Merged

Stephen Belanger (Qard) merged 11 commits into
mainfrom
t3/daemon-memory-leak

Conversation

@Qard

@Qard Stephen Belanger (Qard) commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Long coding-agent sessions could retain delivered trace payloads and per-span metadata indefinitely. This change shares live span data across routes, removes stored payloads after every route reports them, and releases completed tool and origin metadata. Completed-span and late-merge IDs stay in a disk index so resident memory tracks pending work instead of session history.

Delivery batches collect for up to 30 seconds or 256 KiB. Turn-end flushes, explicit flushes, and shutdown bypass the timer. Shutdown keeps shared storage open until every route finishes and releases each route's sink before returning.

New destinations receive retained and future operations. Use transcript import for history already reclaimed. SQLite reuses freed payload space; event journals and transcripts continue recording session history.

Matched ten-session, ten-minute profiles completed 1,001 turns each: tool-correlation allocations fell from 39.45 to 0.06 MiB and direct ledger allocations from 3.93 to 0.03 MiB, with no failed hooks or retained SpanOps. A separate transcript-driven cache probe processed 788 turns; its late live heap stayed near 10 MiB and RSS near 39 MiB. Higher hook rates can still outpace translation and accumulate durable input; those overloaded runs do not establish a memory plateau.

Validation: 593 daemon tests pass locally with four test threads, with five optional agent tests ignored. Real Claude and Codex CLI tests also pass against local mock inference and ingestion. Strict Clippy and formatting pass. Recovery, failed index writes, legacy upgrades, cross-process deduplication, and shutdown ownership are covered; the previously failing retirement test passed 15 consecutive runs after the shutdown fix.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T10:50:08.553642Z 9d328bb PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Qard
Stephen Belanger (Qard) merged commit 531c25e into main Oct 26, 2026
22 checks passed
@Qard
Stephen Belanger (Qard) deleted the t3/daemon-memory-leak branch October 26, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants