Repository navigation
fix(native): preserve dispatch metadata format refusals - #8013
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. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The reviewed changes appear safe to merge; no blocking issue was found. SummaryThe PR reports six explicit Apple metadata format refusals as
Reviews (3) · Last reviewed commit: "test(native): assert admitted metadata t..." · Reviewed by Greptile |
Summary
Fixes #7652. Malformed Objective-C/Swift list-section lengths and an unsupported big-endian CPU declaration previously returned
execution_failurewith provider-repair advice. They now returnunsupported_target, retaining the bound artifact path and precise producing reason, with guidance to select a well-formed/supported artifact and reopen it.Change and boundary impact
Use the existing native
BinaryFormatFailureat all five ABI-list alignment guards and the non-PowerPC big-endian CPU guard. The shared dispatch error boundary maps these explicit format refusals intoAnalysisUnsupportedTargetErrorfor CLI and MCP. Keep the existing 32-bit/PowerPC metadata capability fallback; unknown JavaScript exceptions remain provider failures, and per-record partial-coverage behavior is unchanged. Other layout refusals retain their existing handling; this patch does not classify every possible malformed Mach-O input.This is a correction within the existing static reader. No new provider, target execution, mutation, schema, dependency or authority changes; maintainer capability scope decision is not applicable. Native investigation guidance describes the precise affected cases.
Validation performed
Base reproduction: the new production-boundary file had 6 failing cases / 1 passing control. All now pass: class/protocol/category lists, Swift type/conformance lists, unsupported byte-order/CPU declaration, and a valid eight-byte class-list control. These tests use real file bytes/digest admission with injected Darwin support on Linux.
npm run test:local -- src/native/AppleMachoSelection.test.ts src/native/AppleDispatchMetadata.test.ts src/native/AppleDispatchMetadata.failure.test.ts— 176 passed, including explicit typed failures and preserving unclassified exceptions as provider errors.npm run test:focused -- tests/boundary/providers/native/nativeDispatchFormatFailures.test.ts tests/boundary/providers/native/objcClassMetadataFallback.test.ts tests/boundary/providers/native/nativeDispatchMetadataFileCleanup.test.ts tests/boundary/mcp/nativeDispatchAvailability.test.ts— 25 passed; covers capability fallback, descriptor cleanup retry and MCP failure semantics.npm run verify:test-discovery— all 2817 files discovered exactly once.npm run check:fast,npm run docs:check(including 9 README consistency tests), changed-file formatting, verifier syntax andgit diff --check— passed.Exercised the verifier parser with two real Linux CLI failures (native host refusal and missing artifact). Both use the CLI-owned
cliOperationFailurePayloadto normalize the response and validate the strict canonical schema; MCP errors use the existingrequireMcpToolErrorowner. A real symlink-selected smoke test also confirms target admission owns the canonical path retained by the format refusal.Extended the existing macOS
verify:apple-dispatchCI script with malformed class/Swift fixtures through actual CLI and stdio MCP; validate the canonical error schema, category, admitted bound-artifact path and exact reason across adapters. Executed successfully in the macOS 15 CI verifier step, including the new malformed class/Swift cases and existing compiler-produced Objective-C/Swift controls. The completed Apple job passed all 13 dispatch fixture variants and 28 boundary files (401 tests passed, 5 skipped). Local injected-host tests are reported separately above.Integrated with newer main
f25d1e3e9, including its category unknown-state change, in a temporary merge worktree: all 203 related source/boundary/MCP tests andcheck:fastpassed. The worktree was cleaned after retaining its validation record.GitHub CI — all 18 executed technical jobs passed, including all 8 shards, source tests, documentation, native package/control builds and actual Apple CLI/MCP verification.
Real data and performance
Executed the production digest-bound file/decoder/error-projection workflow on the real 2,228,640-byte SevenZipJBinding x86_64 dylib shipped with Ghidra 12.1.4, plus valid and malformed four-KiB metadata controls. Across five alternating fresh-process pairs, the real artifact and valid class results remained byte-identical. Real-artifact SHA-256:
dc0e3f370c2966c37c98c33a1f2070308c274f86fc2c1a44e525588fe5961915.Real-artifact median first-call wall 63.4 → 60.0 ms, CPU 85.3 → 92.5 ms; median warm wall 14.9 → 16.1 ms/call and CPU 27.0 → 28.4 ms/call (10 warm calls/process). Shared-host variation is material; no acceleration is claimed. The final full 44-call producer probe, including startup, took 0.89 → 0.80 s wall and 1.31 → 1.22 s CPU. Maximum sampled process-family RSS 199.0 → 198.9 MiB (5 ms sampling; no children; 512 MiB heap, 2 V8/2 IO workers).
Valid normalized results remain 1,958/3,245 bytes; malformed class/Swift projections changed 651→601 and 642→583 bytes while preserving specific reasons. These are producer-phase measurements, not actual model token usage or end-to-end client costs. OS-cache cold runs, catalog/prompt/model tokens and CLI/MCP performance are unmeasured. No cache or additional analysis work was introduced.
Author readiness
Human owner: @gensokyo-dev
The user explicitly authorized a ready PR and waived the human-confirmation gate for this session. The unchecked declarations do not attest that a human reviewed the diff or validation evidence.