Skip to content

fix: preserve imported session source metadata#1357

Closed
dso2ng wants to merge 1 commit intonesquena:masterfrom
dso2ng:fix/session-source-metadata
Closed

fix: preserve imported session source metadata#1357
dso2ng wants to merge 1 commit intonesquena:masterfrom
dso2ng:fix/session-source-metadata

Conversation

@dso2ng
Copy link
Copy Markdown
Contributor

@dso2ng dso2ng commented Apr 30, 2026

Thinking Path

  • Hermes WebUI sidebar sessions can include imported Hermes Agent / gateway sessions.
  • Those imported sessions need source metadata so the UI and server can distinguish them from native WebUI sessions.
  • Session.load_metadata_only().compact() was dropping those fields, so sidebar payloads lost that provenance.
  • This PR preserves the existing safe source fields in the session metadata path and adds a regression test.

What Changed

  • Store imported-session metadata (is_cli_session, source_tag, session_source, source_label) in the fast metadata section of session JSON.
  • Include the same fields in Session.compact() output.
  • Add a regression test covering save → metadata-only load → compact.

Why It Matters

Imported CLI / gateway sessions remain distinguishable in sidebar/API payloads, which prevents later session-list behavior from treating imported projections as ordinary WebUI sessions.

Verification

  • pytest tests/test_gateway_sync.py::test_imported_cli_session_metadata_survives_compact tests/test_gateway_sync.py::test_imported_cron_sessions_hidden_from_sidebar_by_default -q

Risks / Follow-ups

  • Low risk: this only persists/exposes already-used metadata fields and does not change message storage.
  • Follow-up PRs can build on this metadata for lineage grouping and cross-tab active-session synchronization.

Model Used

AI-assisted: OpenAI Codex GPT-5.5 via Hermes Agent tools.

@nesquena-hermes nesquena-hermes mentioned this pull request Apr 30, 2026
6 tasks
nesquena-hermes pushed a commit that referenced this pull request Apr 30, 2026
Session.load_metadata_only().compact() was dropping is_cli_session, source_tag, session_source, and source_label, so imported CLI/gateway sessions lost their provenance in sidebar/API payloads. Adds these to METADATA_FIELDS and Session.compact().

Co-authored-by: Dennis Soong <[email protected]>
nesquena-hermes added a commit that referenced this pull request Apr 30, 2026
Bundles 5 community PRs:
- #1355 feat(clarify): SSE long-connection (mirrors #1350 pattern, includes all correctness lessons)
- #1356 fix: context window indicator overflow (live SSE fallback) + uploading status clear
- #1357 fix: preserve imported session source metadata
- #1358 fix: collapse sidebar session lineage rows
- #1359 fix: sync active session across tabs

Tests: 3444 passing (3411 -> 3444, +33)
@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Shipped in v0.50.249 (merge d72399ae, tag https://github.com/nesquena/hermes-webui/releases/tag/v0.50.249) via batch release PR #1365.

Production verified live at port 8787, ?v=v0.50.249 cache-bust active.

Clean focused fix. Imported CLI/gateway sessions now keep their is_cli_session / source_tag / session_source / source_label fields through the load_metadata_only().compact() round-trip. Note from the review: three of the four fields aren't actively populated yet by webui code — they're plumbing for future PRs. That's fine, but worth flagging if you want to follow up with the population sites.

Thanks @dso2ng! 🙏

GeoffBao pushed a commit to GeoffBao/hermes-webui that referenced this pull request May 1, 2026
Session.load_metadata_only().compact() was dropping is_cli_session, source_tag, session_source, and source_label, so imported CLI/gateway sessions lost their provenance in sidebar/API payloads. Adds these to METADATA_FIELDS and Session.compact().

Co-authored-by: Dennis Soong <[email protected]>
GeoffBao pushed a commit to GeoffBao/hermes-webui that referenced this pull request May 1, 2026
Bundles 5 community PRs:
- nesquena#1355 feat(clarify): SSE long-connection (mirrors nesquena#1350 pattern, includes all correctness lessons)
- nesquena#1356 fix: context window indicator overflow (live SSE fallback) + uploading status clear
- nesquena#1357 fix: preserve imported session source metadata
- nesquena#1358 fix: collapse sidebar session lineage rows
- nesquena#1359 fix: sync active session across tabs

Tests: 3444 passing (3411 -> 3444, +33)
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