Skip to content

fix(session): anchor message windows on renderable tail rows#2986

Merged
1 commit merged into
nesquena:masterfrom
ai-ag2026:fix/tars-message-window-renderable-tail-20260526T213223Z
May 27, 2026
Merged

fix(session): anchor message windows on renderable tail rows#2986
1 commit merged into
nesquena:masterfrom
ai-ag2026:fix/tars-message-window-renderable-tail-20260526T213223Z

Conversation

@ai-ag2026
Copy link
Copy Markdown
Contributor

Summary

  • Anchors paginated /api/session message windows on the newest renderable non-tool row when the raw tail only contains hidden tool result rows.
  • Adds regression coverage for tail windows, msg_before, and all-tool fallback behavior.

Why

Tool result rows are not rendered as standalone transcript rows. A long session whose newest raw rows are only tool outputs can otherwise open to a non-empty API message array but a blank visible transcript. The backend should choose a tail window that contains the newest visible transcript anchor while preserving raw message offsets for paging.

Test Plan

  • python3 -m py_compile api/routes.py tests/test_session_message_window_renderable_tail.py
  • python3 -m pytest tests/test_session_message_window_renderable_tail.py -q

Result: 4 passed.

@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Holding briefly — anchors message windows on renderable tail rows. +112 LOC in api/routes.py. The fix concept is right (compression boundary should be the anchor, not the visible tail) and pairs conceptually with #2915 (already shipped in v0.51.137 / Release DI).

What needs checking:

  1. Does this conflict with fix: marker-based compression anchor calculation #2915's marker-based anchor logic that just shipped? Both touch the same conceptual surface from different ends.
  2. The _renderable_tail_anchor function — does it agree with the existing compression_anchor_visible_idx semantics or does it redefine them?
  3. ai-ag2026's flood-pattern means treating each PR individually with care — confirm this isn't bundling unrelated changes.

Will review more carefully on the next sweep. @ai-ag2026, thanks.

@nesquena-hermes nesquena-hermes closed this pull request by merging all changes into nesquena:master in 83862e6 May 27, 2026
@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Merged in Release DL / v0.51.140 (stage-batch22 — 5-PR hold-bucket reassessment with PRs #2899 #2902 #2964 #2970 #2986).

Thanks @ai-ag2026! 🚢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants