Skip to content

fix(tool-card): collapse sub-agent tree with parent chevron#3140

Merged
esengine merged 1 commit into
esengine:main-v2from
HUQIANTAO:fix/desktop-explore-collapse-and-streaming-markdown
Jun 8, 2026
Merged

fix(tool-card): collapse sub-agent tree with parent chevron#3140
esengine merged 1 commit into
esengine:main-v2from
HUQIANTAO:fix/desktop-explore-collapse-and-streaming-markdown

Conversation

@HUQIANTAO

@HUQIANTAO HUQIANTAO commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

The parent task tool card's chevron only toggled args/output visibility; nested sub-agent calls (read_file / grep / ls from an /explore run) always rendered underneath. A 50-step /explore flooded the transcript with its full step list, with no way to fold it back.

This is the ToolCard half of the original #3140. The streaming-markdown half has been merged via #3444.

Fix

The open state now also controls nested items. A single chevron click collapses or expands the whole subagent tree:

  • Open by default while the sub-agent is still running so the user can watch progress.
  • Closed by default once it settles, so a finished explore folds to a single summary line ("12 steps") on first paint.
  • Individual sub-calls can still be expanded/collapsed independently via their own ProcessCard chevrons.

Diff

-  const [open, setOpen] = useState(item.isShell && hasArgsOrOutput);
+  const [open, setOpen] = useState(() => {
+    if (item.isShell) return hasArgsOrOutput;
+    if (hasNested) return item.status === "running";
+    return false;
+  });

Scope

Verification

  • pnpm typecheck ✅ clean
  • vite build ✅ built in 28.58s
  • Running sub-agent: nested items visible, chevron works
  • Completed sub-agent: nested items hidden, chevron expands
  • Shell commands: unchanged behavior (auto-open when has output)
  • Regular tools: unchanged behavior (args/output folded by default)

@HUQIANTAO HUQIANTAO requested a review from SivanCola as a code owner June 4, 2026 16:29
@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 4, 2026
HUQIANTAO added a commit to HUQIANTAO/DeepSeek-Reasonix that referenced this pull request Jun 7, 2026
During streaming, assistant messages rendered raw text instead of
formatted markdown.  Users saw literal table pipes, bold markers,
and code spans until the turn completed, at which point everything
snapped into formatted markdown in one jump.

Now Markdown runs on every token.  The component already uses
useDeferredValue internally, so the cursor and scroll update at
high priority while the expensive markdown parse catches up in
idle frames - no layout jitter, no visual jump on completion.

This is a focused re-do of esengine#3140, scoped to Message.tsx only.
The ToolCard collapse and Go backend changes from the original PR
are split into separate PRs.
@HUQIANTAO HUQIANTAO force-pushed the fix/desktop-explore-collapse-and-streaming-markdown branch from 3096fd8 to 1ed1540 Compare June 7, 2026 11:28
@HUQIANTAO HUQIANTAO requested a review from esengine as a code owner June 7, 2026 11:28
@github-actions github-actions Bot added the desktop Wails desktop app (desktop/**) label Jun 7, 2026
@HUQIANTAO HUQIANTAO changed the title fix(desktop): collapse sub-agent trees and stream markdown in real time fix(message): render markdown while streaming assistant output Jun 7, 2026
@HUQIANTAO

Copy link
Copy Markdown
Contributor Author

Update: This PR has been rebased on the latest main-v2 (7fba4ab) and scoped down to just Message.tsx (+7/−11). The ToolCard collapse and Go backend changes from the original PR are now in separate branches.

What changed vs the original #3140

Original This update
Files changed 8 (Message.tsx + ToolCard.tsx + 6 Go files) 1 (Message.tsx only)
Diff size +25/−16 +7/−11
Base old main-v2 (c5f8016) latest main-v2 (7fba4ab)
ProcessCard/TurnActions ❌ not compatible ✅ works with new structure

Cursor placement

The cursor renders as a sibling after <Markdown>. This matches the standard streaming UI pattern used by ChatGPT, Claude, and Cursor. The aria-hidden="true" attribute ensures screen readers don't announce the blinking cursor.

Relationship to #3337

This PR achieves the same goal as #3337 but is rebased on the current main-v2 (which has ProcessCard/TurnActions#3337 targets the old Message.tsx structure and would need a full rewrite to merge). #3337 can be closed if this PR is merged.

@esengine

esengine commented Jun 7, 2026

Copy link
Copy Markdown
Owner

#3444 ("render markdown in real time during streaming") just merged and overlaps heavily with this PR — they conflict now. If #3444 already covers the streaming-markdown part, feel free to close this; otherwise please rebase onto latest main-v2 and resolve (keeping only the sub-agent-tree-collapse delta that #3444 doesn't have). Thanks!

The parent task tool card chevron only toggled args/output visibility;
nested sub-agent calls (read_file / grep / ls from an /explore run)
always rendered underneath.  A 50-step /explore flooded the transcript
with its full step list, with no way to fold it back.

Now the open state also controls nested items.  A single chevron click
collapses or expands the whole subagent tree.  Behavior:
- Open by default while the sub-agent is still "running" so the user
  can watch progress.
- Closed by default once it settles, so a finished explore folds to
  a single summary line ("12 steps") on first paint.
- Individual sub-calls can still be expanded/collapsed independently.

This is the ToolCard half of the original esengine#3140.  The streaming-markdown
half has been merged via esengine#3444.
@HUQIANTAO HUQIANTAO force-pushed the fix/desktop-explore-collapse-and-streaming-markdown branch from 1ed1540 to a194f80 Compare June 7, 2026 12:02
@HUQIANTAO HUQIANTAO changed the title fix(message): render markdown while streaming assistant output fix(tool-card): collapse sub-agent tree with parent chevron Jun 7, 2026
@HUQIANTAO

Copy link
Copy Markdown
Contributor Author

@esengine Done. #3140 is now scoped to only the ToolCard collapse (+10/−3 in ToolCard.tsx). The streaming-markdown part is covered by the merged #3444.

Changes: the open state now controls nested sub-agent items too. Running sub-agents default to open (watch progress); completed ones default to closed (fold to summary line). Shell commands and regular tools are unaffected.

@SuMuxi66

SuMuxi66 commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

哥们你是做了我的markdown渲染的问题是吗?

@esengine esengine left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Nested sub-agent calls now fold under the parent chevron (open while running, collapsed once settled). Good fix for /explore flooding the transcript.

@esengine esengine merged commit afb1466 into esengine:main-v2 Jun 8, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants