Skip to content

fix(session-ui): fold timeline entries when they settle, not while they run - #63086

Open
Irsyadmr354 wants to merge 1 commit into
anomalyco:devfrom
Irsyadmr354:fix/timeline-live-entries
Open

Irsyadmr354 wants to merge 1 commit into
anomalyco:devfrom
Irsyadmr354:fix/timeline-live-entries

Conversation

@Irsyadmr354

@Irsyadmr354 Irsyadmr354 commented Nov 10, 2026 •

Copy link
Copy Markdown

We love AI and OpenCode, but we can't trust AI fully. So I fixed that issue for everyone.

Issue for this PR

Closes #63046

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

With the default Compact preset (Group on, Collapse on), Collapse applied to an entry for its whole lifetime. Thinking and shell output stayed hidden while the agent was still producing them, and an interrupted turn left its entry open forever, because an interrupted tool keeps its running status.

Collapse now only describes finished content:

  • a shell or execute tool that is streaming or running stays open while its turn is live, then folds back to the configured setting
  • a context group opens only while it holds a member worth watching, meaning a running shell/execute tool or streaming reasoning. A group of settled reads and searches stays closed even when it is the most recent one, and the group folds as soon as its live member settles
  • the streaming thinking row opens itself when it appears, and follows the Collapse setting once the reasoning settles into a finished part
  • an interrupted turn is no longer live, so its entries fold straight away
  • an explicit open or close still wins and persists for that entry

Files: packages/session-ui/src/timeline/session-timeline-row.tsx, packages/session-ui/src/tools/tool-renderer.tsx.

How did you verify your code works?

  • tsc -b clean for packages/session-ui and packages/app
  • bun test src in packages/session-ui: 562 pass, 0 fail
  • In the desktop app on Windows: thinking and shell output stay readable while they stream, each step folds when it finishes, and pressing stop mid-command folds the entry immediately

Screenshots / recordings

Desktop app on Windows, Compact preset, recorded on this commit (84s, no cuts):

timeline collapse demo

  • 0:08–0:24: a turn of three shell commands. While the turn runs, the entries sit under a single Used 3 Shell summary; once the work settles the answer reads cleanly underneath
  • 1:08–1:12: the previous turn is interrupted. Its entry folds to Used 1 Thought straight away under the Interrupted divider, instead of staying open
  • 1:10–1:17: the streaming thinking row is open, showing the live reasoning, while the turn is still running
  • 1:17–1:24: the turn settles and the reasoning folds into its summary line

The shell commands in this turn return in milliseconds, so their rows fold back as soon as they return; the same rule keeps a long-running command readable while it streams. In this recording one context group is also clicked open by hand, and it stays open because an explicit open wins.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Nov 10, 2026

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I reviewed the code but couldn't watch it run. The change is in the desktop/web timeline, and there are no browsers here for the component tests. bun test src in packages/session-ui passes (562/562) and tsc -b is clean. Before/after screenshots or a short video from the desktop app (Compact preset, one turn with thinking, a few reads and a shell command, then an interrupt) would help maintainers judge it.

The public API is unchanged. This is rendering logic inside session-ui only.

Note: #63046 was triaged as a feature request, because collapsed-while-streaming is the current intended design. This PR changes the default for everyone with no setting, so maintainers need to decide whether they want that.

The main concern is the context-group open change (inline). It goes beyond thinking and shell: every grouped context block now unfolds while it is the turn's last group. That includes groups of reads and searches, even after all their members have settled. Each group then snaps shut when the next part arrives, which also shifts the layout for anyone scrolled up reading.

Related: #41195, #58062

phase(row().userMessageID).live &&
input.projection.lastAssistantGroupKey().get(row().userMessageID) === row().group.key
}
open={input.disclosure.value(key()) ?? (phase(row().userMessageID).live && (live() || active()))}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This unfolds more than thinking and shell. Context groups also hold reads, searches, grouped commentary and other context tools. live() counts any running tool, and active() is true for the turn's last group even when every member has finished. So with Compact, every live context group expands and only folds when the next group or text part starts, not when its work settles, as the description says it should. Collapsing a tall group mid-turn also moves content under a reader who has scrolled up. Could this only open for members that are actually live (streaming reasoning, or running shell tools), and drop active() from open?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 6e5af73. open no longer uses active(), and live now counts only a running shell/execute tool or streaming reasoning, so groups of reads and searches never unfold. A group folds as soon as its live member settles, or when the turn is interrupted.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, I checked 6e5af73 and this is resolved. The group now opens only on live(). That means a running shell tool or streaming reasoning, and only while the turn is live. active() is only used for busy now, so groups of reads and searches stay closed and fold once their live member settles or the turn is interrupted. The streaming thinking row also no longer has the unused defaultOpen. Whether a streaming entry should open even with Collapse on (instead of the current collapsed row with a live heading) is a product call for maintainers on #63046.

}
// This row exists only while the model is still thinking, so it stays open until the
// reasoning settles into a finished part and then follows the Collapse setting.
open={input.disclosure.value(current().ref.partID) ?? true}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

With ?? true, open is always defined, so the defaultOpen just above it is never used, and thinking.details / reasoningMode no longer affect the streaming row. Before, a collapsed streaming row showed the live reasoning heading in its summary line (props.streaming && !open() in AssistantReasoningContent). That is now gone for everyone, including users who chose Collapse on purpose. If this is intended, the dead defaultOpen should go. If not, the open-while-streaming behaviour probably needs its own setting rather than overriding Collapse.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Opening the streaming row is intended, so the dead defaultOpen is gone (6e5af73). Collapse still takes over the moment the reasoning settles into a finished part, and a manual close on the streaming row still sticks and shows the live heading summary in the collapsed line.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, that matches the code at 6e5af73. A manual close stores false, so the row stays closed and AssistantReasoningContent shows the live heading while it streams. The finished part then follows Collapse. Nothing more is needed in this thread. Whether streaming entries should open by default is still for maintainers to decide on #63046.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Nov 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@Irsyadmr354
Irsyadmr354 force-pushed the fix/timeline-live-entries branch from 8b97d43 to 2019346 Compare November 10, 2026 10:49
…ey run

Collapse applied to an entry for its whole lifetime, so with the default
Compact preset (Group on, Collapse on) thinking and shell output stayed hidden
while the agent was still producing it. An interrupted turn was worse: the
interrupted tool keeps its `running` status, so its entry stayed open forever.

Collapse now describes finished content only:

- a shell/execute tool that is `streaming` or `running` stays open while its
  turn is live, then folds back to the configured setting
- a context group opens only while it holds a member worth watching, meaning a
  running shell/execute tool or streaming reasoning. A group of settled reads
  stays closed even when it is the most recent one, and the group folds as soon
  as its live member settles
- the streaming thinking row opens itself, and follows the Collapse setting once
  the reasoning settles
- an interrupted turn is not live, so its entries fold at once
- an explicit open or close still wins and persists for that entry
@Irsyadmr354
Irsyadmr354 force-pushed the fix/timeline-live-entries branch from 2019346 to 6e5af73 Compare November 10, 2026 10:51

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Both earlier points are fixed. A context group now opens only while it has a running shell or execute tool or streaming reasoning, so groups of reads and searches stay closed. The unused defaultOpen on the streaming thinking row is gone. Whether a streaming entry should ignore Collapse is still for maintainers to decide on #63046.

I read the code but couldn't watch it run: this is desktop/web timeline code and there are no browsers here. bun test src in packages/session-ui passes (562/562) and tsc -b is clean. The recording you mentioned (Compact preset with thinking, a few reads, a shell command, then an interrupt) would help maintainers check it.

The public API is unchanged.

@Irsyadmr354

Copy link
Copy Markdown
Author

A week in, so checking in once.

Confirmed against current dev: still MERGEABLE, both checks green, and the diff is unchanged (session-timeline-row.tsx, tool-renderer.tsx). Bot review is resolved on both threads.

The change only affects the Compact preset default: a live shell/execute and a streaming thought open while the turn runs, then follow Collapse once they settle. An explicit open or close still wins and persists.

If changing the default is too much, I'm glad to make this opt-in instead, either through the Timeline preset or a setting, so anyone who wants Collapse to mean "never expand" keeps that behavior. Tell me which shape you prefer and I'll adjust.

Context: I see the New timeline experiment has a related report (#64566, expanded thinking collapsing when the turn completes). This PR only touches the current timeline, so it doesn't overlap with that work.

This branch has not been deployed

No deployments
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.

desktop: thinking and shell entries stay collapsed while streaming with Group + Collapse enabled

1 participant