Skip to content

fix(windows): classify native readiness failures by stage - #2108

Closed
AICodeLion wants to merge 15 commits into
morluto:mainfrom
AICodeLion:codex/windows-native-diagnostics
Closed

AICodeLion wants to merge 15 commits into
morluto:mainfrom
AICodeLion:codex/windows-native-diagnostics

Conversation

@AICodeLion

Copy link
Copy Markdown

When a valid Windows x64 installation fails native inspection—for example cleanup reports ERROR_DIR_NOT_EMPTY (145)—Ghidra currently reports unsupported_host and suggests replacing the package. Classify the loader failure at its producing boundary: host incompatibility remains unsupported_host; native artifact admission uses runtime_missing; self-test or inspection failure uses the additive runtime_unavailable provider rejection code and runtime_failure doctor classification. Preserve the original native error and provide stage-specific remediation.

Doctor, provider availability, advertised capabilities and client prerequisites now consume one readiness observation per query. Windows capability reports reuse one security snapshot. This avoids retrying a transient self-test inside a report and combining availability from one observation with a reason from another. Valid Ghidra/Java registration settings remain preserved, and failed security controls still prevent provider admission.

Validation:

  • 124 tests pass across loader admission, Ghidra doctor/provider behavior, Windows capability reports, doctor and provider registry. Includes Win32 145/permission error retention, all failure stages, stable artifact failures, provider-scoped diagnostics, health failure and single-observation checks.
  • npm run check:fast, npm run check (including architecture guards), npm run build:cached, npm run docs:check and git diff --check pass.
  • Real Windows x64 smoke with the integrity-verified published REA 6.4.0 native addon: an intentionally nonexistent TMP causes a native Win32 2 self-test failure; compiled doctor projection reports runtime_unavailable/runtime_failure and preserves the operation/path/error. Restoring TMP allows the same process to recover on a later query. Ghidra installation was a fixture; no real Ghidra engine or newly built C++ artifact is claimed.

Scope: diagnostics only. Native directory deletion, cleanup ownership, cache retry policy and fail-closed security behavior are unchanged. Refs #1701; the underlying delete-by-handle design remains a separate issue.

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

@greptileai review

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new blocking defect was found.

Summary

This PR labels Windows native failures at the stage that produced them and shares readiness observations across related diagnostics.

  • Native readiness reports name the stage that failed.
  • Provider reports build availability and capabilities from one readiness check.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Windows native loader] --> B{Failure stage}
  B -->|Host| C[unsupported_host]
  B -->|Artifact| D[runtime_missing]
  B -->|Self-test or inspection| E[runtime_unavailable]
  A -->|All checks pass| F[Native readiness available]
  C --> G[Shared readiness observation]
  D --> G
  E --> G
  F --> G
  G --> H[Doctor checks]
  G --> I[Provider availability and capabilities]
  G --> J[Windows security report]
Loading

Reviews (12) · Last reviewed commit: "Merge branch 'main' into codex/windows-n..." · Reviewed by Greptile

@morluto
morluto marked this pull request as ready for review October 13, 2026 11:48
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 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-13T19:18:26.494986Z 85e24b9 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: 7088df06f5

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

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

ℹ️ 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/windows/WindowsNativeLoader.ts Resolved

@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: 5c3ff89a9b

ℹ️ 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/process/WindowsAuthority.ts Resolved
@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open.

  1. thread 1

Fixed in 4f2f1834a87bbfb94e934d556ae9202ac405b28d. Candidate status independently observed availability and capability readiness, allowing a retry between fields. AnalysisProviderCandidate now has a provider-owned readiness snapshot contract. Ghidra observes Windows native readiness once per snapshot and projects both availability and capabilities from it; the registry consumes the snapshot as one observation. Installation failures retain their existing rejection, and independent future queries can still retry.

Validation: inspected the producing boundary and affected consumers; existing expectations were adjusted where the contract changed. Tests, mutation runs, builds, lint, typecheck and CI reruns were skipped at the user's explicit request. No new real-provider verification is claimed. This source correction does not settle separate integration authority or mutation-generation/score proof requirements.

@morluto morluto added bug Something isn't working area: runtime Process capture and runtime observation area: cli CLI adapter and one-shot commands area: server Server layer and tool wiring P2: medium Medium priority issue labels Oct 13, 2026
Comment thread src/process/WindowsAuthority.ts Resolved
Comment thread src/ida/IdaDoctor.ts Resolved

@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: 69b87c4753

ℹ️ 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/android/JadxConfiguration.ts Resolved
Comment thread src/contracts/providerSelection.ts Resolved
Comment thread src/ida/IdaDoctor.ts Resolved
@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Source fixes and publication evidence for the review findings below. Tests and executable checks were skipped at the maintainer's request. Findings that still require a decision or execution evidence remain open.

review thread

Fixed in the verified live source head 69b87c4. JADX mapped all Windows native readiness failures to runtime_missing. Its availability boundary now uses inspectWindowsNativeReadiness and preserves runtime_missing/runtime_unavailable plus failure stage and remediation. Prior history is preserved. Tests, builds, checks and provider runs were skipped as required; no additional source cleanup remains.

review thread

Fixed in the verified live source head 69b87c4. The private runtime readiness projection discarded tagged code/failureStage. IDA provider and doctor now consume the preserved readiness: missing artifact maps runtime_missing and failed self-test maps runtime_unavailable/runtime_failure. Prior history is preserved. Tests, builds, checks and provider runs were skipped as required; no additional source cleanup remains.

morluto and others added 3 commits October 14, 2026 00:52
* fix(comparison): preserve incomplete function call evidence

Keep missing, unknown, partial and unresolved call relationships unknown in function comparisons and reconstruction claims. Aggregate IDA caller and callee coverage without overwriting uncertainty.

Validate with 144 focused tests, typecheck/lint, docs checks and test discovery. Real providers were not verified; the full headless IDA session suite requires unavailable Windows native controls.

* fix(comparison): recheck historical calls-only changes

---------

Co-authored-by: morluto <[email protected]>
@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Source fixes and publication evidence for the review findings below. Tests and executable checks were skipped at the maintainer's request. Findings that still require a decision or execution evidence remain open.

review thread, review thread, review thread, review thread, review thread

The loader error algebra was losing distinctions at consumers: the Windows fixture omitted newly required fields, private-workspace native failures were called config drift, an admitted artifact without protocolStdin was runtime_unavailable, and Android inventory reduced runtime_unavailable to provider_missing. Updated those producer/consumer boundaries and the fixture. Published in 8963c24; authored focused Android inventory coverage. Targeted formatter and git diff --check passed; tests were not run. Also backported relevant shared /proc and comparison fixes as b492ed8 and 2ee4500.

Comment thread src/android/JadxConfiguration.ts Resolved

@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: 04298995cf

ℹ️ 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 +130 to +131
code: readiness.code,
reason: readiness.reason,

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 Preserve native self-test retryability in provider selection

When the Windows native inspect call throws, WindowsNativeReadiness carries retryable: true and systemWindowsNativeAuthority() deliberately retries on the next query, but this projection exposes that fact only inside the untyped windows_security diagnostic rather than in availability/rejection state. Tracing open_binary through candidateRejections() and analysisErrorProjection.ts:84-90 shows that the resulting ProviderSelectionError is therefore emitted to CLI/MCP clients with retryable: false, discouraging the recovery this change documents; carry the owner's retryability through ProviderAvailability/selection while leaving stable inspection failures non-retryable.

AGENTS.md reference: AGENTS.md:L19-L19

Useful? React with 👍 / 👎.

owned_protocol_stdin: false,
},
);
throw configurationFailure(readiness.code, readiness.reason, {

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 Preserve retryability for JADX self-test failures

When systemWindowsNativeAuthority() returns a retryable self-test failure on Windows x64 (for example the Win32 145 cleanup failure), this new conversion retains the stage and remediation but drops readiness.retryable; projectConfigurationFailure() then constructs an AnalysisCapabilityUnavailableError with its default retryable: false. The next Android tool call would make the loader retry, so CLI/MCP clients receive incorrect recovery metadata; pass the explicit retry bit through JadxConfigurationFailure rather than inferring it from runtime_unavailable, since malformed-inspection failures use the same code but are stable.

AGENTS.md reference: AGENTS.md:L19-L19

Useful? React with 👍 / 👎.

morluto added a commit that referenced this pull request Oct 14, 2026
Share tagged readiness observations, retain partial provider facts, authenticate bridge identity, bound diagnostics, and preserve cancellation and lost-session reasons. Fail closed for unparsed MIPS ABI attributes and macOS saved Hopper databases without a script-capable bridge route.

Reviewed fixes: #2010, #2108, #2513, #2695, #2731, #2771, #2828, #2867, #2868, #2870, #2880, #2919, #2945, #2961, #2981, #2998, #3000, #3002.

Validation: 285 focused source/boundary tests passed. Real Ghidra, IDA, Linux Hopper, and Windows provider runs were not repeated.

BREAKING CHANGE: MIPS targets with unresolved GNU ABI attributes and saved Hopper databases on macOS are refused rather than advertised as supported.
morluto added a commit that referenced this pull request Oct 14, 2026
Preserve XML and Interface Builder identity at their parsing boundary, retain usable Objective-C slots with precise coverage, and keep native trace failures distinct from absence. Add caller-selected Interface Builder summaries backed by complete retained Evidence, and preserve comparison limitations.

Reviewed fixes: #1969, #2088, #2108, #2513, #2639, #2684, #2731, #2759, #2875, #2888, #2889, #2970, #2971, #3002.

Validation: relevant native/domain focused lane passed 142 tests; earlier Interface Builder/MCP checks passed 24 tests. Real native UI and Ghidra producer coverage was not repeated.
morluto added a commit that referenced this pull request Oct 14, 2026
Use one named input-schema projection for clients and catalog identity, preserve dialect declarations, and bound compact schema depth. Keep canonical SDK output validation when output advertisements are disabled. Release request-owned state on cancellation and carry upstream limitations through composed workflows. Preserve doctor full-output envelopes and validate navigation facts at their owner.

Reviewed fixes: #2088, #2108, #2513, #2684, #2693, #2695, #2836, #2864, #2868, #2877, #2933, #2998, #3002, #3015.

Validation: focused schema, SDK output-validation, context, and workflow tests passed; no schema dialect or canonical output validation was relaxed.
@CassieFox23

Copy link
Copy Markdown
Contributor

Heads up: main already has this change in d4bd65c. The code is in src/windows/WindowsNativeLoader.ts, and Windows native doctor failure diagnostics covers it. It is listed on tracker #3582. If this PR still adds something main doesn't have, please say so here and I'll take it off the list. Thanks for the fix!

🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊

@morluto

morluto commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Thanks @AICodeLion. Closing this PR as superseded by 80de3145e on main.

Windows readiness diagnostics retain stage and native error facts in the shared loader/provider path. The landed readiness owner supersedes the branch-local snapshot API; the underlying affected-host delete-by-handle report #1701 remains open.

This is an unmerged closure: it does not label this PR as merged or remove contributor history/credit. The decision uses the current source diff and existing validation record; no new local test or provider run is claimed.

@morluto morluto closed this Oct 18, 2026
@morluto morluto added the area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior area: runtime Process capture and runtime observation area: server Server layer and tool wiring bug Something isn't working P2: medium Medium priority issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants