Repository navigation
Description
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 inspectshowedfire count: 1andfires: none;- the persisted schedule state had
LastFireSessionID: "pending"; - the minted
sched--session was stillrunning, 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:
ScheduleStore.ClaimincrementsFireCountand stores thependingsentinel before execution starts (engine/port/schedule.go,ScheduleState).ScheduleStore.RecordFirecreates 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;
RecordFirefailed.
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 afterRecordFire. - 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/scheduleTUI 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,Claimcontract)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
- Scheduled tasks: fire an agent run on a cron schedule or at a future time, autonomously and durably #189 implemented the scheduled-task subsystem and is closed.
- Scheduled tasks — Phase 3a: mecatui /schedule slash command + overlay #234 implemented the
/scheduleoverlay and is closed. - Scheduled tasks — Phase 3b: jump-to-fire-transcript #235 and mecatui: open an existing session by ID (view its transcript) #245 implemented completed-fire/session transcript access. They do not provide in-progress visibility or live-tail.
- Run scheduled tasks with bounded, revocable user authority #373 concerns scheduled-run identity and consent, not lifecycle observability.
Activity
fix(schedule): atomic targeted fire-progress writes (#386 review)
feat(schedule): in-flight fire state, progress, and wall-clock timeout (