Skip to content

fix(background-agent): stop prune TTL from killing running tasks - #152

Merged
klpanagi merged 1 commit into
devfrom
fix/background-prune-ttl-running-tasks
Sep 30, 2026
Merged

klpanagi merged 1 commit into
devfrom
fix/background-prune-ttl-running-tasks

Conversation

@klpanagi

Copy link
Copy Markdown
Owner

Retention TTL was doubling as an execution limit: pruneStaleTasksAndNotifications aged every task from startedAt, force-killing running oracles after 30 min and evicting just-completed long runs from memory.

Changes:

  • Running tasks exempt from prune (stale reaper and wall-clock own execution bounds)
  • Terminal tasks age from completedAt for a full 30-minute revive window, evicted silently without status overwrite
  • Pending queue-timeout kept, tagged terminalReason expired
  • Added expired to BackgroundTerminalReason and BgHandleSchema; revive guidance distinguishes expired from unknown-task
  • Tests updated; latent writeHandle path bug in retain test fixed

Verification: retain tests 4 pass; background-agent suite 352 pass with 1 pre-existing parallel-pollution flake (fails identically on clean tree); typecheck exit 0; lint clean.

Retention TTL no longer doubles as an execution limit: running tasks are exempt from prune, terminal tasks age from completedAt for a full 30-minute revive window, pending queue-timeout tagged expired, and revive guidance distinguishes expired from unknown-task.
@klpanagi
klpanagi merged commit 22e0740 into dev Sep 30, 2026
6 checks passed
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