Skip to content

Fix Desktop compression session lineage - #41678

Open
joshuadow wants to merge 2 commits into
NousResearch:mainfrom
joshuadow:fix/desktop-compression-session-lineage
Open

Fix Desktop compression session lineage#41678
joshuadow wants to merge 2 commits into
NousResearch:mainfrom
joshuadow:fix/desktop-compression-session-lineage

Conversation

@joshuadow

@joshuadow joshuadow commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • persist explicit compression-continuation metadata and expose full lineage ids for Desktop pin resolution

  • project compressed conversations through the selected live tip while preserving workspace cwd fallback so new compacted sessions do not fall into "No workspace"

  • recover Desktop prompt submits once when a stale runtime session id returns 4001 session not found

  • add JSON-RPC/WebSocket diagnostics that avoid request params/payload/result/error bodies

  • surface the Desktop recovery overlay after repeated post-boot gateway reconnect failures so transport drops do not require a full restart

Validation

  • npm run test:ui --workspace=apps/desktop -- --run src/app/gateway/hooks/use-gateway-boot.test.tsx src/hermes-gateway-client-diagnostics.test.ts — 2 files passed, 7 tests passed
  • python -m pytest tests/test_hermes_state.py -q — 270 passed
  • python -m pytest tests/tui_gateway/test_protocol.py -q — 59 passed, 8 warnings from discord audioop deprecation
  • python -m pytest tests/tui_gateway/test_ws_diagnostics.py -q — 5 passed
  • npm --workspace apps/desktop run type-check
  • npm --workspace apps/desktop run test:ui -- src/store/session.test.ts src/app/session/hooks/use-prompt-actions.test.tsx src/hermes-gateway-client-diagnostics.test.ts — 31 passed
  • npm --workspace apps/desktop exec eslint -- src/app/session/hooks/use-prompt-actions.test.tsx src/hermes-gateway-client-diagnostics.test.ts src/app/session/hooks/use-prompt-actions.ts src/store/session.ts src/store/session.test.ts src/app/chat/index.tsx src/app/chat/sidebar/index.tsx src/app/desktop-controller.tsx src/types/hermes.ts

Notes

  • Full Desktop lint still has pre-existing unrelated errors in other files; changed Desktop files lint clean with the targeted eslint command above.

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Well-scoped fix for desktop compression session lineage. Adds explicit lineage tracking in agent/conversation_compression.py, ensures store/session.ts preserves the correct session ancestry path through desktop reconnections, and updates JSON-RPC gateway diagnostics to reflect resolved lineage rather than ambiguous state. Test coverage is adequate (session store + gateway protocol + ws diagnostics) and changelog is clean.

Looks Good

  • Lineage resolution is applied before any state mutation, preventing leak drift.
  • TUI gateway now reports resolved_session_id via diagnostics endpoint.

Reviewed by Hermes Agent

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/gateway Gateway runner, session dispatch, delivery comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Jun 8, 2026
@alt-glitch alt-glitch added comp/desktop Electron desktop app (apps/desktop/*) sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Jun 26, 2026
@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 14, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the broad lineage and recovery investigation. Current main already contains the core stale-runtime recovery and compression-tip resume behavior, but two pieces still warrant selective salvage.

Problems

  • The prompt-submit recovery overlaps the current refactored implementation in apps/desktop/src/app/session/hooks/use-prompt-actions/submit.ts:337-371; applying the old use-prompt-actions.ts change would duplicate a now-more-complete path.
  • Reconnect escalation is already present in apps/desktop/src/app/gateway/hooks/use-gateway-boot.ts:185-191, and resume now follows compression tips in tui_gateway/server.py:5603-5621.

Suggested changes

Automated hermes-sweeper review.

@teknium1 teknium1 added area/sessions Session lifecycle, resume, persistence, history area/compression Context compression and continuation sessions labels Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/compression Context compression and continuation sessions area/sessions Session lifecycle, resume, persistence, history comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/desktop Electron desktop app (apps/desktop/*) comp/gateway Gateway runner, session dispatch, delivery comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants