Skip to content

emrg: a tool-call group flips open and closed at every tool boundary, so the transcript jumps on every call #2355

Closed

Description

@how2how2how2-arch

Observed

On master (ccd950b4), a tool-call group's expansion state flips at every tool boundary, so the block's height oscillates between one line and N lines once per call.

emrg/gui/renderer/src/lib/transcript.ts, updateToolGroup:

  • line 272 — group.collapsed = !group.userExpanded; when the group holds two or more rows and none is running, i.e. every tool_end collapses the group;
  • line 277 — group.collapsed = false; in the else branch, and line 483 — handleToolStart sets g.collapsed = false; when appending to an existing group, i.e. every tool_start re-expands it.

With five calls the content swings between one line and five lines five times.

userExpanded does not prevent this: it only protects a group the host expanded by hand. A group nobody touched still collapses at every tool_end, and a group the host collapsed is re-expanded by the next tool_start (line 483) — the opposite of what the flag reads like.

The existing tests assert the flip as correct, which is why a green suite hides it: emrg/gui/renderer/src/lib/transcript.test.ts expects group.collapsed to be true after the third tool_end with no click in between, and components/TranscriptView.test.tsx asserts the collapsed class on the rendered group in the same situation.

Where observed: this repository, 2026-10-17.

Expected

A group's expansion state changes when the host clicks its bar, and at no other time.

  • The state is decided once, when the group is created. A new group starts expanded, because a running tool must stay visible.
  • Tool start, tool end and row appends update the bar's count and total time in place and never touch the expansion state — including the case where the group is currently collapsed.
  • The bar is one line: give it a fixed row height, so a label growing from "3 tools" to "12 tools" cannot reflow the block.
  • No automatic collapse at any point. A collapse when the turn ends would be acceptable as a deliberate single transition, but it is not added here: the strict reading of the rule is one transition per click.

A related half that is already correct

Auto-scroll during a turn is not part of this defect: TranscriptView.tsx:83 scrolls only when the viewport is within 40px of the bottom, so a host who scrolled up is not yanked back on every tool event. That half stays as it is.

Acceptance

Run a turn with five consecutive tool calls and sample a height proxy — the visible row count plus the bar — at every tool_start and tool_end. It must be monotonically non-decreasing; no boundary may shrink it. Clicking the bar once must be the only transition in the sequence, and after that click a further tool_start must leave the group collapsed.

Both tests that assert the old flip must be rewritten, not extended, so the rule is pinned by a test that fails on the previous behaviour.

Activity

  1. how2how2how2-arch commented on Oct 17, 2026

    @how2how2how2-arch
    CollaboratorAuthor

    Handled by #2356

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions