Repository navigation
refactor(jeb): classify JEB failures through the shared provider classifier - #10831
Conversation
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.
…ol exits unsuccessfully
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
…fix/streaming-runtime-exhaustion
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
…d the carried caller reason
…lassifier baseline
…tion report The shared classifier replaced the provider-supplied recovery with generic capacity advice whenever the JVM reported it could not create a native thread, dropping Apktool's launcher guidance and flipping retryable to true. The provider's recovery now wins; the capacity advice remains the fallback for providers that supply none.
…vider classifier (#10782) * refactor(pwntools): classify pwntools failures through the shared provider classifier pwntools' per-site classifier is replaced by pwntoolsFailureDialect for classifyProviderFailure. Command outcomes go through classifyProviderOutcome, launch refusals through launcherRefusalOf instead of a 'spawn ' syscall prefix check, the input limit through the file dialect's fileSize, and the cleanup report through commandCleanup. The shared read cancellation now carries the reader's partial observation, and resource-signal reports accept provider detail. * fix(pwntools): report a failed command's output once and expect resource_constraint for overflow The shared outcome owner already attaches the command's output as capturedOutput, so the pwntools adapter fallback no longer copies the same text into diagnostics.stdout, diagnostics.stderr and diagnostics.captured_output; diagnostics keep the exit facts. Update the overflow expectations the dialect migration missed (layout provider cleanup and over-budget rows, pwntools cleanup) to resource_constraint.
WabtFailures matched any Error named AbortError as a cancellation. No WABT path produces one: reads, path checks and owned commands report cancellation as ArtifactReaderFailure or OwnedCommandFailure, which classifyProviderFailure and classifyProviderOutcome already classify with the caller's reason. The provider's two signal checks now build the cancellation with cancelledBy. Lowers the AnalysisCancelledError constructor baseline for both WABT files to zero.
…tion The private snapshot write passed the caller's signal to Node's writeFile, whose abort envelope reached the dialect's unclassified output failure once the name-based AbortError guess was removed. The write now turns the envelope carrying its own signal's reason into cancelledBy at the producer.
…vider classifier (#10810) Firmware producers now report their own deadline expiry: the start check, the output inventory and launcher admission throw the phase timeout where they observe the abort, and a read the phase signal cancelled reports it through the dialect's interruption. The classifier no longer rereads a cancellation's reason as a timeout. A new readCleanup hook keeps firmware's cleanup report shape.
… the shared provider classifier TsharkCaptureProvider and SigrokRecordingProvider replace #failure with a dialect, and PcapProvider replaces analysisFailure and the tool-identity classifier. ArtifactAnalysisResources exposes its command context and a readCleanupFailure composer so the readCleanup hook keeps each provider's cleanup report shape.
…sifier JEB's raw MCP failures go through classifyProviderFailure with a JEB dialect; a typed attribution step reports a shared phase's failure under the REA operation. Each MCP phase deadline now reports its own interruption when it aborts, deciding a cancellation's owner from the caller's own signal instead of comparing abort reasons. A refusal carrying the JVM's OutOfMemoryError report becomes a resource constraint naming JEB's Java heap.
Codex Review Summary: ❌ FailedThis 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: 8326873292
ℹ️ 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".
[Medium impact] The reviewed changes appear safe to merge, with no actionable defect established. SummaryRoutes JEB failures through
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[CLI or MCP request] --> B[JEB MCP phase]
B --> C[Raw failure or recorded interruption]
C --> D[classifyProviderFailure]
D --> E[Attribute operation and endpoint]
E --> F[Typed failure with cleanup ownership]
B --> G[Decoded refusal]
G --> H{JVM exhaustion report?}
H -->|Yes| I[Resource constraint and recovery advice]
H -->|No| J[Execution failure]
Reviews (4) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
…r classifier (#10836) * refactor(ghidra): classify Ghidra failures through the shared provider classifier PSP extension inspection reports through classifyProviderFailure with a Ghidra dialect. The startup deadline decides at abort time whether the shared startup owner closed it, so Ghidra and Hopper no longer compare the abort reason with the owner's sentinel, and Ghidra's startup no longer compares a producer cancellation's reason with the deadline's. Three helpers that only construct one error kind now name that kind instead of AnalysisError. * refactor(hopper): classify original-source read failures through the shared provider classifier (#10838) * test(ghidra): pin the aborted startup deadline over a producer cancellation * refactor(kuna): classify Kuna failures through the shared provider classifier (#10843) Session operations, the workspace copy and the project export report raw failures through classifyProviderFailure with Kuna dialects; the copy and export keep their cleanup report shapes through the readCleanup hook.
…' into w5/ccd # Conflicts: # src/pcap/PcapProvider.ts # src/process/ArtifactAnalysisResources.ts # src/signals/SigrokRecordingProvider.ts
# Conflicts: # scripts/verify/architecture-guard-baselines.json # src/captures/TsharkCaptureProvider.ts # src/providers/classifyProviderFailure.ts
# Conflicts: # src/ghidra/GhidraClient.ts # src/hopper/HopperClient.ts
|
Merged the final #10820 head (72f0ed9) and then current main into this branch. Conflicts: GhidraClient and HopperClient took main's |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
Moves JEB onto the shared
classifyProviderFailureowner and foldsJebMcpDeadline's reason comparison onto the producer-reports-its-own-interruption pattern accepted for firmware (#10810). A JEB refusal that carries the JVM's ownjava.lang.OutOfMemoryErrorreport now becomes a resource constraint instead ofexecution_failure. Therea/provider-failure-classifierbaseline dropssrc/jeb/JebProvider.ts(1 → 0).Stacked on #10820. Refs #10482 (W5c of the structural cleanup).
Problem and expected behavior
JebProvider#providerFailure(operation, cause: unknown)re-derived every raw failure kind itself (ZodError, physical MCP failure, cleanup composite, cancellation, timeout).JebMcpDeadline.failure()re-read the startup deadline's state after the fact.requestFailuredecided whether a cancellation was the caller's by comparingfailure.cause === signal.reason.execution_failurewith no memory recovery (audit finding 4: "Apktool and JEB have no JVM matcher").Expected: raw classification goes through the shared owner. Each MCP phase deadline reports its own timeout or cancellation when it aborts, and decides whose cancellation it was from the caller's own signal. JVM exhaustion is read with the shared JVM marker.
Change and scope
JebMcpDeadlinetakes the selected timeout, phase, phase operation and the{ caller, owner }signals. When it aborts, it records its report: a timeout (with the existingjeb.mcp_timeout_msguidance) when the budget elapsed, otherwise a cancellation. It recordscancelledBy: "caller" | "owner"from whether the caller's own signal aborted.interruption(rejection: SdkError)maps its own abort token, or the SDK's request timeout, back to that report. SDK 2.3.1 only keeps anSdkErrorabort reason by identity, so the token stays.JebMcpConnection.requestFailureno longer compares abort reasons: a cancellation by the caller, or by closing, leaves the connection alone; anything else invalidates it, as before.JebProvider: a#dialect(operation)gives the shared classifier JEB's ZodError →AnalysisProtocolErrorand the unreachable-endpoint report. A typed#attributed(operation, failure: AnalysisError)step reports a shared phase's failure (catalog discovery,tools/call) under the REA operation and endpoint, and keeps the phase's cleanup ownership and theJebMcpCleanupFailurecomposite.parseJebEnvelope: a refusal whoseerror.messageormessagecontainsRUNTIME_EXHAUSTION_TOKENS.jvmbecomesAnalysisResourceConstraintError. It ismemory, orcapacityfor native-thread exhaustion, and the area comes from the sharedjvmExhaustionArea. Recovery follows the reported area:-Xmxfor heap and GC overhead,-XX:MaxMetaspaceSizefor metaspace, a smaller input for an oversized array, and thread limits for native-thread exhaustion. The envelope stays indiagnostics.upstream_response, anddiagnostics.jvm_exhaustion_areais added.docs/providers/jeb-analysis.mdrecords the exhaustion case beside the existing refusal semantics.Not included:
ENGINE_NOT_READY,PROJECT_BUSY,INVALID_ITEM) are invented. The provider doc says REA does not infer meaning from refusals, so a table would be speculative.Contribution scope: ordinary refactor within existing boundaries plus one classification addition the plan names (W5c/finding 4). No new authority.
Contract and boundary impact
classifyProviderFailureowns raw-failure classification.JebMcpDeadlineowns its phase's interruption report.java.lang.OutOfMemoryErrorreturns the resource-constraint error code withdetails.resource: "memory"(or"capacity"),details.diagnostics.jvm_exhaustion_area("heap","native-thread", …, ornull) and the area's recovery, instead ofexecution_failure. All other JEB reports are unchanged; the existing JEB boundary tests pass unmodified.Evidence and regression coverage
tests/boundary/providers/jeb/failureEnvelopes.test.ts: new public MCP workflow cases, run against a real HTTP producer with both envelope encodings. They cover heap, metaspace, array-size, an unnamed area and native-thread exhaustion. Each assertsresource_constraintand its area's recovery. Verified failing without the provider change: 6 failed, 8 passed. The existing refusal cases now share one harness helper.OutOfMemoryErrorin a refusal envelope has not been observed.Validation performed
npm run check:fast: pass.npm run test:local -- src/jeb/JebMcpConnection.test.ts src/jeb/JebMcpEndpoint.test.ts src/jeb/JebProvider.test.ts: 3 files, 66 passed.npm run test:focused -- tests/boundary/providers/jebMcpCleanup.test.ts tests/boundary/providers/jebMcpReplies.test.ts tests/boundary/providers/jebFixtureCompletion.test.ts tests/boundary/providers/jebMcpTimeout.test.ts tests/boundary/providers/jebMcpCatalog.test.ts tests/boundary/providers/jebMcpConnection.test.ts tests/boundary/providers/jeb/failureEnvelopes.test.ts tests/boundary/mcp/jebMcp.test.ts tests/boundary/cli/jebCli.test.ts tests/boundary/providers/mcpHttpUtf8.test.ts: 10 files, 86 passed (before the new cases);failureEnvelopes.test.tswith the new cases: 18 passed.npm run test:focused -- tests/evaluation/providerFailureClassifierRule.test.ts: 12 passed.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.