cmux NEXT: a finished steered turn folds each part's work below its steer

Merged
TE
15d ago
+276-74

Summary

Leo, on nightly 3a63d6d: "HOW DID YOUR THINKING LITERALLY GET REMOVED, THOSE TOOL CALLS?" When a steered turn ended, every tool call and thought seemed to vanish, and under his latest message only the reply showed.

Nothing was deleted; it was moved. Since #22691, shapeTurn put all of a finished turn's work into one "Worked for" fold under the turn's first prompt, above every steer. So the calls that ran after a steer jumped up above it when the turn ended. Leo's Claude turns are mostly steers (his live session: 24 prompts, 19 of them steers), so his latest bubble was left with only the answer under it. Codex turns without steers were not affected.

  • shapeTurn: splits a finished turn into parts: the prompt's, then one per steer. Each part folds its own work under its own Worked for Xs › (worked-<prompt id>, worked-<steer id>), timed from that prompt or steer to where the part ended (its reply, or the next steer). The steer bubble stays where it was. A reply a steer followed stays visible, as before. Only the last part carries the turn's status, so a Stop reads "You stopped after" on the part it stopped.
  • turnFoldFor (Find, a shell row's reveal, message links): opens the fold of the part the row ran in, which is the nearest prompt or drawn steer before it.
  • Shaped-turn cache: keys on every open fold in the turn, not only the prompt's.
  • steeredAnswers, and the steer clause in staysOut, are gone: a steer now opens its own part.
  • Gallery: transcript/steer-ended shows a finished steered turn, and its play opens the steer's fold.

Changelog

  • cmux NEXT: a finished turn you steered now folds each part's work under its own "Worked for" below your message, instead of moving every tool call above it.

Testing

  • transcript-steer-continuous.test.tsx:
    • "once the chain ends, each part folds its own work, the steer's below the steer" replaces the one-fold assertion. It checks the order (fold, reply, steer, fold, answer), the times (40s and 25s), and that the opened folds hold every tool call in the turn.
    • New: "a Claude turn steered twice keeps every call, each folded below the steer it ran after". This is Leo's turn shape. It checks the exact drawn ids closed and open, that one part opens alone, and turnFoldFor for every row.
    • The Find test and the older-page test now expect a fold for each part.

Observed / Not run

  • Observed: the PR's webview test lane runs these files. Focused fleet runs of the seven turn and fold test files are queued at the test-only commit ae1dace (expected red) and at the fix 304e2d2 (expected green); their results go in a PR comment.
  • Not run: no live app capture. The gallery entry transcript/steer-ended is the visual check, and the gallery advisory run renders it on Linux.

No capture: the change is how webview rows are ordered; the gallery advisory run captures transcript/steer-ended.

Agent session: cosmic-gray

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes finished steered turns so tool calls no longer appear to vanish below a steer: previously all work folded into one "Worked for" above every steer, so under Leo's latest message only the answer showed.

  • Each part (the prompt's, then one per steer) now folds its own work under its own fold, timed from that prompt or steer; only the last part carries the turn's status.
  • A steer's work stays below the steer, and a reply it followed stays visible as before.
  • turnFoldFor—Find, a shell row's reveal, and message links—opens the fold of the part a row ran in, walking past a prompt that failed to send mid-turn (which opens no fold, except the chat's first prompt, whose turn still opens); the shaped-turn cache keys on all open folds, not only the prompt's.
  • steeredAnswers and the steer clause in staysOut are removed.
  • Added a gallery entry transcript/steer-ended and tests, including a Claude turn steered twice.