Skip to content

fix(desktop): scope thinking disclosure pending state#43197

Merged
OutThisLife merged 1 commit into
NousResearch:mainfrom
helix4u:fix/desktop-thinking-disclosure-scope
Jun 10, 2026
Merged

fix(desktop): scope thinking disclosure pending state#43197
OutThisLife merged 1 commit into
NousResearch:mainfrom
helix4u:fix/desktop-thinking-disclosure-scope

Conversation

@helix4u

@helix4u helix4u commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes Desktop thinking disclosure auto-open state so each reasoning disclosure only checks its own reasoning group for pending content.

Before this change, ReasoningAccordionGroup scanned from the current group start through the rest of the assistant message. If a later thinking block was still running, older completed thinking blocks in the same message could be treated as pending and reopen automatically.

This bounds the pending check to startIndex..endIndex, matching the existing content check and the actual reasoning group rendered by that disclosure.

Related Issue

Discord support thread: https://discord.com/channels/1053877538025386074/1514062044263874704

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • apps/desktop/src/components/assistant-ui/thread.tsx: bound pending detection for ReasoningAccordionGroup to the current reasoning group.
  • apps/desktop/src/components/assistant-ui/streaming.test.tsx: added a regression covering separated reasoning groups where the earlier completed group stays collapsed while a later group is running.

How to Test

  1. Run npm run test:ui --workspace apps/desktop -- src/components/assistant-ui/streaming.test.tsx -t "does not reopen an earlier completed thinking group".
  2. Confirm the regression passes: first disclosure aria-expanded=false, second disclosure aria-expanded=true.
  3. Optional manual check: stream an assistant message with multiple non-consecutive thinking blocks in Desktop and confirm older completed thinking blocks do not reopen when a later thinking block is added.

Focused validation run locally:

  • npm run test:ui --workspace apps/desktop -- src/components/assistant-ui/streaming.test.tsx -t "does not reopen an earlier completed thinking group"

Note: the full streaming.test.tsx file currently has an unrelated existing failure in renders an incomplete streaming reasoning fenced code block as a code card, which also fails when run by itself in this checkout.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: WSL/Linux running Desktop Vitest target

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

N/A

Screenshots / Logs

User report shows Desktop Client v0.16.0 (+21) and Backend v0.16.0 (+21) with prior thinking blocks expanded again after a later thinking block appears.

@liuhao1024

Copy link
Copy Markdown
Contributor

Verification: clean — correct scoping fix

This PR correctly scopes the pending-running check in ReasoningAccordionGroup to the group's own slice of message parts (startIndex..endIndex) instead of scanning all parts from startIndex onwards. This prevents an earlier completed thinking group from being reopened when a later group is still running.

  • Slice bounds are correct: slice(Math.max(0, startIndex), endIndex + 1) — the +1 accounts for slice exclusivity, matching the group's actual range.
  • Test covers the exact bug: assistantSeparatedReasoningMessage() creates two reasoning groups (complete + running) separated by a text block, verifying the first group stays collapsed.
  • No regression risk: The change only narrows the slice range; if a group has no running parts in its range, it correctly stays collapsed.

LGTM — no issues found.

@helix4u helix4u marked this pull request as ready for review June 10, 2026 01:08
@OutThisLife OutThisLife merged commit 258d240 into NousResearch:main Jun 10, 2026
20 checks passed
wachoo pushed a commit to wachoo/hermes-agent that referenced this pull request Jun 10, 2026
changman pushed a commit to changman/hermes-agent that referenced this pull request Jun 10, 2026
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.

3 participants