Skip to content

refactor(subagent): split manager.rs monolith into focused modules#4906

Merged
bug-ops merged 3 commits into
mainfrom
split-subagent-manager
Jun 6, 2026
Merged

refactor(subagent): split manager.rs monolith into focused modules#4906
bug-ops merged 3 commits into
mainfrom
split-subagent-manager

Conversation

@bug-ops

@bug-ops bug-ops commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary

Changes

File Change
manager.rs Deleted — replaced by manager/ directory
manager/mod.rs SubAgentManager struct, fields, ctor, setters, re-exports, all test modules
manager/spawn.rs spawn, resume (+instrument), cancel, spawn_for_task, MemoryAwareExecutor
manager/collect.rs collect, transcript finalization, status queries
manager/worktree.rs WorktreeCleanupGuard and lifecycle helpers
manager/secrets.rs Secret request/approval plumbing
def.rs Add SubAgentDef::for_test(name: &str) -> Self
transcript.rs utc_nowpub(crate), remove utc_now_pub
zeph-orchestration (5 files) Replace local make_def/make_agent helpers with SubAgentDef::for_test

Test plan

  • cargo build --workspace — clean
  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace -- -D warnings — clean
  • RUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler — clean
  • cargo nextest run --workspace --lib --bins — 10513 passed, 21 skipped
  • cargo test --doc -p zeph-subagent — 23 passed
  • Public API surface (lib.rs) byte-identical to main
  • Adversarial critic review: behavior preserved, no semantic drift

Closes #4882
Closes #4887

@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes refactor Code refactoring without functional changes size/XL Extra large PR (500+ lines) labels Jun 6, 2026
@bug-ops
bug-ops force-pushed the split-subagent-manager branch from 4511cf2 to e5ff37b Compare June 6, 2026 11:07
@bug-ops
bug-ops enabled auto-merge (squash) June 6, 2026 11:09
bug-ops added 3 commits June 6, 2026 13:16
…r_test

Split crates/zeph-subagent/src/manager.rs (5732 lines) into a focused
module hierarchy under manager/:
- spawn.rs   — spawn, resume, cancel, spawn_for_task, prompt helpers,
               MemoryAwareExecutor
- collect.rs — result collection, transcript finalization, status queries
- worktree.rs — WorktreeCleanupGuard and worktree lifecycle helpers
- secrets.rs  — secret request/approval plumbing
- mod.rs     — SubAgentManager struct, fields, ctor, setters, re-exports;
               all #[cfg(test)] modules kept here

Additional changes in the same commit:
- Add #[tracing::instrument] to SubAgentManager::resume with span name
  "subagent.manager.resume" (was missing, critical lifecycle path)
- Make transcript::utc_now pub(crate); remove utc_now_pub wrapper and its
  doc-test; update 5 callers
- Add SubAgentDef::for_test(name) constructor (plain pub) in def.rs;
  replace 5 duplicated test helpers across zeph-orchestration (scheduler,
  planner, tick, router x2)

Closes #4882
Closes #4887
@bug-ops
bug-ops force-pushed the split-subagent-manager branch from 42c0f21 to dc5f51b Compare June 6, 2026 11:16
@bug-ops
bug-ops merged commit 42f60d1 into main Jun 6, 2026
32 checks passed
@bug-ops
bug-ops deleted the split-subagent-manager branch June 6, 2026 11:24
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 rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

1 participant