Skip to content

Lookout: at 1,000 subscribers, a lead's notes on finished tasks lag by about 20 s #576

Closed

Description

@lydakis

Found by the Sonny perf screen added in #573 (bench/sonny_screen.py, lookout scenario). The numbers are recorded in docs/DAEMON_MEASUREMENTS.md under that PR's matched screen.

What the screen shows

Subscribers Task turns ended Named in a lead's note within 10 s of the load Note p95
100 (all) every one 2.8 s
1,000 5,000 660 12 to 20 s across runs

The lookout's CPU per 1k deltas stays flat at about 10 ms, so it isn't CPU-bound. The daemon's timings in the same run didn't move either.

Likely cause

A lead takes its notes one turn at a time. When a hundred of its tasks finish together, their news queues behind the lead's current turn, then behind each note turn after it. So the delay grows with how many tasks finish at once, not with the lookout's own work.

What to decide

This is the lookout's batching question, not a daemon one. Options, in the order I'd look at them:

  1. Coalesce into the running turn. A lead that is mid-turn gets the waiting news as one attached note (delivery: "attach", as steers do), instead of a new turn per batch. This follows how Codex and Claude Code fold background-task results into the next model call.
  2. One note per batch window. When a lead's queue holds more than N endings, they go out as one note that lists them all, with a cap on its size.
  3. Leave it. Every ending still reaches its lead, just late. The 100-subscriber case is fine.

Done when the screen's p95 at 1,000 subscribers is close to the 100-subscriber one, and every ended turn is named.

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions