refactor(context): dedupe fetcher budget-append loops via shared helper#6540
Merged
Merged
Conversation
bug-ops
enabled auto-merge (squash)
July 20, 2026 02:39
fetch_semantic_recall, fetch_document_rag, fetch_summaries, and fetch_cross_session now call the existing append_budgeted_lines helper instead of hand-rolling the same greedy token-budget loop, matching the pattern already used by fetch_persona_facts, fetch_trajectory_hints, and fetch_tree_memory. Pure internal dedup, no behavior change.
bug-ops
force-pushed
the
feat/issue-6471/context-fetcher-budget-dedup
branch
from
July 20, 2026 02:42
fe9c0f5 to
f64b8dd
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
fetch_semantic_recall,fetch_document_rag,fetch_summaries, andfetch_cross_sessionincrates/zeph-context/src/assembler.rsnow build their body via the sharedappend_budgeted_lineshelper instead of hand-rolling the same "prefix + greedily append lines until budget_tokens is exceeded" loop, matching the pattern already used byfetch_persona_facts,fetch_trajectory_hints, andfetch_tree_memory.fetch_summaries's reverse order), and all four functions' signatures/return types/error handling/timeout logic are unchanged.append_budgeted_linesdoc comment to reflect all 7 current callers instead of the stale 3-caller enumeration.Closes #6471
Test plan
cargo nextest run --config-file .github/nextest.toml -p zeph-context— 246/246 pass, unchanged from before the refactorcargo +nightly fmt --check— cleancargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings— cleanRUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"— clean, no broken intra-doc linksgitleaks protect --staged --no-banner --redact— no leaks found[Unreleased]