Skip to content

fix(opencode): avoid hook listener leaks and Windows popups - #688

Merged
jeff-r2026 merged 1 commit into
Tencent:mainfrom
dvd233:fix/opencode-hook-spawn-windowhide-673
Sep 21, 2026
Merged

jeff-r2026 merged 1 commit into
Tencent:mainfrom
dvd233:fix/opencode-hook-spawn-windowhide-673

Conversation

@dvd233

@dvd233 dvd233 commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace the generated OpenCode hook's Bun Response stdin bridge with Node child_process.spawn
  • pass windowsHide: true on Windows and swallow child-process failures
  • remove per-dispatch listeners after completion and cover repeated dispatches with a regression test

Validation

  • npx vitest run src/__tests__/opencode-hooks.test.ts --reporter=verbose
  • npx tsc --noEmit
  • npm run build
  • node dist/index.js --version

Fixes #673

@jeff-r2026 jeff-r2026 self-assigned this Sep 21, 2026
@github-actions

Copy link
Copy Markdown
  • [P1 blocking] Handle errors from the stdin pipe — src/opencode-hooks.ts:119: child.stdin is a separate Writable; if teamai exits or closes stdin early, it can emit an error such as EPIPE. The child’s error listener does not catch stream errors, so this may become an uncaught exception and disrupt OpenCode. Add a stdin error handler and settle the promise safely.
  • [P1 blocking] Provide a real feature-level end-to-end verification record — The PR description lists a unit test, typecheck, build, and --version smoke test, but never installs/runs the generated OpenCode plugin or verifies hook dispatch and Windows failure behavior through the real CLI. This does not satisfy the required e2e test plan/record.

@jeff-r2026
jeff-r2026 merged commit 2c0ae96 into Tencent:main Sep 21, 2026
10 checks passed
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.

[Bug] OpenCode hook 触发 MaxListenersExceededWarning 与 Windows CMD 弹窗

2 participants