fix: keep explicit forks out of lineage report - #2063
Conversation
SummaryReading the diff at PR #2063 against Code referenceThe new guard at def _is_continuation_session(parent: dict | None, child: dict | None) -> bool:
if not parent or not child:
return False
if str(child.get('session_source') or '').strip().lower() == 'fork':
return False
parent_source = str(parent.get('source') or '').strip().lower()
...And the two report SELECTs at DiagnosisThe contract is right. The test at One thing worth flagging (non-blocking)The same In practice that doesn't surface to the user because the #2014 frontend guard ( Verification
LGTM from a contract standpoint. The fork lineage rule now lives in three places ( |
|
Thanks for the detailed pass — I agree the non-blocking backend symmetry point is worth fixing in this PR while the scope is still small. I pushed
Updated local verification:
This should remove the backend divergence you flagged while keeping the original bridge PR narrow. |
fix: keep explicit forks out of lineage report by @dso2ng
6b17051
fix: keep explicit forks out of lineage report by @dso2ng
fix: keep explicit forks out of lineage report by @dso2ng
Summary
read_session_lineage_report()continuation chains.session_sourcein the lineage report query so the existing continuation helper can see fork metadata.Why
PR #2014 taught the sidebar collapse logic that
session_source="fork"is an explicit branch, not a compression continuation. PR #2012 added the backend read-only lineage report used by future lazy UI expansion. This small bridge patch keeps the backend report contract aligned with the sidebar rule before the UI starts depending on the endpoint for full segment expansion.Without this guard, an explicit fork from a compression-ended parent can be reported as the tip of the parent's hidden compression lineage (
total_segments=2) instead of its own independent session.Test Plan
python -m pytest tests/test_session_lineage_report.py::test_lineage_report_keeps_explicit_forks_out_of_hidden_segments -q -o addopts=failed withlineage_key == "lineage_report_root".python -m pytest tests/test_session_lineage_report.py::test_lineage_report_keeps_explicit_forks_out_of_hidden_segments -q -o addopts=python -m pytest tests/test_session_lineage_report.py tests/test_session_lineage_metadata_api.py tests/test_session_lineage_collapse.py tests/test_465_session_branching.py -q -o addopts=python -m py_compile api/agent_sessions.py api/routes.pygit diff --checknon_ascii_added_lines=0AI disclosure
Prepared with assistance from Hermes Agent.