Skip to content

fix(scan): load the SDK helper safely inside OpenCode's compiled binary - #36

Merged
strantalis merged 1 commit into
mainfrom
fix/sdk-helper-in-compiled-host
Nov 13, 2026
Merged

strantalis merged 1 commit into
mainfrom
fix/sdk-helper-in-compiled-host

Conversation

@strantalis

Copy link
Copy Markdown
Owner

Every real scan that reached the end inside OpenCode failed with "Codex Security scan completed without required artifacts: scan-manifest.json, findings.json", although both files were on disk.

Cause. The SDK's bundled helper (_bundled_plugin/mcp/helpers.mjs) checks on load whether it is the main script: existsSync(process.argv[1]) && realpathSync(process.argv[1]) === realpathSync(entryPath). In OpenCode's compiled Bun binary process.argv[1] is /$bunfs/root/opencode, which exists but cannot be resolved, so realpathSync throws ENOENT. The SDK treats any ENOENT in its file check as a missing file.

Fix. One shared loadSdk() that loads the helper once with process.argv[1] blanked, then restores it. Later imports reuse the loaded module.

Checked

  • Captured the underlying error from a real failing scan in OpenCode Desktop.
  • Reproduced it in a compiled Bun executable, and confirmed the same executable passes with the workaround.
  • npm run check passes, with a new test.

Not yet checked: a real scan completing inside OpenCode with this change.

🤖 Generated with Claude Code

https://claude.ai/code/session_016LiHJtDpo3TEPnWZ78vM2X

The SDK's bundled helper compares process.argv[1] with its own path when it
loads. In OpenCode's binary that argument is a virtual path that exists but
cannot be resolved, so the load threw and every scan that reached the end
failed with "completed without required artifacts". Load the helper once with
the argument blanked, through one shared SDK loader.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016LiHJtDpo3TEPnWZ78vM2X
@strantalis
strantalis merged commit fcba073 into main Nov 13, 2026
12 checks passed
@strantalis
strantalis deleted the fix/sdk-helper-in-compiled-host branch November 13, 2026 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant