Skip to content

feat(runtime): add managed child process registry#905

Closed
luoye520ww wants to merge 2 commits into
KunAgent:developfrom
luoye520ww:codex/managed-child-process-registry
Closed

feat(runtime): add managed child process registry#905
luoye520ww wants to merge 2 commits into
KunAgent:developfrom
luoye520ww:codex/managed-child-process-registry

Conversation

@luoye520ww

Copy link
Copy Markdown
Collaborator

Problem

The new managed-child contract needs a single owner for live child records before shell, LSP, Whisper, extension-host, and subagent integrations can share shutdown and cancellation handling.

Scope

This PR adds the in-memory registry on top of the contract from #903. It does not start, signal, or terminate OS processes.

Changes

  • Register validated child records and reject duplicate IDs.
  • Support owner-scoped listing and lifecycle updates for PID, detach state, and cleanup policy.
  • Return defensive snapshots so callers cannot mutate registry state.
  • Make remove and drain idempotent for repeated shutdown paths.

Safety

  • Records are validated by the strict shared contract before insertion.
  • No command, environment, token, path, or process output is stored.
  • drain() only returns records for caller-owned cleanup; it never performs termination itself.

Typecheck

npm.cmd run typecheck

Passed.

Tests

npm.cmd exec vitest run src/main/services/managed-child-process-registry.test.ts
npm.cmd run lint
npm.cmd run build
git diff --check

Passed: 4 registry tests; root lint and build passed; diff check passed.

Review performed

  • Functional correctness
  • Registry ownership and lifecycle boundaries
  • Idempotent cleanup behavior
  • Data and secret safety
  • Cross-platform contract compatibility
  • Test quality and PR scope

Non-goals

  • Process spawning or termination
  • Shell, LSP, Whisper, extension-host, or subagent integration
  • Persistence across application restarts

Dependency

Depends on #903 for ManagedChildProcess contract. After #903 merges, this branch should be rebased onto develop and the dependency commit dropped.

@luoye520ww

Copy link
Copy Markdown
Collaborator Author

Superseded by consolidated tool/process lifecycle PR #946, which passed Typecheck, Linux, macOS, and Windows packaged checks. Closing this duplicate to keep the review surface focused.

@luoye520ww luoye520ww closed this Jul 14, 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