Skip to content

Split execution/process_identity.py and async_retirement.py out of child_process.py - #5278

Merged
trissim merged 1 commit into
mainfrom
perf/split-process-identity
Nov 28, 2026
Merged

trissim merged 1 commit into
mainfrom
perf/split-process-identity

Conversation

@trissim

@trissim trissim commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Cut 8 of Core cold-start optimization: splits lightweight OS process identity/inspection (src/agent_comms/execution/process_identity.py) and async retirement joins (src/agent_comms/execution/async_retirement.py) out of src/agent_comms/execution/child_process.py so identity-only callers never pull in child-spawning, multiprocessing, helper workers, systemd units, or repository launch machinery.

Key changes

  • Extracted ProcessIdentity, NoProcess, ProcessName, ProcessState, ProcessPlatform, ProcessOperations, ProcfsRecord, ResidentMemory, ProportionalMemory, and STOP_GRACE_SECONDS into src/agent_comms/execution/process_identity.py.
  • Extracted AsyncWork, join_retirement, and ChildRetirementError hierarchy into src/agent_comms/execution/async_retirement.py.
  • Factored CurrentPlatform mixin in src/agent_comms/execution/host_platform.py so HostPlatform, ProcessPlatform, and Platform share current() with zero P38 duplication.
  • Migrated all callers across src/, tests/, tools/, and stack/ and removed all 15 unused TIME-3 re-export aliases from child_process.py (keeping only direct imports child_process.py itself uses, which also cover comms-tui's join_retirement / ProcessName imports).

Cold-start measurements (alternating warm runs, main@451677aefc -> perf/split-process-identity)

  • agent_comms.cli_verbs.who: 648 -> 630 modules (-18), child_process True -> False, 1004.4 -> 984.0 ms
  • agent_comms.cli_verbs.send: 440 -> 420 modules (-20), child_process True -> False
  • agent_comms.cli_verbs.channels: 409 -> 389 modules (-20), child_process True -> False
  • agent_comms.registry.registry_store: 616 -> 598 modules (-18), child_process True -> False, 947.3 -> 872.1 ms (-75.2 ms)
  • agent_comms.thread_views: 601 -> 583 modules (-18), child_process True -> False, 863.2 -> 773.2 ms (-90.0 ms)

Verification

  • 964/964 agent_comms modules import with 0 errors; 0 broken imports across src/, tests/, tools/, stack/; 36 CarryChain steps; REL_IMPORTS=0.
  • 102 passed, 1 skipped (test_runtime_processes, test_process_names, test_backend_native_child, test_host_services, test_sealed_mechanisms, test_declarations, test_bus_resource_claims) + 43 passed (test_child_process, test_helper_workers) = 145 focused tests passed.
  • NRA findings on host_platform + child_process + process_identity + async_retirement: 0 new findings (deleted P38 current() duplication across platform families).

@trissim
trissim merged commit 5acf752 into main Nov 28, 2026
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.

1 participant