Skip to content

Separate timeline head state from conversation context - #3876

Merged
ymichael merged 2 commits into
mainfrom
bb/timeline-head-state-context
Sep 17, 2026
Merged

ymichael merged 2 commits into
mainfrom
bb/timeline-head-state-context

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Latest plan/goal snapshots were inserted into conversation context before its bounds were calculated. An old plan could pull thousands of unrelated turn markers into a small current page. Projecting that snapshot as a partial historical turn also made current row ordering depend on unrelated head state.

What changed

Load latest head state separately and use it only for plan/goal extraction. Conversation events determine context bounds, grouping, and pagination. Include head-state rows in selection-cache byte accounting.

Stacked on #3874; this PR contains only the head-state separation.

How you verified

  • Added regressions for an old plan across 100 turns, auxiliary state preserving current row order, and late changes to omitted commands retaining the pagination merge guard.
  • 406 thread-view tests, relevant timeline server tests, client-core tests, and server/thread-view/client-core typechecks passed. Final head-state and selection-memo run: 18 tests passed.
  • Compared actual default cold, repeat-open, and unchanged-update routes across all 2,385 threads in a consistent read-only main-DB snapshot. Rendered rows and head state match throughout. 41 threads change only olderRowsSourceSeqEnd, because auxiliary historical snapshots no longer participate in conversation projection. One already-deleted thread returns the same 404.
  • Cold Post-merge cop: 117.55 → 35.45 ms after the index fix, with 7,364 → 901 selected events. S10 remains at 7,161 events. Broad latency flags were rechecked over nine measured samples across 19 threads; none retained a >10% and >5 ms regression. Focused Post-merge cop: 109.22 → 36.06 ms. Measurements are server-route timings on a shared host, not browser rendering timings.

AGENT GENERATED

Base automatically changed from bb/timeline-typed-context-index to main September 17, 2026 22:40
@ymichael
ymichael merged commit 1a66f35 into main Sep 17, 2026
16 checks passed
@ymichael
ymichael deleted the bb/timeline-head-state-context branch September 17, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant