cmux NEXT: scope session sources and parser revisions

Merged
TE
7d ago
+1978-94

Behavior

Completed PR mutations enter session Changes; read-only PRs, issues, fetched URLs, files and named searches become Sources. The UI half is #25208. Leo's words were: “where are the sources part of the stuff?” and “there's a show more button, show less”.

Conditional and shell-wrapped gh commands now retain their execution structure. For example, if true; then gh pr merge 41 -R acme/app --squash; fi records the merge, while skipped literal branches, comments, quoted payloads and help commands do not. Sources and Changes share the same bounded shell walker. Unknown external command statuses stay unknown; the parser never executes transcript text.

A new assistant message ID settles the preceding reply, so a PR link in msg-1 survives a steer into msg-2 and turn completion. Parent and child transcript revisions invalidate summaries when replies settle, completed tools change, children rename or nested children finish. Streaming chunks reuse summary revisions. Outputs are scoped only when a cwd is supplied; unscoped callers retain their prior behavior.

Git push/revert attribution remains a follow-up: this PR does not infer PR mutations from branch observations or git commands.

Verification

  • Shell regression discriminator reproduces the conditional-command failure before repair. Main-client discriminator reproduces the exact msg-1 / msg-2 / completion Source loss before settlement, then passes after repair.
  • Command substitution regression reproduces and fixes the nonadvancing shell cursor. Loop and resumed-child discriminator fails before repair, then passes 165 focused tests and full web checks.
  • Quoted-loop verification and late-child-chunk verification pass five focused test files and the full web check. The latter covers a PR URL completed across a child turn-complete boundary.
  • Final casing verification passes five focused test files and the full web check, including case-insensitive lifecycle settlement, mutation exclusion from Sources and read-only deduplication. The verified source plus emitted formatter patch is committed at 6d0aa9f966b9c4d7bd742e62d5d261334c972a78.
  • Command: cmux-ci test --setup webviews --timeout 900 -- bash -lc 'set -eu; cd webviews; bun run test test/transcript-pull-requests.test.ts src/agent-session/acpmux/subagents/subagentFold.test.ts test/agent-pane-background-on-call.test.ts test/sources-files-once.test.tsx test/pr-dock-stale-state.test.tsx; bun run check'.

Observed / Not run

Focused regression suites, formatting, lint, type and protocol checks ran remotely. No native code changed; no new native compile was requested. Existing UI captures are on #25208. Head/base static comparison reproduces identical SwiftUI-import guard failures in the unchanged HomeChatColorsPanel.swift and HomeChatColorsView.swift at base 3d89c41ab4578e9a10ee4533a6dcd2509861355f.

Independent Astra review: SHIP at 6d0aa9f966b9c4d7bd742e62d5d261334c972a78; no actionable correctness findings. Exact-head CI completed with 97 passing checks and only the reproduced base SwiftUI-import finding above.

Scope and risk

Size: approximately 2,000 changed lines. This already-split data-contract PR keeps the reviewed producer settlement, shared parser and cache fixes together with their regressions; separating those tests from their dependent fixes would leave failing intermediate PRs. The UI remains in #25208. The main risk is transcript evidence classification; shell parsing is bounded and conservative, and the regression matrix covers supported forms. No timer, observer or animation loop is introduced. Existing UI captures are on #25208.

Agent session: agent session