refactor(memory): remove ScoredCandidate wrapper and fix entered() span in tiered_retrieval#4881
Merged
Merged
Conversation
bug-ops
enabled auto-merge (squash)
June 5, 2026 22:54
…an in tiered_retrieval Remove the single-field ScoredCandidate wrapper struct from score_candidates; use Vec<RecalledMessage> directly, eliminating the final .map(|s| s.recalled) unwrap and the .recalled field indirection in the sort comparator. Remove the debug_span().entered() guard wrapping assemble_within_budget inside the async escalation_loop. The call is synchronous and already nested under the outer memory.tiered.retrieve instrument span; the extra guard was a flagged anti-pattern with no tracing benefit. Closes #4866 Closes #4867
bug-ops
force-pushed
the
4866-tiered-retrieval-async-span
branch
from
June 5, 2026 23:00
5d5dbdf to
a138e56
Compare
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
ScoredCandidateprivate single-field wrapper struct fromscore_candidates; useVec<RecalledMessage>directly, eliminating the final.map(|s| s.recalled)unwrap and the.recalledfield indirection in the sort comparator.debug_span!("memory.tiered.assemble").entered()guard wrappingassemble_within_budgetinsideasync fn escalation_loop. The call is synchronous and nests under the outermemory.tiered.retrieveinstrument span; the extra guard was a flagged anti-pattern per project convention.Changes
crates/zeph-memory/src/tiered_retrieval.rs— two localized edits, behavior unchangedCHANGELOG.md—[Unreleased]section updatedTest plan
cargo +nightly fmt --check— cleancargo clippy --workspace -- -D warnings— 0 warningscargo nextest run --workspace --lib --bins— 10510 passed, 21 skippedRUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --locked— cleancargo doc --no-deps -p zeph-memory --all-features— no broken intra-doc linksgrep -rn "ScoredCandidate" crates/— no output (struct fully removed)grep -n "\.entered()" crates/zeph-memory/src/tiered_retrieval.rs— no outputCloses #4866
Closes #4867