Skip to content

fix(gpu): report malformed GPU containers as invalid_format - #10644

Merged
morluto merged 1 commit into
mainfrom
fix/gpu-malformed-invalid-format
Nov 14, 2026
Merged

morluto merged 1 commit into
mainfrom
fix/gpu-malformed-invalid-format

Conversation

@morluto

@morluto morluto commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Summary

inspect_gpu_code_objects reported malformed GPU container bytes as target_unavailable (BinaryTargetError, constraint: "file_format_rejected"). Format parsers migrated onto the ParseFailure algebra (#10593) report malformed or truncated bytes as an invalid path instead (invalid_request, invalid_format). This change routes the GPU provider through the shared parseFailureAnalysisError mapping, so the same failure gets the same public category. The maintainer approved this classification change.

Problem and expected behavior

Trigger: a Clang offload bundle whose entry range exceeds the file, or a PE host whose MZ header no longer declares a PE image.

Before:

{"code":"target_unavailable","details":{"path":"…/selected.exe","constraint":"file_format_rejected","reason":"MZ header does not declare a PE image"}}

After (the shape of other parsers such as inspect_elf_notes and the Go reader):

{"code":"invalid_request","category":"invalid_input","details":{"operation":"inspect_gpu_code_objects","issues":[{"path":["path"],"reason":"invalid_format","message":"Selected artifact …/selected.exe: MZ header does not declare a PE image"}]}}

Unsupported containers still map to unsupported_target. Limits (BinaryResourceFailure) keep their GPU-specific resource refusal, because parseFailureAnalysisError leaves limit to its producer.

Change and scope

  • src/gpu/GpuCodeObjectsProvider.ts: the provider's own BinaryFormatFailure branch is replaced by parseFailureAnalysisError(OPERATION, input.path, primary). This also covers any other ParseFailureError kind (for example truncated) that previously fell through to ProviderAdapterError. The imports of BinaryTargetError, AnalysisUnsupportedTargetError and BinaryFormatFailure are removed.
  • Not included: other file_format_rejected producers. They belong to target admission (BinaryTargetResolver), where file_format_rejected means the selected target is not an executable REA admits, not a parse failure inside an inspection.

Contract and boundary impact

  • Semantic owner and earliest changed stage: parseFailureAnalysisError (src/domain/parseFailureAnalysisError.ts) owns the public category of a parser's format failure. The GPU provider now consumes it.
  • Contribution scope fit and linked maintainer decision: classification change approved by the maintainer (relayed by the W7 coordinator).
  • CLI and MCP/tool-catalog contract: user-visible error category change for malformed GPU containers, target_unavailable/file_format_rejected to invalid_request/invalid_format. Schemas are unchanged.
  • Provider, bridge, target-format, or platform compatibility: GPU code-object inspection only.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged. Partial-observation retention after the error is built is untouched.
  • Target selection, authority, upstream behavior, and cleanup details: unchanged. Cleanup binding still wraps the mapped error.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • 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 updated:
    • tests/boundary/gpu/codeObjects.test.ts: an out-of-range bundle entry and impossible Clang bundle counts now expect AnalysisInputError with path / invalid_format.
    • tests/acceptance/gpuCodeObjectsCli.test.ts: the CLI refusal for an MZ header that no longer declares PE now expects invalid_request / invalid_input with an invalid_format issue.
  • Base reproduction: with src/gpu/GpuCodeObjectsProvider.ts restored from origin/main, the boundary file fails 2 of 118 tests (the two updated cases). With this change it passes.
  • Remaining proof gaps: no real CUDA/HIP toolchain was run. Fixtures are synthetic.

For evidence-bearing changes:

  • 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:focused -- tests/boundary/gpu/codeObjects.test.ts tests/acceptance/gpuCodeObjectsCli.test.ts: 2 files, 143 tests passed.
  • Same boundary file against the origin/main provider: 2 failed / 116 passed.
  • npm run check:fast: typecheck and lint passed.
  • npx oxfmt --check on the changed files: passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: a caller matching target_unavailable / file_format_rejected for malformed GPU containers now receives invalid_request with an invalid_format issue on path. Maintainer approved; not marked breaking because error categories are not a versioned contract here. Reviewers may want a changelog note.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no change.

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.

…he shared parse-failure mapping

GpuCodeObjectsProvider mapped a malformed BinaryFormatFailure to a
BinaryTargetError (target_unavailable / file_format_rejected) while every
other format parser reports malformed bytes as an invalid path
(invalid_request / invalid_format). It now uses parseFailureAnalysisError.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T19:51:32.076504Z 6d43687 PR opened
ℹ️ 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.

@greptile-apps

greptile-apps Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

GpuCodeObjectsProvider now uses parseFailureAnalysisError to report malformed GPU containers consistently with other parsers.

  • GPU inspection labels malformed containers as invalid input.

Reviews (1) · Last reviewed commit: "fix(gpu): report malformed GPU container..." · Reviewed by Greptile

@morluto
morluto merged commit 3080a63 into main Nov 14, 2026
52 checks passed
@morluto
morluto deleted the fix/gpu-malformed-invalid-format branch November 14, 2026 23:57
@morluto morluto added bug Something isn't working provider: gpu Analysis provider / engine: gpu labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working provider: gpu Analysis provider / engine: gpu

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant