Skip to content

Stop a kagent lane run at its limit even when its trigger cannot cancel it #4881

Closed as not planned

Description

@devantler

🤖 Generated with Claude Code

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

Activity

  1. added theissue type on Nov 8, 2026
  2. moved this to 📥 Backlog in 🌊 Project Boardon Nov 8, 2026
  3. devantler commented on Nov 10, 2026

    @devantler
    ContributorAuthor

    🤖 Generated with Claude Code

    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).

  4. moved this from 📥 Backlog to ✅ Done in 🌊 Project Boardon Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    Priority

    None yet

    Start date

    None yet

    Target date

    None yet

    Effort

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions