Skip to content

refactor: consolidate memory-maintenance-loop wiring into one shared function - #6185

Merged
bug-ops merged 1 commit into
mainfrom
fix/memory-maintenance-loop-wiring
Jul 12, 2026
Merged

refactor: consolidate memory-maintenance-loop wiring into one shared function#6185
bug-ops merged 1 commit into
mainfrom
fix/memory-maintenance-loop-wiring

Conversation

@bug-ops

@bug-ops bug-ops commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Four near-identical memory-maintenance-loop spawn blocks (src/runner.rs inline, src/serve/deps.rs::spawn_memory_maintenance_loops, src/acp.rs's build_acp_deps, src/daemon.rs's run_daemon) are consolidated into a single shared agent_setup::spawn_memory_maintenance_loops, now called by all four entry points.
  • The shared function is parameterized on status_tx: Option<&UnboundedSender<String>> (unifies ACP//sessions* None vs. CLI/TUI/daemon Some for the hebbian-consolidation loop's status sender) and skip_eviction: bool (preserves runner.rs's pre-existing --bare gate, which only ever applied to the eviction loop).
  • Closes a test-realism gap: acp.rs/daemon.rs regression tests previously reconstructed a hand-written copy of the spawn block instead of calling production code; both now call the shared function via AppBuilder::for_test.
  • Adds 2 targeted unit tests directly on the shared function covering skip_eviction=true and status_tx=Some(...), which were previously untested parameterization (flagged independently by the tester and impl-critic during review).
  • No behavior change for any entry point — verified loop-by-loop against the pre-refactor per-file gating by adversarial critique.
  • Rebased onto origin/main to reconcile with test: exercise real production wiring in acp/daemon memory-loop tests #6179, which independently extracted acp.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 --check
  • cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings
  • cargo 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"
  • Targeted re-run of all 6 memory-maintenance-loop tests (4 rewired + 2 new) independently confirmed by reviewer

@bug-ops
bug-ops enabled auto-merge (squash) July 12, 2026 22:28
@github-actions github-actions Bot added documentation Improvements or additions to documentation refactor Code refactoring without functional changes size/XL Extra large PR (500+ lines) labels Jul 12, 2026
…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
bug-ops force-pushed the fix/memory-maintenance-loop-wiring branch from 68e2b51 to 995f2ec Compare July 12, 2026 22:30
@bug-ops
bug-ops merged commit 8ef9a34 into main Jul 12, 2026
43 checks passed
@bug-ops
bug-ops deleted the fix/memory-maintenance-loop-wiring branch July 12, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation refactor Code refactoring without functional changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

memory-maintenance-loop wiring is a 4-way near-identical duplicate across runner.rs/serve/deps.rs/acp.rs/daemon.rs

1 participant