Skip to content

v0.6.0 — Always start fresh, lsof-based orphan cleanup

Choose a tag to compare

@drewsephski drewsephski released this 03 Jun 21:49
· 5 commits to main since this release

Major robustness rewrite

The problem

Squid-chat's opencode serve child process was becoming orphaned (PPID=1 reparented to init) when the parent Node.js process died, holding port 4096 with the old project directory locked. Subsequent runs found the port busy and silently reused the orphan — operating in the wrong project and continuing old conversations.

Additionally, the 'same-directory' detection relied on the cwd field in runtime state, which didn't exist in older versions, causing the fallback to always reopen the old instance.

The fix — complete startup redesign

  • Always start fresh: Eliminated the 'Using existing OpenCode server' path entirely. Every run starts its own opencode serve.
  • lsof-based orphan cleanup: If anything is listening on the OpenCode port, killProcessOnPort() uses lsof -ti :PORT to find the PID(s) and kills them with SIGTERM before waiting for the port to be released.
  • Safe fast-path: The only reuse is when the exact same squid-chat Node.js process (same PID + same cwd) is still running — then we just reopen the URL.
  • New helpers: checkPortFree() and killProcessOnPort() extract and improve the port-management logic.

Full Changelog: v0.5.1...v0.6.0