cccc icon indicating copy to clipboard operation
cccc copied to clipboard

Clarify freshness of terminal output observations in activity snapshots

Open chriscoveries opened this issue 3 weeks ago • 3 comments

At v0.4.49 (fa868a3630ffa0951fa029eba207a8728c1c1e06), terminal actor.activity entries include pty_last_output_at and pty_quiet_seconds. Both fields appear in the actor listing and in activity snapshots. However, crates/cccc-daemon/src/ops/actor_activity.rs:7-11,41-54 deduplicates snapshots on state and runner only, so a change to just these two observations does not publish a new activity snapshot. The values are computed in crates/cccc-daemon/src/ops/working_state.rs:117-131. Neither file changed between v0.4.47 and v0.4.49.

A subscriber can therefore hold old observation values until some other fingerprinted change publishes a snapshot. A source search found no web or CLI consumer of these fields, but that does not prove that external clients don't consume them.

Reproduction (cccc 0.4.49, Linux x86_64)

  1. In a test group with a project scope attached, start a custom PTY actor running /bin/cat.
  2. Send it a message. Delivery was accepted about 1.5 s after the send.
  3. Seven seconds later, actor list showed the fresh observation: pty_last_output_at at the delivery time and pty_quiet_seconds: 5.
  4. At that same moment, the latest actor.activity event was still the one from the actor's start, about 40 s earlier, carrying that earlier pty_last_output_at and pty_quiet_seconds: 0.

The actor stayed running and waiting on the same PTY runner throughout, so the fingerprint never changed and no snapshot was published. We saw the same behaviour on v0.4.47. This shows the gap over the observed window, not an indefinite delay.

Ask

Could the API document how often these observations refresh, or publish bounded observation updates where fresh values are needed?

A regression test could change terminal output while state and runner stay fixed, then check the documented update or staleness behaviour. That test shouldn't treat output as proof of a working turn. Related: #146 deliberately introduced these display-only observations and explicitly rejected output-based working-state inference.

chriscoveries avatar Nov 06 '26 13:11 chriscoveries

Thanks, this is accurate, and we reproduced it on v0.4.49. actor.activity is published at startup and when the tracked Actor set, a state or a runner changes, so the two terminal observations in it are as of that event. actor_list gives a current best-effort observation at the time of the request, and can still return null.

We don’t plan to publish these on output changes. The event goes into the append-only ledger, so following terminal output or a quiet timer would keep writing to it, and these values aren’t a measure of whether work is happening, as PR 146 set out. We’ve prepared a clarification in the daemon IPC standard for the next release. A client that needs a fresh value can read actor_list.

ChesterRa avatar Nov 06 '26 14:11 ChesterRa

Thanks for reproducing it and for the IPC standard clarification. That answers it for us: clients that need a fresh terminal observation read actor_list, and actor.activity stays an as-of-event record. Fine to close this as answered once the clarification ships.

chriscoveries avatar Nov 06 '26 19:11 chriscoveries

Closing: the IPC standard now states that actor.activity is appended on snapshot, actor-set, state and runner changes rather than on terminal output, so these two values are as of the event and actor_list reads them at request time. That answers the question. Thanks.

chriscoveries avatar Nov 11 '26 03:11 chriscoveries