fix(host): an agent archived off a plan the list still holds takes its unread dot with it

Merged
CH
11d ago
+83-2

Follow-up to #3284, from Devin's review there, which came in after it merged.

What was wrong

Since #3284, the agent ledger is fed from the followed task list. That list leaves archived agents out, but observeFollowed only forgot an agent when its whole plan left the list. So archiving an agent while its unread dot was showing left the dot behind. The 30 s watch that #3284 removed used to drop such agents.

Change

observeFollowed also forgets an agent on a plan the list still holds when the list no longer names that agent. Every push of the followed list carries both parts (plans and agents), so the snapshot is never partial.

It forgets a missing agent only if an earlier push named it. An agent known only from a Start answer is kept through two pushes in a row that leave it out, because with Realtime on a push of the plans can carry an agents part from before that Start. It's forgotten on the third, as one archived before the list ever named it (both from Devin's review).

Checks

  • New test in agent-notices.test.ts; the host's notices and client tests pass (58).
  • Typecheck and biome are clean.

Made with Luke


Devin Review