You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stop a kagent lane run at its limit even when its trigger cannot cancel it #4881
Part of #4866. Must be done before the lane's schedule resumes (ADR 0014, point 6).
Problem
The lane's per-run spend cap (about $6, a 20-minute run limit) is enforced only by its trigger Job, which cancels the kagent task over A2A at the limit. kagent and Substrate have no task deadline of their own: the Harness and AgentTemplate specs have no time or turn limit, and Substrate's SandboxConfig has no sandbox lifetime.
devantler-tech/platform#5905 makes the trigger confirm its cancel and fail the Job when it cannot, so a failed cancel is visible. It cannot stop the task, though. If the cancel is refused, or the trigger's pod dies mid-run (a node drain, the Job's deadline), the task keeps running and spending until it ends on its own. The API workspace's monthly spend limit is then the only stop.
Goal
A run stops at its limit even when the trigger cannot cancel it.
Options to evaluate
Enforce the run window in the lane's Anthropic proxy, which already sits on every model call: refuse model calls once a run has used its time or token allowance.
An upstream run deadline in kagent (a task or harness timeout), with an upstream issue first.
A watchdog outside the trigger that cancels, and if needed stops, any task still running past the limit.
Acceptance criteria
A run whose trigger cannot cancel it still stops making model calls within a few minutes of its limit.
A test proves it, for both a refused cancel and a trigger that exits mid-run.
This no longer applies. On 2026-11-09 the maintainer decided that a kagent run has no time limit: the Anthropic workspace's monthly spend limit, equal to the credit, is the lane's only spend cap. A cancelled run wastes what it has already spent (ADR 0014, 2026-11-09 amendment; devantler-tech/platform#5964). No per-run limit is left to enforce, and the trigger this issue worked around is being replaced by kagent's own scheduled runs (devantler-tech/platform#5999).
Activity
devantler commentedon Nov 10, 2026
This no longer applies. On 2026-11-09 the maintainer decided that a kagent run has no time limit: the Anthropic workspace's monthly spend limit, equal to the credit, is the lane's only spend cap. A cancelled run wastes what it has already spent (ADR 0014, 2026-11-09 amendment; devantler-tech/platform#5964). No per-run limit is left to enforce, and the trigger this issue worked around is being replaced by kagent's own scheduled runs (devantler-tech/platform#5999).