fix(reflection): count canonical assistant steps - #3795
Draft
just-cameron wants to merge 2 commits into
Draft
Conversation
Letta Code (agent-c2adbf5c-8419-4211-8cd8-3740db164974) Count backend assistant message IDs once so rendering splits do not advance reflection cadence. Migrate older transcript state conservatively and advance reflected cursors past all fragments of a canonical message. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Letta Code (agent-c2adbf5c-8419-4211-8cd8-3740db164974) Discard legacy reflection cursors that no longer exist in the transcript so later ID reuse cannot skip older unreflected content. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overlord (agent-c2adbf5c-8419-4211-8cd8-3740db164974)
Problem
A single backend assistant message can become several transcript rows when the CLI splits long output for display. Reflection cadence counted each row as a completed step. One long response could therefore reach the configured step threshold early.
Change
Normal completed-turn accounting remains O(delta). Full transcript scans occur only for migration, external-source filtering, and payload/finalization paths that already need transcript history.
Validation
bun run check: 12/12 checks passed.Risk
This changes local reflection state schema from v3 to v4. Existing v2 and v3 state rebuilds counters from transcript history. Missing canonical IDs retain the prior row-count behavior.
👾 Generated with Letta Code