Skip to content

fix(composer): preserve native text recovery and first-session hydration - #26842

Draft
teamleaderleo wants to merge 15 commits into
lane/nx-draft-persistencefrom
lane/nx-draft-text-hydration
Draft

teamleaderleo wants to merge 15 commits into
lane/nx-draft-persistencefrom
lane/nx-draft-text-hydration

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Composer draft hydration preserves an authoritative daemon clear when the native mirror refuses the empty write. Per-session ordered state retains the latest daemon observation, so a later unavailable daemon read cannot resurrect stale native text; a newer local edit still wins. The repair adds the delayed refusal regression and keeps unreadable daemon metadata retryable without inventing a durable tombstone.

This is the text/hydration child stacked on foundation 87d8459a652168f33482c2012f9203e20156df2a, targeting lane/nx-draft-persistence. Child-relative diff: 17 files, 779 insertions + 21 deletions (800 changed lines). Aggregate stack from 9445568053d73aaed41afefe1e7afa0dd9246aee: 26 files, 1,573 insertions + 54 deletions (1,627 changed lines), including the prerequisite foundation work.

Validation: focused composer draft actions 11 pass, 0 fail (21 expects), including clear -> delayed mirror refusal -> daemon unavailable -> stale mirror and newer-local-edit cases. webviews/bun --bun run check passed (format, lint, typecheck, protocol, and ratchets). Exact web-lint against the foundation and exact prepush-gate both pass; prepush reports no new violations, with only baseline app-size warnings. The eight-file focused aggregate suite is 88 pass/2 fail; both reds reproduce unchanged at baseline 5caece6d05f (NewTab sent route missing Send button and sandbox receipt-order assertion), so they are unrelated baseline failures.

Native compile/tests remain UNEXECUTED/HOLD under #26809/HQ4779. Fresh independent exact-head review is running at c63183b877adc9b656bba5a57e82bdbff9163b2e; this draft remains pending review and native verification. No CI, ready transition, or merge is claimed.

Agent session: agent session

Stack text recovery and hydration on the atomic migration and writer-ownership foundation.

Agent-Session: https://cmux.com/deeplink/agent?id=aid-8284337bbcbcfb8957d8
Exercise the actual React MarkdownField hydration path with daemon null/empty clears and a native empty fallback against stale initial cache/handshake and carried prompt text. All six new regressions fail on the prior consumer.

Agent-Session: https://cmux.com/deeplink/agent?id=aid-8284337bbcbcfb8957d8
Keep empty durable drafts distinct from missing results, replace unedited remount and carried seeds with present durable state, and refresh only the local cache when restoring. Edits made while hydration waits remain owned by the user.

Agent-Session: https://cmux.com/deeplink/agent?id=aid-8284337bbcbcfb8957d8
Actual App consumers: normal unsent unmount passes; successful page send and restored host receipt resurrect already-sent text (1 pass, 2 expected failures).

Agent-Session: https://cmux.com/deeplink/agent?id=aid-8284337bbcbcfb8957d8
The existing heldBack route transfers separately typed text to the chat composer. Preserve that ownership; only a page-originated successful send must clear the New Tab draft. RED: 2 pass, 1 expected failure, 12 assertions.

Agent-Session: https://cmux.com/deeplink/agent?id=aid-8284337bbcbcfb8957d8
Clear the tab-owned draft for a page send already handed to Sandbox. Ordinary unsent unmount still persists; a host receipt keeps the existing heldBack transfer of separately typed text. Actual App regression: 3 pass, 13 assertions; focused draft/Sandbox/NewTab suite: 88 pass, 271 assertions. Web static checks pass. Native verification remains on HOLD.

Agent-Session: https://cmux.com/deeplink/agent?id=aid-8284337bbcbcfb8957d8
@blacksmith-sh

blacksmith-sh Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Found 110 test failures on Blacksmith runners:

Failures

Test View Logs
src/pages/settings/layout.test.ts/layout.test View Logs
src/pages/settings/layout.test.ts/layout.test View Logs
test/agent-pane-background-tasks.test.ts/agent-pane-background-tasks.test View Logs
test/agent-pane-background-tasks.test.ts/agent-pane-background-tasks.test View Logs
test/agent-pane-chat-unavailable.test.ts/agent-pane-chat-unavailable.test View Logs
test/agent-pane-chat-unavailable.test.ts/agent-pane-chat-unavailable.test View Logs
test/agent-pane-dock-gutters.test.ts/agent-pane-dock-gutters.test View Logs
test/agent-pane-dock-gutters.test.ts/agent-pane-dock-gutters.test View Logs
test/agent-pane-hairline-focus.test.ts/agent-pane-hairline-focus.test View Logs
test/agent-pane-hairline-focus.test.ts/agent-pane-hairline-focus.test View Logs

...and 100 more test failures. View all on Blacksmith

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

@cmux-bot

cmux-bot Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

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

Probably yours: changes-stage-hunk-keys.test.ts, composer-mention.test.ts, agent-pane-background-tasks.test.ts fails here but not on main's latest full suite. Seen on other PRs too (likely flaky): agent-pane-dock-gutters.test.ts, agent-pane-dock-gutters.test.ts, agent-pane-queue-steer.test.ts and 18 more.

CI failed on c63183b877 (run 40712133958 attempt 1): 3 code, 1 unknown.

Job Verdict Why
web / react-apps-base-check (1) code a web test failed
web / react-apps-base-check (2) code a web test failed
web / react-apps-base-check (4) code a web test failed
web / react-apps-check unknown no known signature; failed step: Check webview test shards

Failures:

  • seen on other PRs agent-pane-dock-gutters.test.ts chromium > the gutter beside every part of the stack scrolls the transcript, and the part keeps the ...: failed (job)
  • seen on other PRs agent-pane-dock-gutters.test.ts webkit > the gutter beside every part of the stack scrolls the transcript, and the part keeps the po...: failed (job)
  • seen on other PRs agent-pane-queue-steer.test.ts queued and steering prompts > the queue takes its own place in the stack: nothing is cut off or draw...: failed (job)
  • new in this PR changes-stage-hunk-keys.test.ts n then s stages the hunk n stopped at: failed (job)
  • seen on other PRs composer-footer-harness.test.ts with no harness installed the row still says Add harness: failed (job)
  • new in this PR composer-mention.test.ts (unnamed): failed (job)
  • seen on other PRs composer-permission-pill.test.ts claude: permission control keeps the shared capsule geometry: failed (job)
  • seen on other PRs composer-quiet-chips.test.ts chromium: keyboard focus pills the focused button only, ringless, with its outline: failed (job)
  • new in this PR agent-pane-background-tasks.test.ts the summary card lists the chat's background tasks: running ones first, the finished folded: failed (job)
  • seen on other PRs agent-pane-chat-unavailable.test.ts loading never shows the unavailable text: a slow attach, then a machine still connecting: failed (job)
  • ... 14 more in the job logs
Matched log lines
web / react-apps-base-check (1): (fail) chromium > the gutter beside every part of the stack scrolls the transcript, and the part keeps the pointer [9207.90ms]
web / react-apps-base-check (2): (fail) the summary card lists the chat's background tasks: running ones first, the finished folded [977.07ms]
web / react-apps-base-check (4): (fail) only page.css imports the page's sheets [24.13ms]

Not re-run automatically: web / react-apps-base-check (1), web / react-apps-base-check (2), web / react-apps-base-check (4), web / react-apps-check are not machine failures.

Written by scripts/ci/classify_failures.py (ci-failure-attribution.yml); signatures are its SIGNATURES table. A machine verdict is the runner's fault, not this PR's; yours means the failing file is one this PR changes, also red on main that main's latest full suite fails the same way, seen on other PRs that it failed on another pull request's run lately.

CI fast guards failed on c63183b877 (https://github.com/manaflow-ai/cmux/actions/runs/40712133958). It does not block the merge; a red guard merged into main breaks it for every open PR.
The log named no failed step; see the run.

Agents: python3 scripts/ci/guard_attribution.py fix applies the mechanical fixes locally.

RED cases: daemon clears must seed the native fallback mirror; newer local writes must beat an older read; imported legacy composer keys may be cleared by newer daemon metadata while genuine destination keys remain; draft text finalization must drain and reject late writes. Native regressions are source-authored and unexecuted under HOLD.

Agent-Session: https://cmux.com/deeplink/agent?id=aid-8284337bbcbcfb8957d8
Synchronize authoritative daemon values, including clears, into the native fallback mirror through a per-session ordered versioned queue. Imported legacy composer keys carry provenance so newer daemon metadata clears can replace only imported values; genuine destination drafts remain authoritative and unreadable newest metadata fails closed. Finalize AgentPaneDraftTexts after committed Keep/Restart quit work and before browser shutdown, rejecting later page writes while cancellation remains writable. RED commit: 0c9e643. Web suite: 90 pass, 275 assertions. Native source tests remain unexecuted under HOLD.

Agent-Session: https://cmux.com/deeplink/agent?id=aid-8284337bbcbcfb8957d8
Keep deterministic coverage for a late local edit during native mirror synchronization, latest text and empty tombstone behind a blocked files lane, genuine destination precedence, and unreadable newest metadata followed by repair. Native source cases remain unexecuted under HOLD.

Agent-Session: https://cmux.com/deeplink/agent?id=aid-8284337bbcbcfb8957d8
Recover readable newest metadata before legacy import so explicit clears block stale text and genuine destination keys remain untouched. Unreadable newest metadata stops adoption without inventing a permanent clear, allowing repaired metadata to recover on retry. Remove the provenance sidecar and keep the foundation artifact transaction unchanged. Serialize only native mirror operations so a pending daemon read cannot delay a newer local mirror write. Preserve the committed-quit finalization fence.

Agent-Session: https://cmux.com/deeplink/agent?id=aid-8284337bbcbcfb8957d8
Wait for the real pane.painted callback from each App mount so the scheduled native paint notification cannot outlive the JSDOM window. Exact focused suite: 91 pass, 279 assertions. Full web checks pass.

Agent-Session: https://cmux.com/deeplink/agent?id=aid-8284337bbcbcfb8957d8
RED: a daemon null is followed by a delayed native mirror refusal and an unavailable daemon read; the stale native text returns. A newer local edit must supersede the retained clear. Focused action tests: 12 pass, 1 expected failure.

Agent-Session: https://cmux.com/deeplink/agent?id=aid-8284337bbcbcfb8957d8
Keep the newest daemon observation per session until a newer local edit supersedes it. If native mirror persistence refuses a clear and the daemon later becomes unavailable, the clear remains authoritative instead of falling back to stale native text. The focused regression also covers a newer local edit winning after the refused clear. RED commit: 041d6c2. Focused action tests: 11 pass, 21 assertions.

Agent-Session: https://cmux.com/deeplink/agent?id=aid-8284337bbcbcfb8957d8

This branch was previously deployed

1 inactive deployment
ci-routing-agent — c63183b8 Deployed Oct 28, 2026 by teamleaderleo via wait for same-key tree publisher #72121
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant