Turn folding hides the substantive answer when a provider ends a turn with a short progress note (Grok)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 23k
- Forks
- 5.9k
- Avg merge
- 11h 14m
- Merged PRs (30d)
- 357
Description
Summary
deriveTurnFolds keeps exactly one entry visible per settled turn — the last assistant message, per deriveTerminalAssistantMessageIds. With providers that interleave short progress commentary with the actual answer, the last message of a turn is frequently a one-line "now I'll check X" note, so the real answer is folded away under Worked for Ns and the visible remainder is a fragment that reads like a non sequitur.
This is not the "collapse noisy tool calls" case the fold is designed for: the folded content is the response itself.
Environment
- Server
t3@0.0.33(headlesst3 serve, Linux x64, Bun runtime) - Desktop client
T3Code(Alpha)/0.0.33, Electron 41.5.0, macOS - Provider: Grok Build
1.0.4(ACP overgrok agent stdio), modelgrok-4.6
What happens
A Grok turn emits assistant messages as separate segments (assistant:…:segment:N) interleaved with tool calls. The turn commonly ends on a progress note rather than on the answer, e.g. turn a210c1f8:
| segment | time | length | content |
|---|---|---|---|
segment:5 |
10:07:34 | 3178 chars | the actual answer |
segment:6 |
10:10:12 | 146 chars | a progress note ("looks like a shared session — checking where live dev redirects to") |
segment:6 is the terminal message, so it stays visible; segment:5 is hidden behind Worked for ….
How common
One thread, 108 messages, 68 assistant messages across 36 turns. 19 turns had more than one assistant message; in 18 of those 19 the last message was not the longest. Terminal notes clustered at 77–146 chars while the answers they hid ran to 3178 chars.
Turn size distribution: 17 turns × 1 message, 14 × 2, 3 × 3, 1 × 5, 1 × 9.
Expected
The visible entry after folding should be the turn's substantive response. Folding should not be able to hide every assistant message that carries the answer.
Code
apps/web/src/components/chat/MessagesTimeline.logic.ts
deriveTerminalAssistantMessageIds—lastAssistantMessageIdByResponseKey.set(responseKey, message.id)on every assistant message, so the winner is positional: whichever message came last.deriveTurnFolds— everything in the group exceptterminalEntrygoes intohiddenEntryIds(onlyworkentries withagentSpawnare exempt).
apps/mobile/src/lib/threadActivity.ts appears to carry the same rule, so mobile is affected identically.
Possible directions
- Keep all assistant messages visible and fold only
workentries — the fold then does what its docstring says ("commentary and tool activity") without depending on which message happens to be last. - Treat a trailing assistant message that is immediately followed by tool activity as commentary rather than as the terminal message.
- Pick the terminal message by content rather than position.
Option 1 is the smallest change and does not need heuristics.
Notes
Reproduced against a live grok agent stdio session; the segmentation is the provider's normal output shape, not an error path.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with deriveTerminalAssistantMessageIds and deriveTurnFolds in apps/web/src/components/chat/MessagesTimeline.logic.ts, then compare the matching rule in apps/mobile/src/lib/threadActivity.ts. Reproduce a turn with multiple assistant segments and tool activity, and verify that folding no longer hides the substantive assistant response while still folding the intended work entries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100