opencode
opencode copied to clipboard
feat(session): implement background job runner with queue and lifecycle events
Implements the background job queue for async subagent delegation (#5887).
Stacked on #5996 — review/merge that first, then rebase this PR.
Changes:
enqueue()with FIFO queue, deduplication, concurrency limit (default 2)- Lifecycle events:
session.background.{queued,started,completed,failed,canceled,timed_out} - Timeout enforcement via
Promise.race+ AbortController cancel(),get(),list()helpers- Memory pruning (max 100 completed jobs)
- Proper cleanup on Instance dispose
- Config:
experimental.backgroundTasks.{timeoutMs,maxConcurrent} - 25 integration tests