Found during the 0.106.2 release review of #5589. Deliberately not fixed there, because any real fix changes a shared rule and its test contract.
What happens
Run a turn in your own browser and let it finish. Reload the page within the few seconds it takes the backend to finish ingesting that turn's records. The last answer can come back visibly truncated, missing later tool results or text.
It repairs itself the next time you open the session, once ingest has caught up. The durable record log always had the complete turn.
Why
When a turn goes live locally the record watermark is cleared on purpose, because the browser cannot know what the runner logged for it. The next open is then meant to re-sync from the log.
During that window the guard in web/packages/agenta-entities/src/session/core/transcriptAdoption.ts has nothing to compare against. A missing watermark reads as 0, so the growth check passes. And because a turn grows in place rather than adding messages, the partial server copy has the same message count as the complete local one, so the message-count floor passes on equality too. The truncated copy is adopted and cached.
Nothing refetches again in that mount, because the run is over and the poll only runs while a run is live elsewhere.
Why it is not a simple fix
Equal-count adoption is not a bug, it is the #5530 fix. A turn that pauses for approval and completes keeps the same message count from start to finish, which is exactly why the old message-count comparison was replaced. So the rule cannot simply reject equal counts.
Counts alone cannot tell a lagging copy from a legitimate re-sync. The plausible fix is a completion guard: when the watermark is absent, only adopt if the server transcript's last turn is closed, since the mapper only closes a message on a done record. That means adding an input to the pure rule, changing its interface, updating session-transcript-adoption.test.ts, and deciding what a paused tail should do under it.
Options
- Leave it. Transient, self-healing, needs a reload inside a few-second window. This is what 0.106.2 ships.
- Add the completion guard to the adoption rule, with tests.
- Delay clearing the watermark until ingest is confirmed. Removes the ambiguity at the source but touches the runner contract.
Arda owns this rule and should pick.
Found during the 0.106.2 release review of #5589. Deliberately not fixed there, because any real fix changes a shared rule and its test contract.
What happens
Run a turn in your own browser and let it finish. Reload the page within the few seconds it takes the backend to finish ingesting that turn's records. The last answer can come back visibly truncated, missing later tool results or text.
It repairs itself the next time you open the session, once ingest has caught up. The durable record log always had the complete turn.
Why
When a turn goes live locally the record watermark is cleared on purpose, because the browser cannot know what the runner logged for it. The next open is then meant to re-sync from the log.
During that window the guard in
web/packages/agenta-entities/src/session/core/transcriptAdoption.tshas nothing to compare against. A missing watermark reads as 0, so the growth check passes. And because a turn grows in place rather than adding messages, the partial server copy has the same message count as the complete local one, so the message-count floor passes on equality too. The truncated copy is adopted and cached.Nothing refetches again in that mount, because the run is over and the poll only runs while a run is live elsewhere.
Why it is not a simple fix
Equal-count adoption is not a bug, it is the #5530 fix. A turn that pauses for approval and completes keeps the same message count from start to finish, which is exactly why the old message-count comparison was replaced. So the rule cannot simply reject equal counts.
Counts alone cannot tell a lagging copy from a legitimate re-sync. The plausible fix is a completion guard: when the watermark is absent, only adopt if the server transcript's last turn is closed, since the mapper only closes a message on a
donerecord. That means adding an input to the pure rule, changing its interface, updatingsession-transcript-adoption.test.ts, and deciding what a paused tail should do under it.Options
Arda owns this rule and should pick.