altimate-code
altimate-code copied to clipboard
fix: background subagent records are not removed when a session is deleted
Found during the v0.12.11 release review of #1643 "fix(tool): run background subagents without blocking the parent when the flag is on". Deferred because it only affects long-running serve processes with the experimental flag on.
backgroundTasks and pendingLaunches in packages/opencode/src/tool/task.ts are module-level maps. Settled records are capped at 1,000, but nothing removes a session's records when the session is deleted, and unsettled records are never evicted, so a long-lived serve process keeps their result promises and output. Remove a session's records on session.deleted, and bound unsettled ones.