Harden managed profile process cleanup - #1
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2087e57b1d
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| capturedProcesses.append( | ||
| contentsOf: verifiedAuxiliaryProcesses( | ||
| configuration: configuration, | ||
| processSnapshot: auxiliarySnapshot | ||
| excluding: Set(processIDs), | ||
| in: try processTreeProvider.processTreeSnapshot() | ||
| ) | ||
| } | ||
| ) | ||
| capturedProcesses = Array(Set(capturedProcesses)) |
There was a problem hiding this comment.
Capture helpers that appear after the final snapshot
When a verified profile helper starts or respawns after this second snapshot—for example, while the main application is terminating—it is never added to capturedProcesses, so it receives neither this SIGTERM nor the later SIGKILL. remainingProcesses nevertheless rediscovers the helper on every poll, meaning a helper that remains alive forces closeTimedOut; when cleanup was initiated by open, this also prevents the replacement instance from launching. Refresh and signal newly verified stable identities during the wait or kill phase rather than freezing the captured set here.
AGENTS.md reference: AGENTS.md:L19-L20
Useful? React with 👍 / 👎.
Summary
Root cause
Profile process discovery recognized app-bundle processes carrying the configured user-data argument, but a profile-local Computer Use helper can execute from the profile state directory without that argument. Once detached from the main process tree, that helper could remain running after the profile was closed.
Validation
swift test— 176 tests passed, 6 opt-in tests skipped./script/build_app.sh./script/package_app.shPrivacy and Security