Skip to content

refactor(ghidra): classify Ghidra file failures through the shared provider classifier - #10873

Merged
morluto merged 85 commits into
mainfrom
refactor/ghidra-file-classifier
Nov 16, 2026
Merged

morluto merged 85 commits into
mainfrom
refactor/ghidra-file-classifier

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

The next Ghidra slice of W5c. ghidraFileFailure(cause, operation, diagnostics) (15 call sites) becomes ghidraFileDialect(operation, diagnostics) for the shared classifyProviderFailure. The rea/provider-failure-classifier baseline drops src/ghidra/GhidraFileArtifacts.ts (1 → 0).

Built on #10872 (merged), which lets the shared owner carry Ghidra's file diagnostics on a cancelled read. Refs #10482.

Collapsed stack

The stack above this PR has been squash-collapsed into this branch, so merging it also lands these reviewed PRs (none is breaking):

Problem and expected behavior

ghidraFileFailure re-derived typed pass-through and reader cancellation beside the shared owner. Expected: Ghidra supplies only its own meaning (file capacity, changed file and access refusal mapped inside the file's cleanup wrapper, composed with any unresolved cleanup; the admission/system-code adapter report that keeps the cleanup), and the shared owner reports pass-through and cancellation with Ghidra's diagnostics.

Change and scope

  • ghidraPhysicalFailure (typed unknown → unknown, the existing inner mapper) and ghidraFileDialect with diagnostics, recognise (typed primary, composed with the file's cleanup exactly as before) and unclassified (the adapter report with the cleanup attached, as before).
  • All callers in GhidraCheckpoint, GhidraAnalysisSeeds, GhidraExtensions, GhidraExecutableHeader, GhidraInstallationProperties, GhidraProjectSnapshot, GhidraProvider and the boundary test call classifyProviderFailure(cause, ghidraFileDialect(...)).
  • Difference: a cancelled Ghidra file read now also keeps the reader's partial observation. Source-derived.

Not included:

  • GhidraClient#cleanupError and Ghidra's remote-code mapping in GhidraSessionError/GhidraProviderClient, which are the next slices.

Dropped audit rows in docs/user-visible-errors.csv

This PR replaces main's hand-written copy audit (112 rows at 5d3e1dc, last edited by #11511; #11101 edited row 67) with the generated catalogue (#10508 option 3). Each dropped row was checked against the generator output and the source on this head (script over every row; source-derived, not a runtime check):

  • 22 rows name an error tag (src/domain/errors.ts, UnknownRegistryError): all 22 tags are in the generated catalogue with their code, category and default retryability, now split per reason/constraint.
  • 9 rows describe copy or behaviour that no longer exists (removed, and the removed approval-based unknown tracking). No current fact.
  • 81 rows name a copy site (setup, uninstall, update, doctor, install.sh, MCP transport, process CLI, Ghidra, Windows loader, views). Their wording is owned by the named source module, not by the generator: 47 rows match source verbatim and 18 match as templates (shell variables, {placeholders}). Of the other 16, 9 record a description of the change rather than wording, and 5 had already drifted from source (for example rows 64/74 "Install Node.js 22.x …" no longer exist in DoctorDiagnostics/SetupHost; row 105's installer mismatch now adds a recovery). This includes fix(process): give process-command failures their own recovery instead of doctor #11101's row 67 (verbatim in src/application/process/ProcessCli.ts) and refactor(mcp): bind analysis settings and session-derived comparison tools through the shared binding table #11511's location moves (rows 24.93 and 71, now FunctionComparisonEvidence.ts and a removed guard).
  • Deliberate change: the generated catalogue does not list wording, user-risk notes, prior copy or verification notes. Wording stays with its source owner and its tests (for example src/main/messages.ts constants are asserted by tests/boundary/mcp/mainErrors.test.ts); src/main/messages.test.ts, which only checked that those constants were copied into the CSV, is removed. The review annotations are history and remain in git at 5d3e1dc. No audit fact is moved into the generator, because none is an error-contract fact the generator's source owns.

Contract and boundary impact

  • Semantic owner and earliest changed stage: classifyProviderFailure with the Ghidra file dialect.
  • CLI and MCP/tool-catalog contract: unchanged for the paths the tests pin.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged.
  • Target selection, authority, upstream behavior, and cleanup details: cleanup composites, attached cleanup and lease binding unchanged.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • Behavior-preserving move; tests/boundary/providers/ghidra/ghidraFileFailure.test.ts pins the opaque, errno and authored cleanup cases, and the other suites below pin the callers.

Validation performed

  • npm run check:fast: pass.
  • npm run test:focused -- with src/ghidra/GhidraAnalysisSeeds.test.ts, src/ghidra/GhidraProvider.behavior.test.ts, src/ghidra/GhidraCheckpoint.test.ts, src/ghidra/extensions/GhidraExtensions.test.ts, tests/boundary/providers/ghidra/{ghidraCheckpointLifecycle,ghidraFileFailure,ghidraProjectSnapshot}.test.ts, tests/boundary/filesystem/{ghidraInstallationProperties,ghidraPspExtension,ghidraProfileArtifactOwnership,ghidraExecutableHeader}.test.ts, tests/boundary/il2cpp/il2cppGhidraSeeds.test.ts, tests/process-global/ghidraProjectReadCancellation.test.ts, tests/evaluation/providerFailureClassifierRule.test.ts, src/providers/classifyProviderFailure.test.ts: 15 files, 517 passed.
  • Merged current main (merge 1aff82d). Conflicts resolved at the owner: kept main's moves (src/ports, src/resources, src/cli/cliJsonInput.ts, capturedProviderOutput, analysisErrorProjectionSchema, simulated-host EVM tests, refactor(kuna): decide Kuna readiness once for doctor and runtime #10997's Kuna readiness, refactor(javascript): name heap and deadline flags from the bound limit, not remediation text #11448's max_heap_mb limit and adapter-neutral heap remediation) and re-applied this stack on top (isAbortOf in the moved JSON input readers, the Hopper error move in new importers, the Kuna installation dialect, the SQLite worker dialect, the streamed V8 exhaustion report beside refactor(javascript): name heap and deadline flags from the bound limit, not remediation text #11448's limit in both JavaScript workers and their tests, the new EVM abort-owner test on SIMULATED_LINUX_X64). The merge commit was written without the pre-commit lint-staged pass, which otherwise rewrote ~40 unrelated files from main; the pre-push hook ran. After the merge: npm run check:fast (typecheck, lint, architecture guards) pass; node scripts/verify-module-boundaries.mjs pass; npm run docs:error-schema leaves docs/user-visible-errors.csv unchanged; npx oxfmt on the resolved files; npm run test:focused -- with src/domain/analysisErrorProjection.test.ts, src/hopper/HopperErrorProjection.test.ts, src/process/OwnedLease.test.ts, src/sqlite/SqliteDatabaseFailures.test.ts, src/browser/WebBundleAnalysisWorker.test.ts and tests/boundary/{javascript/workerOrderAudit,evm/evmCleanupRetry,filesystem/cliJsonInput,pcap/pcapCommand,pcap/pcapCredentialErrors,providers/ghidra/ghidraFileFailure,providers/kuna/kunaHashOwnerPropagation,sqlite/sqliteDatabaseFailures}.test.ts: 13 files, 353 passed, 2 skipped. On the previous merge of the same resolutions, src/process/{RuntimeExhaustion,SignalAbort}.test.ts and tests/boundary/{process/binarySessionCleanupRetry,providers/hopper/linuxPrivateDisplay}.test.ts also passed.

Merged main at 465796a (head b992171). Main moved launch failures out of the provider dialect (classifyLaunchFailure, launchUnavailable) and added providerId to the outcome context, so: the dialect outcome is exited | protocol and the examined outcome drops launch_refusal_code; the unclassified report now takes only provider facts and reports under context.providerId; Apktool, EVMole, pwntools, pcap and WABT keep main's launchUnavailable; SQLite keeps main's worker_timeout_ms limit; Ghidra keeps sha256Hex/errorMessage from src/kernel. docs/user-visible-errors.csv stays the generated catalogue from #11060; see "Dropped audit rows" below.

  • npx tsc --noEmit -p . — passed; npm run check:fast and pre-push hook — passed; node scripts/verify/architecture-guards.mjs and node scripts/verify-module-boundaries.mjs — passed.
  • npm run build:cached then node scripts/generate-error-schema.mjs --check — fresh.
  • npm run test:focused -- <12 owner tests: classifyProviderOutcome, SqliteDatabaseFailures, WabtFailures, EvmoleFailures, ApktoolCommandRecovery, ApktoolProvider, PwntoolsFailures, IdaBusyHealth, analysisErrorProjection, PcapNativeBound, processCliFileInput, hopperClient.cleanupRetry> — 330 passed.
  • npm run test:focused -- <8 boundary tests: pcapCredentialErrors, pcapCommand, kunaHashOwnerPropagation, ghidraFileFailure, ghidraInstallationProperties, ghidraExecutableHeader, providerOutcome, artifactSelectedCommand> — 99 passed, 2 skipped.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: no real Ghidra run.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner:

  • 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.

When a capture read's tool launch was refused with EPERM, pcap reported it
as unreadable tool output (AnalysisProtocolError) instead of an unavailable
tool. Pcap also never told "not executable" apart from "missing".

Add classifyLaunchFailure in src/process as the one owner of which spawn
errnos mean missing (ENOENT, ENOTDIR) and which mean present but not
executable (EACCES, EPERM, ENOEXEC, EISDIR). Pcap, apktool and gdb used three
different errno lists; all three now use it.
Add ProviderOutcome, read once from the supervisor's facts, and classifyProviderOutcome, the one mapping from an outcome to a typed error. Migrate pcap and the shared artifact producer command failure (TShark, sigrok). Add the rea/provider-failure-classifier lint rule with a shrink-only baseline of per-site (cause: unknown) => AnalysisError functions.
…red owner (#10598)

The Ghidra and JADX Java probes and adb's version probe now take
missing-versus-not-executable from classifyLaunchFailure instead of their
own errno checks. ELOOP and ENAMETOOLONG join the owner's missing set, so
adb keeps its existing classification and both Java probes now treat a
non-directory path component as a missing runtime.
Add ProviderOutcome, read once from the supervisor's facts, and classifyProviderOutcome, the one mapping from an outcome to a typed error. Migrate pcap and the shared artifact producer command failure (TShark, sigrok). Add the rea/provider-failure-classifier lint rule with a shrink-only baseline of per-site (cause: unknown) => AnalysisError functions.
…nto HEAD

# Conflicts:
#	src/pcap/PcapCommand.ts
… a target refusal

The supervisor now watches for a managed runtime's out-of-memory report while output streams (JVM java.lang.OutOfMemoryError, V8 'JavaScript heap out of memory'), so a retention budget cannot hide it. ProviderOutcome gains a runtime-exhausted kind and classifyProviderOutcome maps it once. Apktool decode opts in and moves to the shared classifier; Ghidra's single-purpose output token becomes the JVM runtime option and its area matching reuses the shared table.
…HEAD

# Conflicts:
#	src/pcap/PcapCommand.ts
#	tests/evaluation/providerFailureClassifierRule.test.ts
…nto refactor/provider-outcome

# Conflicts:
#	src/pcap/PcapCommand.ts
Name the executable on errnos Node throws synchronously from spawn
(ENOEXEC, ENOTDIR, ...) and read the Windows native launcher's
executable-launch constraint, so pcap attributes those refusals to the
selected tool or limiter instead of an unknown stage.
…nto w5/provider-outcome

# Conflicts:
#	src/pcap/PcapCommand.ts
…t retained stderr (#10724)

The SQLite worker and the Node capture decoders now declare runtime: "v8", so the supervisor observes V8's heap report as output streams. Both classifiers read the runtime-exhausted outcome instead of matching retained stderr, so a report beyond the retention budget, or one whose process then overflowed its output budget, is still reported as memory exhaustion.
# Conflicts:
#	.oxlintrc.json
#	scripts/lint/index.mjs
#	src/pcap/PcapCommand.ts
…vider classifier (#10716)

* refactor(evm): classify EVMole worker outcomes through the shared provider classifier

The EVMole worker's cancellation, deadline, output budget and CPU/file-size signals now go through classifyProviderOutcome; only the prlimit launch refusal and the reserved EFBIG exit remain in its dialect. The worker is opted into V8 exhaustion scanning so a heap report names its fixed 256 MiB heap. providerOutcomeOf now reads a launch refusal only from a spawn errno, so a private-storage or carrier read errno is no longer reported as a limiter launch failure.

* fix(evm): keep a stream failure's exit status and update Linux worker expectations

* refactor(process): read launch refusals through the launcher identity owner

* refactor(wasm): classify WABT command outcomes through the shared provider classifier (#10727)

* refactor(wasm): classify WABT command outcomes through the shared provider classifier

WABT's cancellation, command deadline, output budget, and inherited-limit signals now go through classifyProviderOutcome; its dialect keeps only the configuration-probe and launch-refusal unavailability and the unclassified-exit output error. A tool ended by SIGXCPU/SIGXFSZ or the memory limit is now a resource constraint instead of an output error, and a refused launch in the producer phase is reported as unavailable. The shared timeout context gains the analysis setting that selected the deadline, and the output-limit context may name its exceeded budget.

* fix(wasm): keep setup guidance when a WABT version probe's output cannot be collected
…w5-10634

# Conflicts:
#	src/apktool/ApktoolProvider.ts
#	src/ghidra/GhidraDiagnostics.ts
…nto refactor/ghidra-file-classifier

Port main's browser application_already_running classification into the error catalogue and its CSV, and let Hopper's request queue fail requests with the bridge reply-ceiling refusal (#10699) as well as Hopper errors.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

…nto refactor/ghidra-file-classifier

Keep main's non-zero exit limitation beside the structured refusal limitation; keep the generated error catalogue (the ProcessCli recovery test checks the exported remediation only); share one Linux host stub in the EVM cleanup test so the new cancellation test stays within the process.platform baseline.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto changed the base branch from refactor/cancelled-read-facts to main November 15, 2026 13:32
…plit the guard baselines

Hopper presentation stays on HopperErrors.ownPresentation (main's #11135 typing of the same guidance is superseded by that owner).
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

2 similar comments
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto force-pushed the refactor/ghidra-file-classifier branch from aa97567 to 1aff82d Compare November 15, 2026 21:28
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@greptileai review — please review the latest commit (merge of current main).

Main moved launch failures out of the provider dialect: the shared
classifier reports them (classifyLaunchFailure) and a provider supplies
launchUnavailable, and ProviderOutcomeContext gained providerId. This
branch gave the dialect an unclassified report. Merged:

- ProviderDialectOutcome is exited | protocol, so the examined outcome
  drops launch_refusal_code and the launch-refused failure_kind, and the
  classifier test drops its launch-refusal case.
- The unclassified report takes only provider facts; it reports under the
  context's providerId instead of a second copy of it at each call site.
- Apktool, EVMole, pwntools, pcap and WABT keep main's launchUnavailable
  and use the unclassified report for unrecognised exits and stream
  failures.
- SQLite's worker deadline keeps main's worker_timeout_ms limit and drops
  the CLI spelling from its remediation; the unclassified diagnostics read
  errorMessage.
- Ghidra file reads keep the shared dialect with main's sha256Hex and
  errorMessage owners.
- docs/user-visible-errors.csv stays the generated catalogue (regenerated
  from the merged table; unchanged).
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

# Conflicts:
#	scripts/verify/architecture-guards.mjs
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto

morluto commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

@greptileai review the latest commit (916af34): merged main, where launch failures moved to the shared classifyLaunchFailure; the unclassified report now binds to the context's providerId.

@deskinsjerri1-commits

deskinsjerri1-commits commented Nov 16, 2026 via email

Copy link
Copy Markdown

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto merged commit 0f6b330 into main Nov 16, 2026
15 checks passed
@morluto
morluto deleted the refactor/ghidra-file-classifier branch November 16, 2026 02:59
@morluto morluto added area: providers Provider and capability discovery, including provider proposal triage provider: ghidra Analysis provider / engine: ghidra labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: providers Provider and capability discovery, including provider proposal triage provider: ghidra Analysis provider / engine: ghidra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants