Skip to content

Commit 74b63e1

Browse files
klopez4212wesbillmanPrincess Donut
authored
Refactor managed-agent runtime into cohesive modules (#2974)
## Summary - split the managed-agent runtime warehouse into cohesive modules for process ownership/termination, orphan sweeping, dead-instance reaping, lifecycle synchronization, and runtime metadata - preserve the existing `runtime` API through narrow re-exports; helper bodies and platform `cfg` branches are unchanged apart from module-qualified visibility - reduce `runtime.rs` from 2,220 lines on `main` to 908 lines and remove its temporary file-size override, restoring the standard 1,000-line ceiling ## Why `main` failed after stale successful PR checks allowed independent growth to combine above `runtime.rs`'s 2,216-line override. The earlier fix in #2974 extracted only 55 lines and left the monolith on a special ratchet. This replacement includes that extraction but establishes responsibility boundaries and removes the exception entirely. ## Module boundaries - `process.rs` — process identity, ownership markers, receipt validation, and termination primitives - `orphan_sweep.rs` — same-instance orphan discovery and cleanup - `instance_reaper.rs` — foreign/dead desktop instance detection and agent reaping - `lifecycle.rs` — tracked runtime synchronization and stale record cleanup - `metadata.rs` — model/provider metadata resolution - `runtime.rs` — summary/config/spawn orchestration and composition ## Validation At `a824fda31eff6ecc0d39ca1b8ea5602a108897e6`: - pre-push `desktop-check` - pre-push `desktop-test` - pre-push full `desktop-tauri-test`: 1,637 passed, 0 failed, 14 ignored; integration + doc tests passed - `cargo check --manifest-path desktop/src-tauri/Cargo.toml --lib` - `cargo fmt --manifest-path desktop/src-tauri/Cargo.toml --all -- --check` - `node desktop/scripts/check-file-sizes.mjs` Supersedes #2974 and #2930. Signed-off-by: Wes <[email protected]> Co-authored-by: Wes <[email protected]> Co-authored-by: Princess Donut <68157ebd23b3897c1991015c3038658ea916200c67d3a54620b0754d1b92f6e0@buzz.block.builderlab.xyz>
1 parent dd222a5 commit 74b63e1

7 files changed

Lines changed: 1364 additions & 1349 deletions

File tree

‎desktop/scripts/check-file-sizes.mjs‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,6 @@ const overrides = new Map([
119119
// helpers) replace the pubkey-keyed PID file, plus the hashed pair-scoped
120120
// runtime log path. Load-bearing crash-recovery surface; queued to split.
121121
["src-tauri/src/managed_agents/storage.rs", 1383],
122-
// harness-persona-sync: persona-runtime resolution threaded into the spawn
123-
// path here. Load-bearing feature growth; queued to split in the resolver
124-
// unify refactor followup. +26 for resolve_effective_prompt_model_provider
125-
// re-introduced after 826d735fe removal (config-bridge caller still needs it).
126-
// PGID resolution helper + PID-recycling safety guard added for orphan sweep.
127-
// activity-feed threads avatar_url into build_managed_agent_summary for the
128-
// assistant-bubble pinned snapshot.
129-
// +1 for agent_pubkey field in setup payload (config-nudge card wire).
130-
// persona-blank-fallback: resolve_effective_prompt_model_provider gains a
131-
// record_provider param + applies persona_field_with_record_fallback. +5 lines.
132-
// global-agent-config: spawn_agent_child loads global config and merges as
133-
// lowest env layer (+8 lines). Queued to split.
134-
["src-tauri/src/managed_agents/runtime.rs", 2216],
135122
// config-bridge setup-payload env-boundary fix adds readiness wiring in
136123
// spawn_agent_child; load-bearing security fix, queued to split.
137124
["src-tauri/src/managed_agents/config_bridge/reader.rs", 1016],

0 commit comments

Comments
 (0)