Skip to content

Conversation

@hawkff
Copy link
Contributor

@hawkff hawkff commented Feb 11, 2026

What

This PR includes two reliability fixes for cursor-acp on OpenCode:

  1. Respect plugin disable state in OpenCode config
  • plugin entrypoint now checks opencode.json before initializing
  • if cursor-acp is removed from the plugin array, plugin init is skipped (no-op)
  • supports config path resolution via:
    • OPENCODE_CONFIG
    • XDG_CONFIG_HOME
    • ~/.config/opencode/opencode.json
  1. Fix BSD/macOS grep regex failures in tool hook
  • grep tool now retries with -E when default regex mode returns syntax errors (code=2)
  • handles BSD variants such as:
    • invalid repetition count
    • braces not balanced
    • Unmatched {
  • keeps existing behavior for no-match (code=1 => No matches found)

Why

  • Users removing cursor-acp from the config plugin array could still get plugin/runtime errors if the plugin symlink remained present.
  • On macOS/BSD grep, some model-generated patterns fail in basic regex mode, causing noisy Tool hook execution failed warnings.

Validation

  • bun run build
  • bun run test:ci:unit
  • bun run test:ci:integration

All pass on the fork’s main.

Files

  • src/plugin-entry.ts
  • src/plugin-toggle.ts
  • src/tools/defaults.ts
  • tests/unit/plugin-toggle.test.ts
  • tests/tools/defaults.test.ts
  • tests/competitive/edge.test.ts
  • tests/integration/comprehensive.test.ts

- respect opencode plugin array before initializing cursor-acp\n- disable plugin entrypoint when cursor-acp is removed from config\n- add plugin toggle helper + tests\n- stabilize flaky cache timing assertions in unit/integration tests\n- make tmp-path assertions cross-platform
- retry grep with -E when BSD basic-regex parsing fails\n- catch unmatched brace error variants (e.g. 'Unmatched {')\n- add regression test for shell-parameter style pattern\n- keep no-match behavior unchanged
- register shell as a compatibility alias for bash in plugin tool hooks\n- keep existing bash behavior unchanged\n- add unit coverage asserting shell tool registration
- normalize tool-hook args against session worktree/directory\n- resolve relative path-like args to absolute workspace paths\n- default bash/shell cwd and grep/glob/ls path to session workspace when omitted\n- add regression tests for write path resolution and bash cwd defaults
- retry installer builds with forced dependency reinstall on missing-module failures\n- improve cursor-agent model discovery command compatibility\n- surface concise command output in installer errors for actionable diagnostics\n- apply the same build-retry fallback in shell installer path
@Nomadcxx Nomadcxx self-requested a review February 12, 2026 04:26
Nomadcxx pushed a commit that referenced this pull request Feb 12, 2026
Includes targeted fixes extracted from stale stacked PR #20:\n- plugin-entry disable guard based on plugin array in opencode.json\n- grep ERE fallback on regex syntax errors (BSD/macOS code=2)\n\n(cherry picked from commit cd39ea8)\n(cherry picked from commit aa97a1a)
Nomadcxx added a commit that referenced this pull request Feb 12, 2026
fix: port targeted plugin-disable and BSD grep fixes from #20
@Nomadcxx
Copy link
Owner

Thanks again for this PR — this was very helpful.

I closed this as superseded because the branch became a stacked umbrella and now conflicts with current main after other merges. I opened and merged a focused replacement PR that ports the two still-relevant fixes cleanly on top of current main:

  • plugin-entry disable guard (respect plugin array in opencode.json)
  • BSD/macOS grep regex fallback (-E retry on code=2 regex syntax errors)

Merged replacement: #24
#24

Credit preserved: the ported commit keeps original attribution and references your source commits.

@Nomadcxx Nomadcxx closed this Feb 12, 2026
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.

2 participants