fix: bound daemon translator and sink memory - #24
Merged
Conversation
Stephen Belanger (Qard)
requested review from
Abhijeet Prasad (AbhiPrasad) and
Andrew Kent (realark)
August 18, 2026 13:05
Stephen Belanger (Qard)
marked this pull request as ready for review
August 18, 2026 13:05
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Abhijeet Prasad (AbhiPrasad)
approved these changes
Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bounds retained memory across the daemon pipeline while preserving trace content and journal replay semantics.
SpanHandles from the Braintrust sink, preserving late updates through stateless merges.Memory model
The journal and native transcripts are the durable source of truth. In-memory state is limited to:
Codex replacement history is applied immediately at compaction, so pre-compaction context is retained only long enough to emit the compaction span. Idle delivery pipelines, credentials, journal handles, and translator/sink state are retired after 30 seconds and reconstructed from the journal if traffic resumes.
RSS evidence
Measurements are process RSS in KiB using the same synthetic payload shapes before and after the changes. Temporary probes were removed after collection.
The Claude trace still contains the same cumulative historical inputs by contract, but they are emitted sequentially rather than held simultaneously. High-water RSS can remain mapped by the process allocator after values are freed; the second-wave plateaus distinguish that from continued live retention.
Validation
cargo fmt --manifest-path bt-daemon/Cargo.toml --all -- --checkcargo clippy --manifest-path bt-daemon/Cargo.toml --all-features --all-targets --locked -- -D warningscargo test --manifest-path bt-daemon/Cargo.toml --all-features --locked(128 passed; 4 real-agent tests intentionally ignored)git diff --checkRegression coverage includes bounded Codex and Claude catch-up, late stateless merges after completed handles are released, bounded recent caches, the 30-second retirement default, journal-backed retirement/resume, import continuations, and existing translator trace contracts.