Repository navigation
fix(targets): remove path advice for format refusals - #1987
Conversation
Codex Review SummaryThis 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: 420e9567f9
ℹ️ 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 (!detected.ok) | ||
| return err( | ||
| new BinaryTargetError(path, detected.error, { | ||
| constraint: "file_format_rejected", |
There was a problem hiding this comment.
Preserve identity-change failures outside format rejection
When an ELF32 MIPS file is rewritten between the prefix parse and the second header read, readMipsElfAbiFlags returns MIPS ELF header no longer matches the resolved identity (src/application/MipsElfAbiFlags.ts:75), but this unconditional mapping labels that result file_format_rejected. systemDoctorHost.inspectTarget then reports unsupported_target, and shared remediation tells the caller to select a supported file even though the observed failure is target mutation. Keep an identity-change variant distinct from parser refusals (or verify stability before setting this constraint) so callers can retry after the file stabilizes.
AGENTS.md reference: AGENTS.md:L23-L23
Useful? React with 👍 / 👎.
|
Thanks, Ha1baraA11, for picking this up so fast. I'm testing it now on Linux, on head 420e956 against its base. I'm reusing the files from my two runs on #1979:
I expect to post results by about 23:45 UTC. That time is a rough estimate. 🤖 Generated with Claude Code (Opus 5.5) 🦊 |
|
TL;DR: Fixed: every format refusal I ran lost the "check the path" sentence, on the CLI and over MCP. A folder, a missing path and an unreadable file keep their own text. Still wrong: two option errors say "check the path" when the path is fine. I tested head 420e956 against its base 89f5e48 (#1972) on Linux. The base is also today's main tip. I used the files from my two runs on #1979. ResultsEvery row below is code
Two small things
Codex reviewCodex's point is right. The tag on line 185 of Not run
Thanks, Ha1baraA11, for the fix. Every CLI case, base against headEvery MCP case, base against headThe last column is Commands# sources (read-only mirror), Node 24 first on PATH
git -C <rea-mirror>/rea.git archive 420e9567f9d52ed1e55b8609ed62db06ecdf9e32 | tar -x -C /tmp/p1987/head
git -C <rea-mirror>/rea.git archive 89f5e489adac69af2937fabc1a5ba283191d630a | tar -x -C /tmp/p1987/base
npm ci --prefix /tmp/p1987/<tree> && npm run build --prefix /tmp/p1987/<tree> # exit 0, both trees
npm run test:prepare --prefix /tmp/p1987/head # exit 0
# CLI, one run per file, both trees (exit code read each time)
node /tmp/p1987/<tree>/scripts/rea.mjs inspect --provider ghidra --json <file>
node ... inspect --provider ghidra --json --target-format dos-com <file>
node ... inspect --provider ghidra --json --target-format raw-binary --architecture arm --entry-point 0x1002 <file>
# MCP: initialize, then tools/call open_binary over stdio
node /tmp/p1987/<tree>/scripts/rea.mjs mcp
# {"path": "<file>", "format": "raw-binary", "architecture": "arm", "entry_point": "0x1002"}
# doctor
node /tmp/p1987/<tree>/scripts/rea.mjs doctor --json --target <file>
# the PR's test file, once per Node
env -C /tmp/p1987/head PATH=<node bin>:/usr/local/bin:/bin npm run test:focused -- tests/boundary/filesystem/targetDiagnostics.test.ts
# CI state
gh api repos/morluto/rea/commits/420e9567f9d52ed1e55b8609ed62db06ecdf9e32/check-runs
gh api "repos/morluto/rea/actions/runs?head_sha=420e9567f9d52ed1e55b8609ed62db06ecdf9e32"Simulated rewrite: a small script imports each tree's built All other files are copies of my earlier fixtures or hand-built. I did not recheck the licences this time. Test setup
🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
Retain the merged WASM static inspection route alongside format refusals. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Co-authored-by: Kaoru0822 <[email protected]>
Keep all format, WASM and path checks while separating their test groups. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Co-authored-by: Kaoru0822 <[email protected]>
Preserve the source metadata reader and bounded native profile now on main. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Co-authored-by: Kaoru0822 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4fce03901f
ℹ️ 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".
| return err(new BinaryTargetError(path, admitted.error)); | ||
| return err( | ||
| new BinaryTargetError(path, admitted.error, { | ||
| constraint: "file_format_rejected", |
There was a problem hiding this comment.
Separate raw-binary input errors from format rejection
When the public CLI/MCP raw-binary route receives an otherwise schema-valid but invalid load choice such as ARM entry_point=0x1, rawBinaryEntryPointSchema accepts it (src/domain/rawBinary.ts:21-25) while admitRawBinary rejects its alignment (src/domain/rawBinary.ts:85-91). This blanket tag converts that caller-input error into category: unsupported_target / file_format_rejected, and shared remediation tells the caller to select another file even though changing entry_point fixes the same target; split caller-selection failures from file-size/byte failures instead of tagging every admission error as a format refusal.
AGENTS.md reference: AGENTS.md:L23-L23
Useful? React with 👍 / 👎.
|
@Ha1baraA11, thanks for fixing the misleading path advice at the format-refusal boundary and keeping real missing-path and permission errors on their own guidance. The NE/LE/LX cases make that distinction concrete across Doctor and the shared error projection. Welcome aboard REA! |
Summary
A readable executable rejected by format parsing now reports its format reason without misleading path advice. CLI/MCP and
rea doctorclassify the refusal as an unsupported target; actual missing-path and permission diagnostics retain their own guidance.Fixes #1979
Refs #1852
Problem and expected behavior
A readable MZ image with an NE, LE, or LX header is correctly refused, but the current
messageandremediation.actionalso advise checking whether the path exists and is readable. The path is valid, so that advice sends users toward the wrong cause. Format refusals should explain that the selected file is unsupported or malformed; path and access errors should retain their path-specific guidance.Change and scope
file_format_rejectedconstraint after the file has been read.unsupported_targetin the shared CLI/MCP projection andrea doctor; preserve the existing directory, missing-path, permission and WASM static-inspection routes.Contract and boundary impact
BinaryTargetResolveridentifies a readable file whose format is rejected; shared error presentation serves CLI and MCP, and Doctor reports the typed target classification.codeanddetails.reasonremain stable;details.constraintgains the additive valuefile_format_rejected. Example:message: "Cannot open artifact: unsupported NE executable in MZ image.";remediation.action: "Review the reported file-format reason and select a supported, well-formed target.".docs/public/product-catalog.json), package, or installation impact: None; no generated output or package files change.Evidence and regression coverage
tests/boundary/filesystem/targetDiagnostics.test.tswrites readable MZ images with NE, LE, and LX headers and checks the projected message, remediation, reason, constraint, and Doctor classification; existing directory and permission cases remain covered.messageisCannot open artifact: unsupported NE executable in MZ image.;remediation.actionisReview the reported file-format reason and select a supported, well-formed target.;details.reasonremainsunsupported NE executable in MZ image.For evidence-bearing changes:
Follow-up verification
npm run check:cipassed all eight static tasks and architecture guards on the integrated head.npm run docs:checkpassed on the final integrated head.Validation performed
npm run test:focused -- tests/boundary/filesystem/targetDiagnostics.test.ts— passed (5 tests).npm run check:fast— passed (typecheck and lint).Compatibility, safety, and release
target_unavailableanddetails.reasonremain stable, with an additive constraint value and clearer text.Review checklist
type(scope): outcome.