Skip to content

fix(native): recover macOS command deadlines - #6059

Merged
morluto merged 5 commits into
mainfrom
cursor/native-macos-deadlines-9c89
Oct 21, 2026
Merged

morluto merged 5 commits into
mainfrom
cursor/native-macos-deadlines-9c89

Conversation

@morluto

@morluto morluto commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

Part of #5910 (parent #5808). macOS native commands, native UI observation, and offline pwntools commands now take a validated per-call deadline at today's default. Fixed byte, CPU, LLDB grace, and plist probe caps stay at the same numbers and say there is no runtime override.

The native command setting is native_command_timeout_ms, not command_timeout_ms. That name already means the separate objdump/rizin deadline (default 120000) and is also used by WABT.

Review follow-up on this branch: xcrun --find uses the selected native command deadline; pwndbg failure text uses the selected pwntools deadline; UI limitations state that deadline and the fixed 180000 ms wait-step cap separately; SIGXFSZ/EFBIG recovery names outputBytes and file_size_bytes. The UI helper compile and capture subprocesses use the selected native_ui_deadline_ms, and an exec timeout is reported as that deadline. A Darwin ownership-helper preparation timeout uses the selected native_command_timeout_ms and the same recovery as a later command timeout, including cleanup details. Memory resource-constraint recovery names memory. The Darwin plist input-allowance CLI expectation matches the byte-counted allowance.

Problem and expected behavior

Those three wall clocks were fixed constants. A caller who needed a longer command, UI observation, or pwntools run could not raise them, and the failure text did not name a setting, the effective milliseconds, the range, or the sibling caps that stay fixed.

Omitted values stay 60000, 180000, and 30000 ms. An integer from 1 to 2147483647 applies on the next call. CLI flags are --native-command-timeout-ms, --native-ui-deadline-ms, and --pwntools-timeout-ms.

Change and scope

Domain schemas own the three fields. Native macOS command dispatch, UI interruption, and the pwntools decoder read the selected deadline. Recovery names the setting, the effective milliseconds, the range, the omitted default, and that a change applies on the next call.

resolveXcrunTool receives the same timeoutMs as the resolved tool, so a short deadline cannot spend 60000 ms in xcrun --find and a long deadline is not reported as if resolution had waited for it. inspectPwndbgCore puts that effective pwntools_timeout_ms on its failure context. Successful UI observations name the selected native_ui_deadline_ms and, separately, the fixed wait-step cap. File-size recovery names the reported file_size_bytes when present and the outputBytes cap (67108864), including when a tighter inherited limit applies. Both UI helper stages receive that same UI deadline. Preparation failure reports the selected command deadline. Memory recovery keeps the budget sentence and includes the word memory.

Follow the contribution scope. Maintainer scope decision: not applicable. This stays inside existing native inspection, UI observation, and offline pwntools boundaries. It does not add target execution, injection, mutation, or protection recovery.

Intentionally not included: MCP transport, provider engines, JavaScript, Android, browser, swiftc, ASAR/hdiutil, and objdump/rizin command_timeout_ms.

Contract and boundary impact

  • Semantic owner and earliest changed stage: native command, UI, and pwntools input schemas validate the deadline before the owned command starts. Tool resolution and both UI helper subprocesses use that selected deadline.
  • Contribution scope fit and linked maintainer decision: ordinary recovery inside existing operations; not applicable.
  • CLI and MCP/tool-catalog contract: optional input fields and matching CLI flags. Omission keeps the previous deadline. Catalog JSON is generated in CI.
  • Provider, bridge, target-format, or platform compatibility: macOS Xcode tools and Linux pwntools use the same numeric defaults. No bridge protocol change.
  • Evidence, artifact, provenance, or reconstruction contract: UI observation limitations state the selected deadline. Evidence parameters omit an unspecified deadline.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): none. The deadline does not raise output, CPU, address-space, or plist allowances. Preparation timeout still retains an owned cleanup marker.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none authored. CI regenerates catalogs from the tool contracts.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: deadline schema and omitted defaults; list_architectures passes 60000 or the selected native_command_timeout_ms and rejects 0 before launch; production XcrunCommandRunner resolution records 120000 or the omitted 60000 on xcrun --find; UI timeout text names native_ui_deadline_ms and --native-ui-deadline-ms; successful UI evidence states 2500 ms or the omitted 180000 ms and the fixed 180000 ms wait-step cap; both helper subprocesses receive 250000 ms or the omitted 180000 ms; an ETIMEDOUT helper failure reports 2500 ms; a preparation timeout at 1500 ms reports that deadline and keeps cleanup incomplete until the marker resolves; pwntools timeout text names pwntools_timeout_ms and leaves cpuSeconds 30 fixed; a pwndbg timeout at 60000 ms and a recorded-crash debugger timeout at 1500 ms report that deadline; SIGXFSZ/EFBIG remediation names file_size_bytes and outputBytes (67108864); memory marker and resource-limit replies include memory and the address-space allowance; CLI help advertises the three flags; plist allowance names include no runtime override, including the Darwin input-allowance CLI expectation.
  • Base reproduction or other evidence: source inspection of NATIVE_COMMAND_TIMEOUT_MS 60000, NATIVE_UI_DEADLINE_MS 180000, and PWNTOOLS_LIMITS.timeoutMs 30000. Those defaults are unchanged. The Python worker file cap is outputBytes (67108864), not addressSpaceBytes. On head 4bd8cbed, CI required failed because binary_layout / real-binary-layout required the word memory in a memory resource_constraint remediation, and Real Apple artifact CLI/MCP E2E expected the shorter plist input-allowance sentence. Both failures come from this PR's wording.
  • User-visible CLI/MCP output (if applicable): rea inspect-macho --help prints --native-command-timeout-ms and states the omitted 60000 ms default, the 1..2147483647 range, and that it is distinct from objdump/rizin command_timeout_ms. A successful UI observation limitation names the selected native_ui_deadline_ms and the fixed wait-step cap.
  • Remaining proof gaps: darwin-only plist CLI cases were not executed on this Linux host. The scripts/verify-binary-layout.mjs memory case was not re-run here; it needs pwntools and prlimit. No real Xcode, LLDB, or pwntools process was timed out. The recorded-crash debugger timeout used a fixture launcher. CI on this push was not waited on.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run check:fast — passed (typecheck and lint) on this revision, after merging origin/main (a0214e0e0).
  • npx oxfmt --check on the edited files — passed.
  • npm run test:focused for src/native/NativeUiHelperRuntime.test.ts, src/native/NativeUiObservation.test.ts, src/native/NativeUiInterruptionControl.test.ts, src/native/pwntools/PwntoolsFailures.test.ts, tests/boundary/providers/native/nativeProvider.test.ts, tests/boundary/binaryDiagnostics/pwntoolsLayoutProvider.test.ts, and tests/boundary/cli/nativePlistSelectionFailureCli.test.ts — 6 files passed, 1 skipped; 139 passed, 13 skipped. The plist CLI file skipped on this Linux host. NativeUiObservation.test.ts was rerun after the lint move: 30 passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Omitted arguments keep the previous deadlines. New fields are optional.
  • Real Hopper/Ghidra, browser, or OS coverage: not run. Deadline selection is covered by fixture command runners and projected timeout errors. Resolution, both helper stages, and the following tool command each receive the full selected deadline.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: a longer deadline only extends the existing owned-command wall clock. It does not raise cpuSeconds 30, byte allowances, address space, or plist caps.

Author readiness

Human owner: @morluto

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.
Open in Web Open in Cursor 

Promote native_command_timeout_ms (default 60000), native_ui_deadline_ms
(default 180000), and pwntools_timeout_ms (default 30000) as validated
per-call settings. Keep cpuSeconds, byte allowances, LLDB grace, and plist
probes fixed, and say those caps have no runtime override.

Co-authored-by: morluto <morluto@users.noreply.github.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-21T18:57:05.562978Z 4fc3dc8 New commits
ℹ️ 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: 4803c81071

ℹ️ 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 thread src/native/CommandRunner.ts Resolved
Comment thread src/native/pwntools/PwntoolsDecoder.ts Resolved
Comment thread src/native/NativeMacOSProvider.ts Resolved
@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge; no actionable issue remains from this review.

Summary

Adds optional per-call deadlines for macOS native commands, native UI observations, and offline pwntools commands.

  • macOS native commands use the deadline each caller selects.
  • Native UI observations and scenarios use the deadline each caller selects.
  • Offline pwntools commands use the deadline each caller selects.
  • Fixed-limit messages name their caps and say they have no runtime override.

Source review found no new actionable or security issue. No runtime tests were run during this review. Whether this PR was superseded could not be verified because GitHub access was unavailable.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Input["CLI or MCP input"] --> Schema["Validate optional deadline"]
  Schema --> Native["Native command deadline"]
  Schema --> UI["UI operation deadline"]
  Schema --> Python["pwntools command deadline"]
  Native --> Lookup["xcrun lookup"]
  Native --> Command["Resolved tool"]
  UI --> Prepare["Compile helper"]
  UI --> Capture["Captures and waits"]
  Python --> Decoder["Offline decoder"]
  Python --> Debugger["Optional core-only debugger"]
  Lookup --> Result["Result or error with selected deadline"]
  Command --> Result
  Prepare --> Result
  Capture --> Result
  Decoder --> Result
  Debugger --> Result
Loading

Reviews (3) · Last reviewed commit: "fix(native): honor the selected deadline..." · Reviewed by Greptile

Comment thread src/native/CommandRunner.ts Resolved
Comment thread src/native/pwntools/PwntoolsDecoder.ts Resolved
Comment thread src/native/pwntools/PwntoolsFailures.ts Resolved
Comment thread src/native/NativeUiObservation.ts Resolved
…eadlines-9c89

Co-authored-by: morluto <morluto@users.noreply.github.com>
Pass the selected native command timeout through xcrun resolution, thread
the pwntools deadline into pwndbg failures, and state the selected UI
deadline apart from the fixed wait-step cap. SIGXFSZ and EFBIG recovery
names the file-size allowance.

Co-authored-by: morluto <morluto@users.noreply.github.com>

@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: 4bd8cbed55

ℹ️ 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".

Comment thread src/native/NativeUiHelperRuntime.ts Resolved
Comment thread src/native/NativeMacOSProvider.ts Resolved
cursoragent and others added 2 commits October 21, 2026 18:47
…eadlines-9c89

Co-authored-by: morluto <morluto@users.noreply.github.com>
The UI helper compile and capture subprocesses used fixed 60s and 30s
exec timeouts, so a longer native_ui_deadline_ms still failed as a generic
provider error. Preparation timeouts reported the 60000 ms default instead
of the selected native_command_timeout_ms.

Memory resource-constraint recovery names memory again, and the Darwin
plist CLI expectation matches the byte-counted input allowance.

Co-authored-by: morluto <morluto@users.noreply.github.com>
@morluto
morluto merged commit ae09e3f into main Oct 21, 2026
37 of 39 checks passed
@morluto
morluto deleted the cursor/native-macos-deadlines-9c89 branch October 21, 2026 18:59
@morluto morluto added area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working labels Nov 23, 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