fix(sessions): keep the lineage project id when the root is the freshest segment

compression_tip() resolves a project assignment across the whole lineage, so it
can find one recorded on a newer EMPTY continuation. When the root is still the
freshest *importable* segment, the `tip is row` early return appended the root
without applying that resolved id and the assignment was silently dropped.

Copy the root and apply lineage_project_id before appending, matching what the
merged-tip path below already does.
This commit is contained in:
Rodrigo Gomes da Silva committed 2026-09-24 11:03:46 -03:00
1 parent 9d7374fa25
commit 9a4e4336ad
1 file changed
+8 -1
+8 -1
View File
@@ -614,7 +614,14 @@ def _project_agent_session_rows(rows: list[dict]) -> list[dict]:
continue
if tip is row:
projected.append(dict(row))
# The root can still be the freshest *importable* segment while a
# newer EMPTY continuation carries the project assignment. Applying
# the resolved lineage id here too keeps that assignment instead of
# silently dropping it on the early-return path (#6659).
root_only = dict(row)
if lineage_project_id:
root_only['project_id'] = lineage_project_id
projected.append(root_only)
continue
merged = dict(row)