Skip to content

Conversation

@edlsh
Copy link
Contributor

@edlsh edlsh commented Dec 23, 2025

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

…ation

PR1 of async subagent delegation stack (Issue sst#5887).

This commit introduces the SessionRunner namespace which provides a unified
interface for executing session loops:

- runOnce(): Synchronous execution wrapping SessionPrompt.prompt (implemented)
- runBackground(): Fire-and-forget execution for async delegation (scaffold only)
- Options/RunResult types for future background execution
- State tracking infrastructure for active background runs

No behavior change - this is purely an abstraction layer.

Next: PR2 will implement runBackground() with lifecycle events.
…le events

- Add Job, JobKind, JobStatus, EnqueueOptions schemas
- Add enqueue(), cancel(), get(), list() APIs
- Add lifecycle events (Queued, Started, Completed, Failed, Canceled, TimedOut)
- Add configurable timeout and concurrency via experimental.backgroundTasks
- Fix: queue now restarts after idle (removed stale started flag)
- Fix: dedupe now returns completion promise, not immediate job reference
@edlsh edlsh force-pushed the feat/async-subagent-2-background branch from ab69463 to ce3927a Compare December 24, 2025 03:08
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.

1 participant