Skip to content

feat(agent-chat): detect complete HTML writes from every harness - #26219

Closed
teamleaderleo wants to merge 24 commits into
feat-cmux-nextfrom
nx-artifacts-resume-d-1027
Closed

teamleaderleo wants to merge 24 commits into
feat-cmux-nextfrom
nx-artifacts-resume-d-1027

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Completed HTML writes from every harness use the existing artifact preview. A full recorded ACP diff or a whole-file write input opens the document; a replacement-only edit snippet does not masquerade as an entire HTML file.

Leo asked: "the /side thing i heard somebody really liked in codex... and i think html/html artifacts and that kinda good viewing and good support for it would be cool" and "like the claude.ai artifacts but imagien you didnt need to only have it on claude.ai...".

This builds on #25190. It preserves that PR's HTML/SVG/JSX aliases, preview surface, and exports, and replaces its detector with one pure helper shared by all harnesses. The helper accepts completed edit/fileChange records, keeps canonical file identity, recovers complete Write inputs even when the old contents are unknown, and excludes failed/running calls, shell commands, and partial or legacy unmarked Edit/replace snippets. It never reads a file or reconstructs a patch.

Each immutable completed tool update is parsed once through a weak cache. This adds no timer, scroll handling, storage, or per-token transcript walk. Recovered from the earlier nx-artifact-detect-1025 work at ddd3631.

A fresh Astra review found that Codex adoption labels multi-file changes “Edit N files,” including complete added HTML files. The final repair verifies per-file whole-add provenance through normalized tool records, preserving legacy snippet rejection. Final head, focused red→green and independent re-review receipts are pending; no SHIP is claimed yet.

Observed / Not run

  • Recovered detector run40486752560: red9pass/13fail, then30/30head and full web check including typecheck pass.
  • Recovered final capture run40487775047:10/10cases pass for Claude/Codex/pi/Gemini/legacy partial Edit, in light and dark. The final provenance regression will run at the stacked head; the older fixtures missed Codex adopted multi-file additions.
  • No disk reads, tool execution, storage, polling or per-token transcript walk are introduced.

Agent session: agent session

Red: bun test test/artifact-html.test.tsx: 5 expected failures (no JSX kind or HTML write output). bun run check blocked by pre-existing design-token findings outside changed files; focused lint passed.
Agent-Session: https://cmux.com/deeplink/agent?harness=codex&session=01a1756c-cf95-7a30-a911-a4a2d18a4841&host=gcp-codex-lane-2
HTML/SVG/JSX use the existing side preview, with an offline native artifact endpoint, isolated scripts, and navigation refusal. Completed full HTML writes from normalized ACP tools appear in the transcript and Outputs, with file-based versions. React/Sucrase are bundled locally and loaded after Run.

Red 68de299107d: bun test test/artifact-html.test.tsx had 5 expected failures. Green: same command 7 passed; focused artifact/panel/Inspector suite 17 passed; scoped gallery suite 27 passed. Manual Chromium VM check: 10 fixtures and parent/storage/network/file/WebSocket/image/script policy probes passed, with captures. Web bundle build, typecheck, formatting and changed-file lint passed. Localization audit passed with no new keys.

Not run: native compilation and AgentPaneArtifactNavigationTests (Linux VM has no swiftc; integration owner runs fleet verification). Full web check remains red on untouched base design-token debt at a30f457. No PR or push; artifact A handoff to nx-chat.

Agent-Session: https://cmux.com/deeplink/agent?harness=codex&session=01a1756c-cf95-7a30-a911-a4a2d18a4841&host=gcp-codex-lane-2
Draw passive artifact markup in a script-disabled srcdoc frame, then reserve the native opaque allow-scripts endpoint for explicit Run. Parse inert HTML for consent markers and refuse srcdoc-origin navigation to allowed pane or loopback routes. Deduplicate the standalone opened-write version list by recorded body.

Validation: scoped vp fmt passes on seven web files; scoped vp lint passes on new safety/runtime files. App lint reports only existing unlift/follow exhaustive-deps warnings. Swift syntax parse and git diff --check pass. No tests, builds, browser execution, push or hosted dispatch were run locally; parent owns exact-head hosted red/green and review.
Agent-Session: https://cmux.com/deeplink/agent?id=aid-196c8c4a1f392915fbea
Carry toolCanonical onto synthesized full-write diffs so canonical creates and raw-input overwrites remain one document in Outputs and the opened artifact version list.

Validation: scoped vp fmt and vp lint pass on writtenArtifacts.tsx and artifact-html.test.tsx; git diff --check passes. The focused behavioral regression is committed first at fbfd741; tests and builds are deferred to the coordinator's hosted lane. No push or dispatch.
Agent-Session: https://cmux.com/deeplink/agent?id=aid-196c8c4a1f392915fbea
@teamleaderleo

teamleaderleo commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

Owned by an agent session · session

@blacksmith-sh

blacksmith-sh Bot commented Oct 27, 2026

Copy link
Copy Markdown

Found 78 test failures on Blacksmith runners:

Failures

Test View Logs
---/--- View Logs
---/--- View Logs
---/--- View Logs
---/--- View Logs
---/--- View Logs
---/--- View Logs
---/--- View Logs
---/--- View Logs
---/--- View Logs
---/--- View Logs

...and 68 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 27, 2026 •

Copy link
Copy Markdown

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

Unclear: web / react-apps-check failed: no known signature; failed step: Check webview test shards.

CI failed on dbb878f831 (run 40522816915 attempt 1): 1 code, 1 unknown.

Job Verdict Why
web / react-apps-check (1) 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-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-hairline-focus.test.ts composer at 1x: focus is the resting hairline a step brighter, no ring: failed (job)
  • seen on other PRs agent-pane-hairline-focus.test.ts newtab at 1x: focus is the resting hairline a step brighter, no ring: failed (job)
  • seen on other PRs agent-pane-hairline-focus.test.ts composer at 2x: focus is the resting hairline a step brighter, no ring: failed (job)
  • seen on other PRs agent-pane-hairline-focus.test.ts newtab at 2x: focus is the resting hairline a step brighter, no ring: failed (job)
  • seen on other PRs agent-pane-hairline-focus.test.ts under Increase Contrast a focused edge keeps the resting edge, never a dimmer one: failed (job)
  • seen on other PRs agent-pane-hairline-focus.test.ts keyboard focus changes what a solid Send, Stop, the prompt editor's Send and a plain button paint; s...: failed (job)
  • seen on other PRs agent-pane-jump-latest-motion.test.ts chromium: a reply streaming in during Jump to latest's glide is followed to its latest row: failed (job)
Matched log lines
web / react-apps-check (1): (fail) the summary card lists the chat's background tasks: running ones first, the finished folded [1634.56ms]

Not re-run automatically: web / react-apps-check (1), 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 dbb878f831 (https://github.com/manaflow-ai/cmux/actions/runs/40522816915). 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.

Base automatically changed from nx-artifacts-resume-a-1027 to feat-cmux-next October 30, 2026 05:17
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Orphaned: no activity for 65 h, and no lane holds a lease on it. The orphan sweep could not merge feat-cmux-next in: conflicts in Packages/macOS/CmuxNext/Sources/CmuxNextAgentPane/AgentPaneRenderFrame.swift, Packages/macOS/CmuxNext/Tests/CmuxNextAgentPaneTests/AgentPaneArtifactNavigationTests.swift, release-notes/next/highlights/interactive-chat-artifacts.md, webviews/src/agent-session/acpmux/conversation/ArtifactPanel.tsx, webviews/src/agent-session/acpmux/conversation/artifactSandbox.ts, webviews/src/agent-session/acpmux/conversation/writtenArtifacts.tsx, webviews/test/artifact-html.test.tsx, webviews/test/artifact-panel-sandbox.test.tsx. Listed for a lane to resolve.

teamleaderleo added a commit that referenced this pull request Oct 31, 2026
… Open

The edit-name guard from #26219 dropped every diff of an Edit/replace call
unless Codex add provenance proved it, so OpenCode's edit and Gemini's
replace, which record the whole old and new file, lost their preview and
Open. An edit-named call's unmarked diff now opens when it is shown to be
the file: it is not one of the replacement strings its input records
(Claude Code's Edit and MultiEdit diffs are exactly those) and the input
records some, or with no input its new text is a whole HTML document.
Marked fragments and legacy snippets stay closed.

Tests: a complete create, edit (Claude-shaped and OpenCode-shaped) and
replace open; Edit/MultiEdit replacement snippets, a no-input legacy
snippet and a marked fragment stay closed. Gallery: edit-complete,
replace-complete, edit-complete-open and edit-snippet artifact-panel states.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-f71664ebfb6cf5206479
teamleaderleo added a commit that referenced this pull request Oct 31, 2026
#26219) (#28732)

* fix(agent-chat): preview only complete recorded HTML writes (carry #26219)

Carries the part of #26219 that is not on base (#26216 landed the rest):
artifactWrites.ts with the partial-hunk guard and the multi-file add
provenance, plus test/artifact-writes.test.ts. writtenArtifacts.tsx now
re-exports toolArtifacts from it.

From #26219: 392a6af, 4ed83ed, 446f9c7, f9ce1d9,
bdf7318, ad5452b. Kept base's OpenCode filePath/absolute_path
write fields, with test cases for them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-63b9964940c20354b639

* fix(agent-chat): a complete edit or replace of an HTML file keeps its Open

The edit-name guard from #26219 dropped every diff of an Edit/replace call
unless Codex add provenance proved it, so OpenCode's edit and Gemini's
replace, which record the whole old and new file, lost their preview and
Open. An edit-named call's unmarked diff now opens when it is shown to be
the file: it is not one of the replacement strings its input records
(Claude Code's Edit and MultiEdit diffs are exactly those) and the input
records some, or with no input its new text is a whole HTML document.
Marked fragments and legacy snippets stay closed.

Tests: a complete create, edit (Claude-shaped and OpenCode-shaped) and
replace open; Edit/MultiEdit replacement snippets, a no-input legacy
snippet and a marked fragment stay closed. Gallery: edit-complete,
replace-complete, edit-complete-open and edit-snippet artifact-panel states.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-f71664ebfb6cf5206479

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: cmux-bot[bot] <348531757+cmux-bot[bot]@users.noreply.github.com>
@lawrencecchen

Copy link
Copy Markdown
Contributor

Conflict wave: feat-cmux-next already contains this PR's change. 50e69a6 "feat(agent-chat): detect complete HTML writes from every harness (carry #26219) (#28732)" landed it. Of this PR's added lines, 881 of 969 are present in feat f06d9bd; the rest are later changes on feat to the same code. I pushed no merge. I did not close the PR; a person can close it.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Superseded by #28732 (merged), the carry of this complete-HTML-write detection. Closing this copy.

This branch was previously deployed

1 inactive deployment
ci-routing-agent — dbb878f8 Deployed Oct 27, 2026 by teamleaderleo via wait for same-key tree publisher #65288
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.

2 participants