fix(desktop): branch snapshots keep pre-compaction history, isolated from parent (salvage #76286) - #86775
Merged
Conversation
(cherry picked from commit 57c51cc)
Read the durable display transcript when creating a branch instead of copying the compacted model projection. Hydrate the Desktop branch boundary from persisted history, avoid stale whole-chat counts, and seed the new tile from the backend snapshot. Add regression coverage for compacted histories, visible-message counts, selected prefixes, and hydration races. (cherry picked from commit c3d2d75)
Contributor
૮ >ﻌ< ა ci reviewran on c9a5fe1 — chore: map contributor email (audit_pr_attribution)
|
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.
Salvages the separable branch-snapshot half of PR #76286 (@DannyFengTianYu): branches now snapshot the complete pre-compaction display transcript, and branch transcripts are isolated from parent turns added after the fork. The PR's competing display-dedupe scheme (excluded by #86595) is NOT carried.
Changes (cherry-picked, authorship preserved)
57c51cc401— isolate branch transcripts from parent updateshermes_state.py: explicit/branchsessions (durable_branched_frommarker) own a copied transcript, so lineage walks (get_messages_as_conversation(include_ancestors=True),get_resume_conversations,get_ancestor_display_prefix) no longer pull the live parent's rows into the branch — messages written to the original after the fork stop leaking into the branch view. Compression continuations keep full lineage reads._read_ctx()connection pattern (the PR predated that refactor);_is_explicit_branch_sessionuses_read_ctxtoo.cb671285ee(fromc3d2d759ae) — preserve complete history when branchingtui_gateway/methods_session.py(session.branch): the live in-memory history is the model projection — after compaction it holds only a summary + protected tail. The branch seed now reads the persisted display projection (get_resume_conversations), reconciled with the live tail via main's existing_reconcile_display_with_live, so the child no longer permanently loses every turn archived before the fork. Falls back to the in-memory history when the DB read fails._visible_branch_historykeeps full message rows instead of the PR's minimal{role, content}copies — main's copy loop preserves reasoning fields and timeline-marker tags (display_kind/display_metadata, [Bug]: Desktop plain-Enter submit silently deleted ~65 messages — stale truncate_before_user_ordinal + auto-attached confirm_truncate (3rd occurrence after #70516, #80763) #82756); the PR's slimming would have silently dropped them (caught by main'stest_session_branch_keeps_reasoning_fields).ProfileDBgainedappend_messages_batch(main's bounded-chunk write path from perf(session): batch SQLite writes into single transaction per flush #23254).getAllSessionMessages(paged,include_compacted=true) instead of the PR's pre-fix(desktop): salvage compaction transcript-visibility cluster — surface archived turns + preserve running-session transcripts (#67871) #86595getSessionMessagessingle call, so the hydrated prefix includes compaction-archived rows and isn't capped at one page.selectBranchMessages' comparable-text helper inlines the@image:directive strip (the PR'stextWithoutImageRefsexport from its excluded commits doesn't exist on main).apps/desktop/.../use-session-actions/: whole-chat branch prefers the authoritative persisted transcript; branching from a clicked bubble maps it by durable row id first, same-role/text ordinal as fallback, and keeps the local prefix when unmappable; context-drift abort if the route/selection/runtime changes during hydration.Excluded from #76286 (per #86595's exclusion notes)
0bd0f57331+04f6c5e147— thehermes_state.pydisplay-projection filtering / legacy-replay disambiguation andtui_gateway/server.py+use-message-streamreconciliation. This is the second, competing display-dedupe scheme that fix(desktop): salvage compaction transcript-visibility cluster — surface archived turns + preserve running-session transcripts (#67871) #86595'sinclude_compacted+(role, content, timestamp, …)dedupe already covers; carrying both would ship two overlapping dedupe layers on the same read path.Validation
tests/test_tui_gateway_server.py+tests/test_hermes_state.pytest_search_projection_skips_context_enrichment_queries) reproduced identically on cleanorigin/mainuse-session-actions.test.tsx,use-session-actions/utils.test.tsnpx tsc --noEmit(apps/desktop)scripts/audit_pr_attribution.pyCredit: @DannyFengTianYu (#76286) — both commits cherry-picked with authorship preserved.
Infographic
Nous Research