Skip to content

fix(chat): avoid dirty placement IDs for equal height reports - #33662

Merged
cmux-bot[bot] merged 3 commits into
feat-cmux-nextfrom
lane/transcript-drawn-noop
Nov 3, 2026
Merged

cmux-bot[bot] merged 3 commits into
feat-cmux-nextfrom
lane/transcript-drawn-noop

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Equal DOM height confirmations currently mark rows dirty even when the state updater keeps their existing measurement. This makes later placement consider unchanged rows. Mark only entries that differ from the state React applies the updater to.

Keep scheduling equal corrective reports: a lower-priority height of 200 can still be queued while the rendered height is 100. Dropping a new report of 100 against the rendered value loses that correction. The regression reproduces this with React's real priority queues; enabling the naive guard makes the final height incorrectly become 200. Row pruning and Minimal Mode also write this state, so this change deliberately leaves scheduling intact.

Leo: “i also think we've done a lot of great work wrt perf and loading but i don't think we've pushed to the limit yet. things should be instant and not shift layouts AND not take many resources”.

The change stays inside flushDrawn's equality/dirty-marking lines. #33624 (80865735, mounted measurement batching) and #33629 (9e3e8347, first motion) were inspected: neither edits that body, so this is based independently on 5dee1ab988e. No new loop, observer, timer or cache. Settled transcript geometry and design/chat-transcript.md remain unchanged. The overbroad dirty marking originated in #19648.

Performance

Same production-callback React harness, 120 equal-height confirmation ticks. These are bookkeeping counts, not browser CPU or frame-time measurements.

Metric Before After Delta Harness or run link
Dirty IDs accumulated across 120 confirmation ticks 120 0 -120 webviews/test/drawn-height-priority.test.tsx
setDrawn calls per confirmation tick 1 1 0 same harness
Extra renders per confirmation tick 0 0 0 same harness

The idle CPU increase tracked by #33368 remains unresolved; this PR makes no claim about it.

Validation: focused single-file unit test: 3 passed, 9 assertions. Base: equal/mixed dirty-ID cases fail. Naive rendered-value guard: priority regression fails (200 instead of 100). Fleet replay, compile check and the finished webview verdict will be recorded before landing. Risk: changed IDs must survive React's updater rebasing; correction scheduling is preserved and tested.

🤖 Generated with Codex

Agent session: agent session


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


Summary by cubic

Fixes equal-height transcript confirmations marking rows dirty, so placement no longer reprocesses unchanged rows (120 dirty IDs per run drop to 0).

The equality check now runs inside React's state updater against the rebased state rather than the last committed measurement, so an equal report can still supersede a lower-priority height queued in another lane; scheduling is deliberately preserved.

Adds a test harness that compiles the production flushDrawn callback through node vm, covering idle equal confirmations, mixed batches, and the lower-priority correction regression.

Performance

Same production-callback React harness, 120 equal-height confirmation ticks. These are bookkeeping counts, not browser CPU or frame-time measurements.

Metric Before After Delta
Dirty IDs accumulated across 120 ticks 120 0 -120
setDrawn calls per tick 1 1 0
Extra renders per tick 0 0 0

Validation: focused single-file unit test, 3 passed and 9 assertions.

Written for commit 62e8a7a. Summary will update on new commits.

View guided diff Turn on auto-fix

Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-d43daca7ac1e4cde2f3d
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 62e8a7a: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr33662 -f ref=lane/transcript-drawn-noop -f platform=macos -f backend_mode=local

red: cmux-next checks (god files, concurrency, crash safety, l10n); NEW: green on the base 280f8ab; do not merge until green; see lane-rules

Shipped in:

@teamleaderleo teamleaderleo left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review (claude opus-5.5 medium): SHIP at 4ce856a

Visual verdict: unchanged by this diff.

Checked flushDrawn, the other setDrawn writers and the measured consumer. setDrawn still runs on every flush, so a lower-priority height that is still queued can still be corrected by an equal one. The id is now added inside the updater, against the state React rebases onto. Adding to the set is safe to repeat, the Minimal Mode writer already does the same, and measured reads the set after the updaters run in the same render, so no changed row is missed. The new test runs the production callback under React's real priority queues, and the naive guard mutation turns it red.

Follow-ups:

  • [follow-up] The test cuts the callback out of App.tsx on comment and declaration text (/// RowFrame redraws, const observer = useMemo(), which breaks if either is reworded. An exported pure updater would be sturdier.

Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-d43daca7ac1e4cde2f3d

@teamleaderleo teamleaderleo left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review (claude opus-5.5 medium): SHIP at d879536

Visual verdict: unchanged by this diff.

Carried from the SHIP at 4ce856a. The delta to this head is formatting only (drawn-height-priority.test.tsx, +5/-17, wrapped lines joined). The cut markers and the expected values are unchanged, and App.tsx is untouched.

Follow-ups:

  • [follow-up] The test cuts the callback out of App.tsx by matching source text (#33667).

@blacksmith-sh

blacksmith-sh Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Found 7 test failures on Blacksmith runners:

Failures

Test View Logs
/tmp/tmp_ttj5u9x/summary-fail.json (live):/summary-fail.json (live): View Logs
/tmp/tmpek_kc7p3/summary-missing.json (live):/summary-missing.json (live): View Logs
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows/
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows
View Logs
[new_workspaces] the window draws no frames/[new_workspaces] the window draws no frames View Logs
[tabs] debug.tab_switch timed 0 of 40 switches/
[tabs] debug.tab_switch timed 0 of 40 switches
View Logs
[tabs] the window draws no frames/[tabs] the window draws no frames View Logs
test_every_compile_job_names_its_warm_sources (main.ThisTree.test_every_compile_job
_names_its_warm_sources)/
test_every_compile_job_names_its_warm_sources (main.ThisTree.test_every_compile_job
_names_its_warm_sources)
View Logs

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

Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-d43daca7ac1e4cde2f3d

@teamleaderleo teamleaderleo left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review (claude opus-5.5 medium): SHIP at 62e8a7a

Visual verdict: unchanged by this diff.

Delta from d879536 is test-only: the test builds its hook with node:vm compileFunction and passes in only useCallback, instead of new Function, which clears no-implied-eval. The code it takes from App.tsx (sameDrawn, changesDrawn, flushDrawn) uses no other hook, so dropping useRef and useLayoutEffect is safe. The cut markers, the naive-guard mutation and the assertions are unchanged, and so is the product diff.

Follow-ups:

  • [follow-up] The test cuts the callback out of App.tsx by matching source text (#33667).

@cmux-bot
cmux-bot Bot merged commit 8f98f88 into feat-cmux-next Nov 3, 2026
190 of 196 checks passed
@cmux-bot
cmux-bot Bot deleted the lane/transcript-drawn-noop branch November 3, 2026 12:21

This branch was previously deployed

1 inactive deployment
ci-routing-agent — 62e8a7a2 Deployed Nov 3, 2026 by teamleaderleo via cmux-tui tree preflight #105705
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant