Repository navigation
fix(native): retain failed command cleanup owners - #1713
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b70c5cd000
ℹ️ 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".
| const commandCleanup = await this.#retryNativeCommandCleanup(); | ||
| let result = await this.tracer.close(); |
There was a problem hiding this comment.
Share concurrent native client close attempts
When close() is called concurrently, each invocation independently reaches this retry because the client has no cached close promise. The serialized UI cleanup can allow the first command-cleanup attempt to finish before the second arrives, so an owner that fails once and succeeds on retry can make one close report a stale cleanup failure while the other succeeds; both calls also invoke tracer.close(). Cache the in-flight close attempt, resetting it after completion so a later close can still retry genuinely incomplete cleanup.
AGENTS.md reference: AGENTS.md:L17-L17
Useful? React with 👍 / 👎.
Native command capture kept partial output and cleanup diagnostics but discarded the typed process supervisor when converting
OwnedCommandFailure. The xcrun resolver wrapped that failure again, also losing the owner. The runner now retains failed owners from both launches, retries every retained supervisor before another command, and reports every still-incomplete cleanup without discarding resources or reasons.Native clients and Mach-O slice readers wait for their own launched commands at close before the final cleanup retry. Closed consumers cannot launch more commands; cleanup failures remain retryable on subsequent close. The shared runner stays usable by other clients, and active commands are not cancelled by another client's close. Named failure options carry cleanup ownership without adding positional constructor arguments. Reader cleanup uses an explicit failure observation instead of an undefined sentinel; even an undefined rejection now reports cleanup failure and still closes the source. Remove the weaker standalone projection test after the concurrent-close workflow covers that same retry behavior.
Validation: 42 focused native runner/provider/slice-reader tests, including real Linux child-process output, selected environment, cancellation, signal termination and output-budget controls. Injected launch/cleanup failures exercise the production capture/supervisor boundary, xcrun resolution, two retained owners, blocked relaunch, recovery, concurrent close and complete diagnostic projection. A controlled red/green probe removed only owner transfer and reproduced the missing-owner assertion, then restored the source. Pinned single-thread typecheck, full lint/module boundaries, architecture guards and formatting passed. Built REA also passed complete CLI/SDK-MCP JavaScript controls on a 6,686-byte target. A 2,197-byte ZIP artifact containing a tiny ELF also passed complete CLI/SDK-MCP result parity and session close; the ELF CLI inspection succeeded separately. Actual macOS Xcode tools and a real kernel cleanup failure were not reproduced locally; injected provider tests do not establish those behaviors.
Refs #740.