[2/3] fix: protect background sessions and record resource history - #457
slashdevcorpse wants to merge 9 commits into
Conversation
Model: gpt-6
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f291ca2dc1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ): Promise<void> { | ||
| if (this.deps.platform === 'win32') { | ||
| await this.runWindowsTaskkill(pid, force); | ||
| await terminateWindowsChildProcess(child, force); |
There was a problem hiding this comment.
Keep Windows descendant processes under cleanup ownership
On Windows, every sandboxed ACP and terminal launch now routes through this call, but terminateWindowsChildProcess only waits for the root child and does not terminate descendants; the removed implementation used taskkill /T. An agent that spawned an app-server, MCP server, or shell child can therefore be reported as cleaned and removed while those processes remain alive after GC or daemon shutdown. Use spawn-time Job Object ownership or another tree-aware primitive before treating root exit as successful cleanup.
AGENTS.md reference: apps/cli/src/session/AGENTS.md:L249-L252
Useful? React with 👍 / 👎.
|
@slashdevcorpse, this pull request was closed because it did not meet Lody's contribution requirements for 7 days. Open a new pull request using the current template to continue contributing this change. This pull request will not be reopened. |
Related issue
Refs #429
Problem / pressure
Idle and memory-pressure eviction can discard a session after its parent turn finishes even when a background task or ACP terminal watch remains active. Current resource snapshots also disappear without a bounded record of process identity, resource use, or cleanup outcome.
Summary
Dependency order
Windows process lifecycle series for #429, in bottom-to-top order:
All three PRs are submitted to LodyAI/Lody. Their source branches have linear ancestry. Because GitHub does not support native cross-fork stacks, each PR targets upstream main and later PRs include predecessor changes until those land.
Review the individual layers:
The complete series is required for Windows descendant and crash ownership. The former fork PRs slashdevcorpse#2, #3 and #4 are superseded by this upstream series.
Test plan
Context handoff
Instructions for reviewing agents
Authoring context
Latest review verification
At f291ca2, the stack includes the eight latest the first PR review resolutions from 720e84c: PTY admission/draining and retry retention, authentication cleanup ownership, startup owner admission, spawn-error handling, explicit Windows termination semantics and non-retryable cleanup failures. the third PR supplies the requested descendant Job Object ownership. Local composed verification and exact-head fork CI Static checks, Tests and Desktop E2E all passed. Upstream CI on these recreated PRs is evaluated separately. The top PR also passed Windows x64, Windows ARM64 and the same-run dual-architecture npm archive verification.