Skip to content

fix(wasm): retain rejected REA_WABT_BIN_DIRECTORY value in refusal - #7753

Closed
ayobamiseun wants to merge 2 commits into
morluto:mainfrom
ayobamiseun:fix/7595-wabt-relative-directory-value
Closed

ayobamiseun wants to merge 2 commits into
morluto:mainfrom
ayobamiseun:fix/7595-wabt-relative-directory-value

Conversation

@ayobamiseun

@ayobamiseun ayobamiseun commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #7595.

With REA_WABT_BIN_DIRECTORY=wabt/bin (a relative path), inspect-wasm-artifact correctly refused the configuration with capability_unavailable, but no field of the returned error contained the rejected value wabt/bin. The refusal now names the received spelling, so the error identifies which configured value it rejected, and an unset variable is reported distinctly from a relative one. The code, retryable: false, and the shared configuration remediation are unchanged.

Problem and expected behavior

Trigger: run rea inspect-wasm-artifact <module> --format json with REA_WABT_BIN_DIRECTORY set to a relative directory. Before: message and details.reason were REA_WABT_BIN_DIRECTORY must be an absolute tool directory. with no record of the value. The absolute-but-missing control already preserves the selected location in its ENOENT message, so the relative branch was the only refusal that dropped the caller-selected path. Expected (AGENTS.md caller-input invariant, which names paths explicitly): preserve the rejected value while retaining the absolute-directory requirement and the capability refusal.

Change and scope

The guard in src/wasm/WabtArtifactProvider.ts owns this refusal and runs before tool selection, so the fix is at the producing boundary: the thrown message now reads REA_WABT_BIN_DIRECTORY must be an absolute tool directory; received "wabt/bin"., matching the existing received ${JSON.stringify(...)} pattern in JadxConfiguration and KunaConfiguration. The previous ?? "" collapse of an unset variable into an empty string is replaced by an explicit REA_WABT_BIN_DIRECTORY is not set; it must be an absolute tool directory. message, so omitted and relative values stay distinguishable. WabtFailures.ts already projects this reason into message and details.reason; no downstream repair was added. Version-probe diagnostics are not extended to this branch because no tool has been selected yet.

Maintainer scope decision: not applicable (ordinary fix within an existing boundary).

Contract and boundary impact

  • Semantic owner and earliest changed stage: the configuration guard in WabtArtifactProvider (phase configuration), consumed unchanged by wabtFailure and projectAnalysisError. No superseded path.
  • Contribution scope fit and linked maintainer decision: ordinary diagnostic fix; not applicable.
  • CLI and MCP/tool-catalog contract: no schema change; the capability_unavailable message and details.reason text for this one refusal now include the received value.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none (the refusal occurs before module reading).
  • Target selection, authority, upstream behavior, and cleanup details: not applicable.
  • Generated metadata, package, or installation impact: none.

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: src/wasm/WabtArtifactProvider.test.ts adds "retains the rejected relative REA_WABT_BIN_DIRECTORY spelling in the refusal", which configures wabt/bin, asserts code: capability_unavailable, retryable: false, received "wabt/bin" in both message and details.reason, and that the remediation still names the setting. On the base revision the received-value assertion fails because the message contains no value.
  • Base reproduction or other evidence: source-derived; the issue's CLI reproduction output matches the pre-change guard at src/wasm/WabtArtifactProvider.ts:216-220. I did not re-run the issue's Python CLI fixture.
  • User-visible CLI/MCP output: message and details.reason become REA_WABT_BIN_DIRECTORY must be an absolute tool directory; received "wabt/bin".; with the variable unset they become REA_WABT_BIN_DIRECTORY is not set; it must be an absolute tool directory.
  • Remaining proof gaps: the public CLI/MCP projection of the new text was not re-executed end to end; the existing tests/boundary/mcp/wasmArtifactMcp.test.ts assertions only require the setting name and were not run here.

Boundary regressions covered: "Raw identity and normalization" (admitted raw spelling retained) and "Missing, empty, and unknown values" (unset distinguished from a relative value). No lifecycle change.

  • 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 test:local -- src/wasm/WabtArtifactProvider.test.ts — first run: 2 failed, 43 passed (both failures were in the unrelated "keeps core WASM usable when optional name metadata is …" matrix during an 83 s run on a loaded machine); immediate rerun: 45 passed, 45 total, 21 s.
  • npm run check:fast — passed (2 tasks successful).

Compatibility, safety, and release

  • Breaking changes or migration steps: none; error code and remediation unchanged, message text extended.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; no WABT execution is reached by this refusal.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: the retained value is a caller-selected path from the launch environment, which AGENTS.md requires preserving; it is not a transport credential.

Author readiness

Human owner: @ayobamiseun

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

🤖 Generated with Claude Code

Adapter validation follow-up

The CLI and in-memory MCP regressions now verify that a relative directory with spaces is returned in the typed refusal and that the selected WASM input remains unchanged. The focused built CLI/MCP suites passed 18 tests, npm run check:fast passed, and git diff --check passed on macOS. No real WABT installation is needed for this admission refusal; Windows was not tested.

The relative-directory guard in WabtArtifactProvider rejected the
configured REA_WABT_BIN_DIRECTORY before tool selection with a message
that named only the setting and constraint, so the capability_unavailable
error carried no record of the value it refused. The missing
absolute-directory control already preserves the selected location.

Include the rejected spelling in the refusal message, which also flows
into details.reason, and distinguish an unset variable from a relative
value. Code, retryable and the shared configuration remediation are
unchanged.
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The reviewed changes appear safe to merge.

Summary

Preserves the rejected REA_WABT_BIN_DIRECTORY value in configuration errors and gives an unset variable a distinct message.

  • WABT configuration errors name relative paths and distinguish unset settings.

Reviews (2) · Last reviewed commit: "test(wasm): verify rejected tool directo..." · Reviewed by Greptile

@ayobamiseun
ayobamiseun marked this pull request as ready for review October 28, 2026 19:21
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 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-28T19:26:54.114235Z 4be02e0 Draft marked ready
ℹ️ 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: 4be02e0c68

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

if (!isAbsolute(directory))
throw new Error(
"REA_WABT_BIN_DIRECTORY must be an absolute tool directory.",
`REA_WABT_BIN_DIRECTORY must be an absolute tool directory; received ${JSON.stringify(directory)}.`,

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 Retain the directory in a structured error field

When this refusal is consumed through CLI or MCP, the selected directory exists only inside the human-formatted message/details.reason string (providerErrorDetails does not expose a separate value), so a client cannot recover the exact selection without parsing mutable English and JSON quoting. This is especially observable for values containing quotes or escapes; carry the raw directory in typed diagnostics/details (and assert that field) while keeping this sentence for display.

AGENTS.md reference: AGENTS.md:L33-L33

Useful? React with 👍 / 👎.

@morluto

morluto commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Hey @ayobamiseun, thanks for this! The fix looks good. What's left: it has merge conflicts with main in src/wasm/WabtArtifactProvider.ts (merging main into the branch is fine). There is 1 unresolved review thread from Codex, about "Retain the directory in a structured error field". Happy to merge once that's sorted.

gensokyo-dev added a commit that referenced this pull request Nov 14, 2026
A relative REA_WABT_BIN_DIRECTORY was refused with only the setting
name, and an unset value was indistinguishable from an empty one. The
admission refusal now carries the rejected value as
diagnostics.configured when it is set.

Fixes #7595

The idea and original report are from #7753 by ayobamiseun, which
targeted a message that WabtAdmissionError has since replaced.

Co-Authored-By: ayobamiseun <[email protected]>
Co-Authored-By: gensokyo-dev <[email protected]>
gensokyo-dev added a commit that referenced this pull request Nov 14, 2026
A relative REA_WABT_BIN_DIRECTORY was refused with only the setting
name, and an unset value was indistinguishable from an empty one. The
admission refusal now carries the rejected value as
diagnostics.configured when it is set.

Fixes #7595

The idea and original report are from #7753 by ayobamiseun, which
targeted a message that WabtAdmissionError has since replaced.

Co-Authored-By: ayobamiseun <[email protected]>
Co-Authored-By: gensokyo-dev <[email protected]>
N0zoM1z0 pushed a commit that referenced this pull request Nov 14, 2026
A relative REA_WABT_BIN_DIRECTORY was refused with only the setting
name, and an unset value was indistinguishable from an empty one. The
admission refusal now carries the rejected value as
diagnostics.configured when it is set.

Fixes #7595

The idea and original report are from #7753 by ayobamiseun, which
targeted a message that WabtAdmissionError has since replaced.

Co-Authored-By: ayobamiseun <[email protected]>
Co-Authored-By: gensokyo-dev <[email protected]>
@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Thank you. #10499 reimplemented this fix and credits this PR (see the PR table), so I'm closing it as superseded.

@N0zoM1z0 N0zoM1z0 closed this Nov 14, 2026
@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior 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.

[Bug] WABT relative-directory error omits the supplied selection

3 participants