Skip to content

refactor(zeph-core): decompose Agent struct and remove anyhow (#1731, #1732)#1743

Merged
bug-ops merged 1 commit intomainfrom
arch-codebase-architecture-im
Mar 14, 2026
Merged

refactor(zeph-core): decompose Agent struct and remove anyhow (#1731, #1732)#1743
bug-ops merged 1 commit intomainfrom
arch-codebase-architecture-im

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 14, 2026

Summary

Phase 1 of epic #1741 (arch: codebase architecture improvements).

Changes

Agent struct decomposition (#1731)

Agent<C> retains core identity fields. Loose fields moved to named sub-structs:

Sub-struct Fields Concern
LifecycleState shutdown, cancel_token, warmup_ready, config_path, watchers Lifecycle management
ProviderState summary_provider, judge_provider, cached_prompt_tokens, stt Provider state
MetricsState metrics_tx, cost_tracker, token_counter Metrics collection
OrchestrationState pending_graph, plan_cancel_token, subagent_manager Multi-agent orchestration

anyhow removal (#1732)

New type Location Replaces
VaultError vault.rs anyhow::Error in VaultProvider trait
BootstrapError bootstrap/provider.rs anyhow::Result in all bootstrap functions
DaemonError daemon.rs anyhow::Result in ComponentHandle

Remaining anyhow usage in subagent/ and config_watcher.rs tracked in #1742.

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace --features full -- -D warnings — clean
  • cargo nextest run --workspace --features full --lib --bins — 5423 passed, 12 skipped
  • Architecture reviewed, adversarially critiqued, performance/security/testing validated
  • Code review approved after fixes (R-I1: removed dead BootstrapError::Vault, R-I2: tightened visibility to pub(super), R-I3: created follow-up refactor(zeph-core): complete anyhow removal from subagent/ and config_watcher.rs #1742)

Related

@github-actions github-actions bot added rust Rust code changes core zeph-core crate refactor Code refactoring without functional changes size/XL Extra large PR (500+ lines) labels Mar 14, 2026
…re modules

Closes #1731, partially closes #1732 (remaining: #1742).

Agent struct decomposition (#1731):
- Add LifecycleState (shutdown, cancel_token, warmup, config_path, watchers)
- Add ProviderState (summary_provider, judge_provider, cached_prompt_tokens, stt)
- Add MetricsState (metrics_tx, cost_tracker, token_counter)
- Add OrchestrationState (pending_graph, plan_cancel_token, subagent_manager)
- Update all field access sites across agent/* submodules

anyhow removal from core modules (#1732):
- Add VaultError to vault.rs; update VaultProvider trait signature
- Add BootstrapError to bootstrap/provider.rs; update all bootstrap functions
- Add DaemonError to daemon.rs; update ComponentHandle
- Update ConfigError::Vault to use VaultError instead of anyhow::Error
- Remaining anyhow usages in subagent/ and config_watcher.rs tracked in #1742
@bug-ops bug-ops force-pushed the arch-codebase-architecture-im branch from 5318dc6 to 99aef6d Compare March 14, 2026 13:29
@bug-ops bug-ops enabled auto-merge (squash) March 14, 2026 13:29
@bug-ops bug-ops merged commit 35017b8 into main Mar 14, 2026
15 checks passed
@bug-ops bug-ops deleted the arch-codebase-architecture-im branch March 14, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate refactor Code refactoring without functional changes rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove anyhow from zeph-core library crate Decompose Agent struct: extract ProviderState, SessionState, UiState, OrchestrationState

1 participant