Skip to content

fix(desktop): keep interim assistant narration on message.complete#61997

Closed
giggling-ginger wants to merge 3 commits into
NousResearch:mainfrom
giggling-ginger:fix/61822-preserve-interim-assistant-messages
Closed

fix(desktop): keep interim assistant narration on message.complete#61997
giggling-ginger wants to merge 3 commits into
NousResearch:mainfrom
giggling-ginger:fix/61822-preserve-interim-assistant-messages

Conversation

@giggling-ginger

Copy link
Copy Markdown
Contributor

What does this PR do?

On Desktop, a multi-step turn (text → tool → text → tool → …) streams mid-turn
narration live, then collapses to only the final message the instant
message.complete lands. Tool activity and intermediate assistant text flash
for a split second and then disappear — exactly the symptom reported in #61822.

Root cause: completeAssistantMessage used an unconditional replaceTextPart
that dropped every text part and re-appended only
message.complete.text (the agent's last assistant segment). Desktop's
live-completion path was the sole outlier: messaging gateway, Ink TUI, and
Desktop's own reload path already keep interim text.

This wires Desktop to honor the existing display.interim_assistant_messages
setting (default true) and merges final text without discarding earlier
narration.

Related Issue

Fixes #61822. Also Fixes #54905 and #61297 (same Desktop root cause).

Salvaged from concurrent PR #61447 by @lucasfdale (authorship preserved via
cherry-pick). Closed auto-PR #61866 was empty/broken and not used.

Type of Change

  • 🐛 Bug fix

Changes Made

  • apps/desktop/src/lib/chat-messages.ts — pure mergeFinalAssistantText(parts, finalText, keepInterim)
  • apps/desktop/src/app/session/hooks/use-message-stream/index.ts — use merge + config atom instead of drop-all-text
  • apps/desktop/src/store/session.ts$keepInterimAssistantMessages atom (default true)
  • apps/desktop/src/app/session/hooks/use-hermes-config.ts — set atom from config.display.interim_assistant_messages
  • Tests: unit + integration (37 passing)
  • Comment-only clarifications in cli-config.yaml.example + hermes_cli/config.py

How to Test

  1. Desktop: multi-step prompt that narrates between tools
  2. Before: bubble collapses to final line only
  3. After (default): interim narration + tools + final answer remain
  4. display.interim_assistant_messages: false restores lean collapse
  5. Automated:
    cd apps/desktop && ../../node_modules/.bin/vitest run --config vite.config.ts --environment jsdom \
      src/lib/chat-messages.test.ts \
      src/app/session/hooks/use-message-stream/interim-narration.test.tsx
    (37 passed)

Checklist

lucasfdale and others added 2 commits July 10, 2026 09:59
…ing mid-turn narration

Desktop collapsed a multi-step turn to only the final message on
message.complete, dropping every interim assistant text segment streamed
between tool calls. The text is persisted and reappears on reload, and every
other surface (messaging gateway, Ink TUI, Desktop's own reload path) keeps it
— Desktop's live-completion path was the sole outlier and never consulted the
existing display.interim_assistant_messages setting.

Wire the setting through to completion (default true) and extract the merge
into a pure, tested mergeFinalAssistantText() that keeps interim narration and
upgrades the trailing segment in place, matching the TUI/reload contract.

Also clarify the interim_assistant_messages comments in config.py and
cli-config.yaml.example (comment-only; no default change).

Salvaged from NousResearch#61447 (lucasfdale).

Fixes NousResearch#61822. Fixes NousResearch#54905. Fixes NousResearch#61297.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) labels Jul 10, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: salvage of concurrent OPEN PR #61447 (@lucasfdale, authorship preserved via cherry-pick — same completeAssistantMessage drop-all-text root cause; salvage, not duplicate). Adjacent interim-narration cluster: #59831 / #60453 (Codex commentary as interim prose) and #53350 / #53369 (Desktop completion reconcile). Maintainer to pick between this and #61447.

Keep lucasfdale entry alongside newly added upstream AUTHOR_MAP rows.
@giggling-ginger

Copy link
Copy Markdown
Contributor Author

Closing in favor of the original fix PR #61447.

#61997 was only a salvage cherry-pick of @lucasfdale's work onto current main to attach #61822. No independent code changes beyond AUTHOR_MAP. Prefer merging #61447 directly and linking the issue there rather than duplicating the PR surface.

See review note on #61447.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

3 participants