Skip to content

fix(native): retain failed command cleanup owners - #1713

Merged
N0zoM1z0 merged 1 commit into
mainfrom
fix/native-command-cleanup-owner-20261011
Oct 11, 2026
Merged

N0zoM1z0 merged 1 commit into
mainfrom
fix/native-command-cleanup-owner-20261011

Conversation

@N0zoM1z0

Copy link
Copy Markdown
Collaborator

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T05:32:29.948345Z b70c5cd PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +268 to +269
const commandCleanup = await this.#retryNativeCommandCleanup();
let result = await this.tracer.close();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@N0zoM1z0
N0zoM1z0 merged commit d9b4ae1 into main Oct 11, 2026
31 checks passed
@N0zoM1z0
N0zoM1z0 deleted the fix/native-command-cleanup-owner-20261011 branch October 11, 2026 05:39
@morluto morluto mentioned this pull request Oct 13, 2026
3 tasks done
@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants