Skip to content

fix(mobile-web): restore remote rollback drafts and message actions - #3453

Merged
bobleer merged 22 commits into
mainfrom
bobleer/mobile-revert-port-ui
Oct 19, 2026
Merged

bobleer merged 22 commits into
mainfrom
bobleer/mobile-revert-port-ui

Conversation

@bobleer

@bobleer bobleer commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Supersedes #3245. That branch lives in a fork that does not grant maintainer edit access, so its conflict with main could not be resolved in place. This PR carries the same mobile-controller work, merged with current main and updated with the review fixes.

What changed

  • Streamed user images: project userMessage.metadata.images from session turn records into ChatMessage.images. Without this, the timeline, plain rollback, and edit-resend never saw the pixels the host already publishes; image-only rollback restored only the fallback text.
  • Rollback drafts: restore the target message's text and valid image attachments after a rollback, including image-only messages and the rollback-then-send failure path. Replace the composer only when something was restored, and clear stale attachments when the restored prompt has none.
  • Message actions: hide the redundant plain "Resend" when a delivered user message has an authoritative turn_id + turn_index; keep it as the fallback for legacy messages, and do not offer rollback/edit on remote SSH workspaces where the host reports rollback as unavailable.
  • In-flight safety: bind rollback completions to the attempt and control target, and refuse rollback while a send is in flight, so repeated clicks, sends, and session switches cannot mutate the active chat or clear a newer attempt's busy state.
  • Attachment validation: reject non-canonical base64 image data URLs before forwarding or restoring them. The validation/projection logic lives in src/mobile-web/src/services/chatImageAttachments.ts with unit coverage.
  • Test reliability: keep the account-browser cleanup bounded without forcing process.exit(0) (which masked failing assertions), let Node force-exit only after the runner finished, fix Vite /@fs/ paths and screenshot paths for Windows, discover Edge on Windows, and close lingering Vite connections.
  • Web UI tests on Node 25+: append --no-experimental-webstorage to NODE_OPTIONS through src/web-ui/scripts/run-vitest.mjs so Node's global sessionStorage no longer shadows jsdom's while the CI heap setting and any caller flags stay intact. The full web-ui suite fails without the flag on Node 26.

The duplicate session_revert registration from #3245 is intentionally dropped: current main already attaches the scheduled revert port to CoreRemoteSessionRuntimeHost via agent_runtime_with_lifecycle_delivery (978f58a), and the conflicting file is resolved to main's version.

Verification

  • pnpm --dir src/mobile-web run type-check
  • pnpm --dir src/mobile-web run test:images (7 tests)
  • pnpm --dir src/mobile-web run test:ui-components (15 tests)
  • pnpm --dir src/mobile-web run test:workspace-identity (21 tests)
  • pnpm --dir src/mobile-web run test:host-stream (23 tests, including the streamed attachment projection)
  • pnpm --dir src/mobile-web run test:host-queue (17 tests)
  • pnpm --dir src/mobile-web run test:account-browser (17 tests)
  • pnpm --dir src/mobile-web run test:account-login (17 tests)
  • pnpm --dir src/web-ui run test:run (1035 files, 11586 tests)
  • pnpm run check:repo-hygiene, pnpm run i18n:audit, pnpm run check:github-config
  • pnpm --dir src/mobile-web run build

Notes

  • Rollback/edit remain unavailable on remote SSH workspaces because the host returns NotAvailable for those; the client gate only avoids presenting a mutation that must fail.
  • Canonical-base64 validation silently skips malformed or unpadded attachment payloads rather than forwarding bytes the model cannot decode.

BingCHuanJ and others added 20 commits September 28, 2026 16:09
# Conflicts:
#	src/crates/assembly/core/src/service_agent_runtime.rs
…ded host fix

Move remote image data-URL validation and transcript projection into a pure
service module and cover it with canonical base64 and rollback-draft tests.
Drop the CI NODE_OPTIONS entry: the web-ui test script sets the flag it needs,
so unrelated frontend steps keep their memory settings. Main already registers
the scheduler revert port on the remote session host, so this PR now carries
only the mobile controller behavior.
Project userMessage.metadata.images from streamed turn records so the
transcript, plain rollback, and edit-resend see the same attachments the host
published. Guard rollback against an in-flight send and only replace the
composer when the rollback restored text or images, clearing stale attachments
instead of leaving them on a restored prompt.

Run web-ui Vitest with --no-experimental-webstorage appended to NODE_OPTIONS
so the CI heap setting survives, and let the account browser test force-exit
after completion without masking failing assertions.
@bobleer
bobleer merged commit 50187d4 into main Oct 19, 2026
9 checks passed
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.

2 participants