Skip to content

v6.6.0

Choose a tag to compare

@ndycode ndycode released this 09 Jul 12:27
· 345 commits to main since this release

Fixed

The plugin no longer takes over process termination inside the opencode host (#187).

lib/shutdown.ts installed a process-wide SIGINT/SIGTERM handler that called process.exit(0) after running cleanup. Because this package loads as a plugin inside the opencode process, that exit won the race against opencode's own asynchronous shutdown — so pressing Ctrl+C exited without opencode printing the session id.

Process termination is now owned explicitly rather than inferred from the signal. It defaults to off, so the plugin runs its cleanup and leaves termination to the host. Only an entrypoint that is the process opts in: the standalone warm CLI (the one bin path that installs the handler, because refreshing a token persists credentials under the storage lock) calls setShutdownOwnsProcess(true) and now exits 130/143 (128 + signo) on a signal instead of reporting 0, which masked an interrupt as success.

The debounced-save flush is still awaited on shutdown in both modes, so the no-lost-rotations guarantee from #110 holds.

runCleanup() no longer drops work when a drain overlaps. It emptied the cleanup queue before awaiting it, so a beforeExit firing during an in-flight signal drain returned immediately against an already-empty queue rather than awaiting the real cleanup. Concurrent callers now share the in-flight promise, cleared once settled so sequential calls still re-drain.

Added

  • setShutdownOwnsProcess(boolean), exported from lib/shutdown.ts and the lib/index.ts barrel, lets a standalone entrypoint claim ownership of process termination. The flag is read at signal time, not captured when the handlers are installed, so an entrypoint may opt in after the first registerCleanup().

Upgrading

No action required for plugin users — the fix is the default. If you embed this package and rely on it terminating the process on a signal, call setShutdownOwnsProcess(true) at startup.


npm: https://www.npmjs.com/package/oc-codex-multi-auth/v/6.6.0
Full diff: v6.5.0...v6.6.0