cccc icon indicating copy to clipboard operation
cccc copied to clipboard

Headless runtimes without a local session report "idle" with no timestamp

Open chriscoveries opened this issue 3 weeks ago • 3 comments

What happens

For an actor on the headless runner whose runtime writes no local working state (deepseek, for example), actor_list reports effective_working_state: "idle", effective_working_reason: "headless_running", effective_working_updated_at: null, effective_active_task_id: null. The fallback branch in crates/cccc-daemon/src/ops/working_state.rs (lines 107-108, unchanged from v0.4.49 through v0.4.50 and main 2736b359) returns that tuple with no inputs, so a client cannot tell how long the actor has been idle, or whether it is idle at all.

Why it matters

A client that wants "idle for N minutes" (dispatch, idle checks) has to rebuild it from the ledger: the last chat.message / actor.activity per actor. The PTY path and provider-headless sessions already carry updated_at; this branch is the gap.

Ask (bounded)

Set effective_working_updated_at on the headless fallback from facts the daemon already holds (the last delivery or turn-end event for that actor), or else report "unknown" rather than "idle". Which one is your call; we can send the fix either way.

Evidence

  • Captured actor_list rows for five enabled headless actors on a live group: all idle / headless_running with effective_working_updated_at: null.
  • One actor's own row captured while it was mid-turn: still idle / headless_running / null, with running: true.
  • Source: for the deepseek runtime the fallback at working_state.rs:107-108 is the only reachable branch.

How this was checked

Rows captured on a live group (v0.4.49); source re-read at v0.4.50 and main. Proposal only; a PR follows your answer, tested by the project's CI on GitHub-hosted runners.

chriscoveries avatar Nov 08 '26 15:11 chriscoveries

Thanks, confirmed, and it is more than a missing timestamp: an actor in the middle of a turn also reads idle, because that branch returns idle without any input. We agree the snapshot should not report idle without evidence. The daemon does track headless turns (the runners emit the turn events the Web applies live), so a PR could report working while a turn runs, and idle with the time the last turn ended, read from a small record the runner keeps up to date. Two constraints: the query must not wait on a runner's own locks, since some are held for a whole turn, and it must not rescan the ledger on each call. Where the state cannot be known, keep a state other than idle with a reason, or propose unknown in the contract; we'd review the field and how the Web shows it together with the PR.

ChesterRa avatar Nov 09 '26 02:11 ChesterRa

I've kept this to evidence-based working state: #225. It is checked against the actual lifecycle writers, including completion followed by an empty poll, unknown or unreadable records, and a query while a runner holds its turn lock. It does not use the generic updated_at write time as "last turn ended", and adds no ledger scan or whole-turn lock to the query.

chriscoveries avatar Nov 11 '26 19:11 chriscoveries

Version 0.4.55 no longer reports idle merely because a headless process is running. Without an authoritative observation it reports unknown with reason headless_running_state_unknown, and the Web treats that as active rather than presenting an unsupported idle state. This fixes the false-idle fallback. It does not implement the full runner-turn record proposed here, and it does not claim a last-turn completion time when no reliable observation exists.

ChesterRa avatar Nov 20 '26 10:11 ChesterRa