fix(logging): suppress cursor-sdk shell-parser tree-sitter warn from TUI - #111
Merged
Merged
Conversation
@cursor/sdk's bundled shell-parser emits a one-shot console.warn
("shell-parser: tree-sitter natives are unavailable...") when its
vendored tree-sitter natives fail to load (e.g. under Bun). opencode
renders plugin stderr into the prompt, so the diagnostic appeared
visually even though it is benign (shell analysis degrades to
parsingFailed).
Extend the existing console.log interceptor pattern to console.warn on
both transports:
- in-process: installCursorLogInterceptor now wraps console.warn;
known SDK warning prefixes route through pluginLog("warn") to
opencode's app.log instead of stderr
- sidecar: agent-host.mjs wraps console.warn and forwards matched
lines as {ev:"log", level:"warn"} over the JSONL protocol
Adds tests for both paths; unrelated console.warn calls still pass
through unchanged.
This was referenced Aug 26, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
@cursor/sdk's bundled shell-parser emits a one-shotconsole.warn:This fires when the SDK's vendored tree-sitter natives fail to load (e.g. when opencode runs the plugin under Bun). opencode renders plugin stderr into the TUI prompt, so the line appeared visually in the prompt even though it is benign — shell command analysis simply degrades to
parsingFailed, which the SDK handles.The repo already intercepts the SDK's
console.logrules/skills load diagnostics and routes them to opencode logging;console.warnwas never covered.Fix
Extends the existing interceptor pattern to
console.warnon both transports:src/provider/cursor-log-intercept.ts):installCursorLogInterceptornow wrapsconsole.warn; known SDK warning prefixes are routed throughpluginLog("warn")(opencodeapp.log) instead of reaching stderr. Everything else passes through unchanged.src/sidecar/agent-host.mjs): the Node child gets the same wrapper; matched lines are forwarded as{ev:"log", level:"warn"}over the existing JSONL protocol, so nothing hits child stderr.The message remains visible in opencode logs (service
opencode-cursor, levelwarn) — just not in the prompt.Tests
test/cursor-log-intercept.test.ts: exact shell-parser line routes toclient.app.logwith levelwarn; unrelated warns pass through the original.test/sidecar.test.ts+test/fixtures/fake-cursor-sdk.mjs: newemitShellParserWarnfixture option; asserts the sidecar forwards the warn viaonLogand drops unrelated warns.Verification
npx tsc --noEmit— cleannpm test— 616/616 pass