Skip to content

fix: remove __DCP_CONTEXT_HANDLED__ throw that leaked to error logs (#296) - #297

Open
ranxianglei wants to merge 3 commits into
masterfrom
2026-08-13_fix-dcp-context-handled-error
Open

fix: remove __DCP_CONTEXT_HANDLED__ throw that leaked to error logs (#296)#297
ranxianglei wants to merge 3 commits into
masterfrom
2026-08-13_fix-dcp-context-handled-error

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Problem (Issue #296)

/acp commands throw Error: __DCP_CONTEXT_HANDLED__ which leaks to the opencode error log. In opencode 1.18.18, this produces level=ERROR entries for every /acp invocation.

Reported by @BsoBird on opencode 1.18.18 + ACP 1.14.16.

Root Cause

The command handler in hooks.ts threw new Error("__DCP_CONTEXT_HANDLED__") after handling /acp commands (lines 295, 299). This sentinel was meant to abort command processing, but opencode catches and logs it as an error.

Fix

Replace both throw new Error("__DCP_CONTEXT_HANDLED__") with return. Commands deliver output via sendIgnoredMessage (writes directly to session via client.session.prompt), so the hook can return normally without side effects.

Verification

  • TypeScript: 0 errors
  • Tests: 977 pass, 0 fail (added regression test)
  • Build: 391.50 KB
  • Deployed locally

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

📦 Built Plugin Artifact

Branch: 2026-08-13_fix-dcp-context-handled-error (84039f2)

Option A — Install from npm PR tag (recommended)

opencode plugin opencode-acp@pr-297 --global

Each push to this PR publishes a new version under the pr-297 npm tag.

Option B — Install from GitHub

opencode plugin "github:ranxianglei/opencode-acp#2026-08-13_fix-dcp-context-handled-error" --global

Option C — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf opencode-acp-pr297.tgz
cp -r package/dist ~/.cache/opencode/packages/opencode-acp@latest/node_modules/opencode-acp/dist
  1. Restart opencode to pick up changes.

This comment is automatically updated on each push.

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