Skip to content

Refactor managed-agent runtime into cohesive modules - #2974

Merged
wesbillman merged 1 commit into
mainfrom
kennylopez-fix-desktop-runtime-file-size
Jul 26, 2026
Merged

Refactor managed-agent runtime into cohesive modules#2974
wesbillman merged 1 commit into
mainfrom
kennylopez-fix-desktop-runtime-file-size

Conversation

@klopez4212

@klopez4212 klopez4212 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

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.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants