Skip to content

Scheduled tasks: expose in-flight fire state, progress, and wall-clock timeout #386

Description

@JAORMX

Problem

A scheduled task can be claimed and run for a long time without giving the operator any useful indication that it started, is still making progress, or became stuck.

We saw this with monitor-pr-6208:

  • the schedule triggered at 2026-08-05 16:20:07 +03:00;
  • ScheduleQuery inspect showed fire count: 1 and fires: none;
  • the persisted schedule state had LastFireSessionID: "pending";
  • the minted sched-- session was still running, with 16 turns, 26 tool calls, and more than 1.2M cumulative input tokens;
  • no fire outcome record existed, so nothing was delivered back to the originating chat.

The operator had to ask whether the task had triggered, then inspect storage to learn that it was still running.

Root cause

The status surface mixes two lifecycle stages:

  1. ScheduleStore.Claim increments FireCount and stores the pending sentinel before execution starts (engine/port/schedule.go, ScheduleState).
  2. ScheduleStore.RecordFire creates the inspectable fire record only after the entire agent run reaches a terminal result (internal/adapter/scheduler/scheduler.go, fireClaimed).

renderScheduleInspect only renders completed fire records. When a claim exists without a record it prints fires: none, which can mean any of:

  • running normally;
  • running but no longer making progress;
  • process crashed after claim;
  • RecordFire failed.

Scheduled fires also have default turn/tool-call bounds, but no per-fire wall-clock bound. A run can therefore remain non-terminal and silent for a long time.

Fire-result delivery happens only after terminal completion. There is no start or progress notification to the originating conversation.

Desired behavior

An operator should be able to answer these without querying internal storage:

  • Did the schedule trigger?
  • Which fire session is running?
  • Is it still making progress?
  • When did progress last occur?
  • Did it time out, crash, or complete?
  • Where can I inspect the running or completed fire?

Acceptance criteria

  • Schedule inspection represents claimed, running, terminal, and stale/lost states explicitly. A claimed fire must never render as fires: none.
  • The minted sched-- session ID is persisted or otherwise discoverable as soon as the fire starts, not only after RecordFire.
  • The status includes at least start time and last-progress time for an in-flight fire.
  • A fire gets a configurable wall-clock deadline. Reaching it produces a terminal, persisted outcome with an accurate stop/error reason and releases run resources.
  • The originating conversation receives a lightweight "started" notice with schedule name and fire/session ID.
  • Terminal delivery remains exactly once. Start/progress notices must not duplicate the final report or inject model-authored fire content into the origin conversation.
  • A crashed process or permanently missing fire session becomes distinguishishable from a live run after restart.
  • ScheduleQuery inspect, the /schedule TUI overlay, and the gRPC/HTTP schedule surface agree on the lifecycle state.
  • Tests cover: live fire, completed fire, timed-out fire, crash after Claim before session creation, crash after session creation before RecordFire, and RecordFire failure.

Relevant code

  • engine/port/schedule.go (ScheduleState, ScheduleFire, Claim contract)
  • internal/adapter/scheduler/scheduler.go (fireOne, fireClaimed)
  • internal/app/scheduler_fire.go (makeFireFunc, per-fire defaults)
  • engine/agent/scheduletool.go (renderScheduleInspect)
  • internal/app/scheduler_delivery_run.go (deliverFireResult)

Related issues

Activity

  1. added
    enhancement
    on Aug 5, 2026
  2. added
    tui
    fit-and-finish
    on Aug 13, 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

    enhancementfit-and-finishtuiuiux

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions