Skip to content

feat: load full lineage segments on demand - #2130

Merged
1 commit merged into
nesquena:masterfrom
dso2ng:feat/sidebar-lineage-report-expansion
May 12, 2026
Merged

1 commit merged into
nesquena:masterfrom
dso2ng:feat/sidebar-lineage-report-expansion

Conversation

@dso2ng

@dso2ng dso2ng commented May 12, 2026

Copy link
Copy Markdown
Contributor

Thinking Path

What Changed

  • Added a small per-sidebar-cache lineage-report cache/inflight map in static/sessions.js.
  • Invalidates that cache on each fresh /api/sessions refresh.
  • On segment-badge expand, fetches GET /api/session/lineage/report?session_id=<tip> only when _sessionSegmentCount(s) exceeds the locally materialized _lineage_segments count.
  • Merges returned report segments by session_id with existing client-materialized segments, skipping the visible tip and any child_session rows.
  • Leaves report children out of the compression-segment list so subagent/fork child semantics remain separate.
  • Added regression coverage for fetch-needed detection, report-segment merging/deduplication, endpoint construction, and in-flight/cache de-duping.

Visual / Interaction Evidence

lazy lineage report expansion visual evidence

Expected network behavior:

  • Initial sidebar refresh still uses the existing /api/sessions path and does not call /api/session/lineage/report.
  • First expansion of a backend-count-only lineage badge makes exactly one bounded lineage-report request.
  • The result is cached until the next /api/sessions refresh.

Why It Matters

This completes the read-only lineage ladder without adding prefetch, polling, archive/delete controls, storage migration, or a broader session-management surface. Users can inspect old compression segments when the sidebar only has a count, while the common sidebar polling path remains unchanged.

Verification

  • RED first:
    • python -m pytest tests/test_session_lineage_collapse.py::test_lineage_segment_expansion_static_contract tests/test_session_lineage_collapse.py::test_lineage_report_fetch_is_needed_only_when_backend_count_exceeds_materialized_segments tests/test_session_lineage_collapse.py::test_cached_lineage_report_segments_merge_with_materialized_segments_without_duplicates_or_children -q -o addopts= -> failed with missing cache/helpers/report endpoint wiring.
  • GREEN / targeted:
    • python -m pytest tests/test_session_lineage_collapse.py tests/test_session_lineage_report.py tests/test_session_lineage_metadata_api.py -q -o addopts= -> 29 passed
    • python -m py_compile api/agent_sessions.py api/routes.py api/models.py
    • node --check static/sessions.js
    • git diff --check
    • non-ASCII diff guard -> non_ascii_added_lines=0
  • Asset check:
    • raw PNG URL returns HTTP 200 with content-type: image/png.

Risks / Follow-ups

Model Used

Prepared with assistance from Hermes Agent using OpenAI Codex gpt-5.5.

@nesquena-hermes nesquena-hermes closed this pull request by merging all changes into nesquena:master in 6297443 May 12, 2026
pull Bot pushed a commit to TKaxv-7S/hermes-webui that referenced this pull request May 12, 2026
feat: load full lineage segments on demand
SysAdminDoc pushed a commit to SysAdminDoc/hermes-webui that referenced this pull request Jun 26, 2026
feat: load full lineage segments on demand
bernyforce pushed a commit to bernyforce/hermes-webui that referenced this pull request Jul 29, 2026
feat: load full lineage segments on demand
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.

2 participants