Skip to content

v0.4.3 — AutoBG fires at 1 minute + cross-process fire lock

Choose a tag to compare

@engrtarun engrtarun released this 30 Oct 04:32
· 8 commits to main since this release

AutoBG retimed and made multi-process safe (real-machine findings from live debug logs):

  • 1-minute threshold (was 2 min): THRESHOLD_MS = 60_000. Real long runs (downloads/builds/curl) today live 3-6 min; firing at 1 min keeps the foreground yours much sooner.
  • Warn checkpoint moved to T-15s (45s elapsed): AutoBG: 15s — "bash" moves to background automatically — one toast, still one-shot.
  • Cross-process fire lock: machines running several OpenCode processes simultaneously were firing one POST per process (log showed fire x3). An NTFS-atomic wx lock file (.autobg-fire-<sid>.lock, 10s TTL) makes exactly one process move the session; the rest stand down and log autobg lock held … another process fired first. Stale locks (>10s) are taken over.
  • Client-shape probe: one-time autobg client keys: dump into debug.log — documents where YOUR build hides (or dropped) the toast API; the duck now also tries client.tui.toast, client.tui.toastShow, client.toast.
  • Evidence trail: unmapped sessions (subagent children / pre-map) now log autobg skip unmapped instead of failing silently — "why didn't it fire" is always answerable from debug.log now.

Update: copy index.ts, lib.ts, autobg.ts, package.json into ~/.config/opencode/plugins/model-badges/ and restart OpenCode.

35-test suite green on node 22 + node 24 (includes 2 new lockfile behavior tests).