refactor: consolidate memory-maintenance-loop wiring into one shared function - #6185
Merged
Conversation
bug-ops
enabled auto-merge (squash)
July 12, 2026 22:28
…function Four near-identical spawn blocks in runner.rs, acp.rs, daemon.rs, and serve/deps.rs are replaced by a single agent_setup::spawn_memory_maintenance_loops, parameterized on status_tx and skip_eviction to reconcile the per-caller differences. Also closes a test-realism gap where the acp.rs/daemon.rs unit tests reconstructed a copy of the block instead of calling production code. Closes #6180
bug-ops
force-pushed
the
fix/memory-maintenance-loop-wiring
branch
from
July 12, 2026 22:30
68e2b51 to
995f2ec
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
src/runner.rsinline,src/serve/deps.rs::spawn_memory_maintenance_loops,src/acp.rs'sbuild_acp_deps,src/daemon.rs'srun_daemon) are consolidated into a single sharedagent_setup::spawn_memory_maintenance_loops, now called by all four entry points.status_tx: Option<&UnboundedSender<String>>(unifies ACP//sessions*Nonevs. CLI/TUI/daemonSomefor the hebbian-consolidation loop's status sender) andskip_eviction: bool(preservesrunner.rs's pre-existing--baregate, which only ever applied to the eviction loop).acp.rs/daemon.rsregression tests previously reconstructed a hand-written copy of the spawn block instead of calling production code; both now call the shared function viaAppBuilder::for_test.skip_eviction=trueandstatus_tx=Some(...), which were previously untested parameterization (flagged independently by the tester and impl-critic during review).origin/mainto reconcile with test: exercise real production wiring in acp/daemon memory-loop tests #6179, which independently extractedacp.rs/daemon.rs's inline blocks into their own per-file wrapper functions after this branch forked; those now-redundant wrappers are removed in favor of the one shared function.Closes #6180
Test plan
cargo +nightly fmt --checkcargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warningscargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins(13259 passed, 0 failed)RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"