Skip to content

fix(cli): filter opencode processes by --port argument#128

Merged
nickjvandyke merged 2 commits intonickjvandyke:mainfrom
epheien:fix/filter-opencode-processes-by-port
Jan 13, 2026
Merged

fix(cli): filter opencode processes by --port argument#128
nickjvandyke merged 2 commits intonickjvandyke:mainfrom
epheien:fix/filter-opencode-processes-by-port

Conversation

@epheien
Copy link
Copy Markdown
Contributor

@epheien epheien commented Jan 13, 2026

Summary

  • Fixed the process filtering logic in lua/opencode/cli/server.lua
  • Now correctly filters opencode processes by checking for the --port argument
  • This prevents false positives when multiple processes contain "opencode" in their command line

Changes

  • Updated the pgrep command to include -lfa flags and filter by --port argument
  • Changed PID extraction to properly parse the new pgrep -l output format

This fix ensures that only actual opencode server processes (those started with --port argument) are discovered, improving reliability when multiple processes with similar names are running.

@epheien epheien force-pushed the fix/filter-opencode-processes-by-port branch from 76979e0 to c014606 Compare January 13, 2026 15:41
@epheien
Copy link
Copy Markdown
Contributor Author

epheien commented Jan 13, 2026

The motivation for this modification is that under macOS, there are many opencode processes, which causes this plugin to be very slow when acquiring ports.

Xnip2026-01-13_23-42-55

@nickjvandyke nickjvandyke merged commit d849ba9 into nickjvandyke:main Jan 13, 2026
2 checks passed
@nickjvandyke
Copy link
Copy Markdown
Owner

Thanks for this! I guess the way I use opencode doesn't result in nearly as many processes (last I checked), but this seems great for some users! 😀

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