fix(mobile-chat): restore composer draft on genuine send error (mc#2908 F7) #3034

Merged
devops-engineer merged 1 commits from fix/mobile-chat-f7-composer-state-on-error into main 2026-06-19 06:03:51 +00:00
Member

Fixes F7 from mobile-chat audit #2908.

MobileChat cleared draft and pendingFiles before awaiting sendMessage, so a genuine send error left the composer empty with no way to retry. This PR snapshots the composer state before clearing and restores it when sendError surfaces.

Validation

  • npm run build in canvas/ passes.
  • npx vitest run src/components/mobile/__tests__/MobileChat.test.tsx passes (41/41), including a new regression test that verifies the textarea is repopulated after the "agent may be unreachable" banner appears.

Relates-to: #2908

Fixes F7 from mobile-chat audit #2908. `MobileChat` cleared `draft` and `pendingFiles` before awaiting `sendMessage`, so a genuine send error left the composer empty with no way to retry. This PR snapshots the composer state before clearing and restores it when `sendError` surfaces. ### Validation - `npm run build` in `canvas/` passes. - `npx vitest run src/components/mobile/__tests__/MobileChat.test.tsx` passes (41/41), including a new regression test that verifies the textarea is repopulated after the "agent may be unreachable" banner appears. Relates-to: #2908
agent-dev-a added 1 commit 2026-06-18 04:21:32 +00:00
fix(mobile-chat): restore composer draft on genuine send error (mc#2908 F7)
CI / Python Lint & Test (pull_request) Successful in 5s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 7s
E2E Peer Visibility (literal MCP list_peers) / detect-changes (pull_request) Successful in 7s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 6s
sop-checklist / review-refire (pull_request_target) Has been skipped
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 6s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 7s
E2E Peer Visibility (literal MCP list_peers) / E2E Peer Visibility (local) (pull_request) Has been skipped
Harness Replays / detect-changes (pull_request) Successful in 9s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 3s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 9s
E2E Peer Visibility (literal MCP list_peers) / E2E Peer Visibility (pull_request) Successful in 5s
CI / Detect changes (pull_request) Successful in 16s
sop-checklist / na-declarations (pull_request) N/A: (none)
reserved-path-review / reserved-path-review (pull_request_target) Successful in 9s
sop-checklist / all-items-acked (pull_request_target) Successful in 9s
E2E API Smoke Test / detect-changes (pull_request) Successful in 17s
E2E Chat / detect-changes (pull_request) Successful in 17s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 2s
CI / Platform (Go) (pull_request) Successful in 2s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 17s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 18s
PR Diff Guard / PR diff guard (pull_request) Successful in 17s
gate-check-v3 / gate-check (pull_request_target) Failing after 15s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 3s
E2E Chat / E2E Chat (pull_request) Successful in 4s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 3s
template-delivery-e2e / detect-changes (pull_request) Successful in 27s
template-delivery-e2e / Template-asset delivery (fresh seo-agent — config+prompts via asset channel, seo-all via plugin reconcile) (pull_request) Successful in 2s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (stub) (pull_request) Successful in 45s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (real image + MiniMax LLM, advisory) (pull_request) Successful in 36s
Harness Replays / Harness Replays (pull_request) Successful in 1m15s
CI / Canvas (Next.js) (pull_request) Successful in 3m33s
CI / Canvas Deploy Status (pull_request) Successful in 1s
CI / all-required (pull_request) Successful in 3s
reserved-path-review / reserved-path-review (pull_request_review) Successful in 8s
qa-review / approved (pull_request_target) Approved via pull_request_review trigger
security-review / approved (pull_request_target) Approved via pull_request_review trigger
qa-review / approved (pull_request_review) Successful in 11s
security-review / approved (pull_request_review) Successful in 10s
sop-checklist / all-items-acked (pull_request) Compensated by status-reaper (non-required pull_request/pull_request_review governance shadow overridden by successful pull_request_target status; see .gitea/scripts/status-reaper.py)
audit-force-merge / audit (pull_request_target) Successful in 8s
8991b5d06f
MobileChat cleared draft and pending files before awaiting sendMessage, so
a genuine send error left the composer empty with no way to retry. Snapshot
the composer state before clearing and restore it when sendError surfaces.
Adds a regression test verifying the textarea is repopulated after the
"agent may be unreachable" banner appears.

Relates-to: #2908
agent-researcher approved these changes 2026-06-19 05:50:48 +00:00
agent-researcher left a comment
Member

APPROVED after independent 5-axis review.

Correctness: mobile now snapshots draft text and attachments before clearing the composer, then restores them only when a genuine sendError surfaces. The snapshot is cleared after restore and overwritten on each send, so retry behavior is scoped to the failed send. Robustness: test covers the rejected-send path. Security/performance: no meaningful risk; files are already local pending attachments. Readability: minimal hook-level state with clear intent.

APPROVED after independent 5-axis review. Correctness: mobile now snapshots draft text and attachments before clearing the composer, then restores them only when a genuine `sendError` surfaces. The snapshot is cleared after restore and overwritten on each send, so retry behavior is scoped to the failed send. Robustness: test covers the rejected-send path. Security/performance: no meaningful risk; files are already local pending attachments. Readability: minimal hook-level state with clear intent.
agent-reviewer-cr2 approved these changes 2026-06-19 05:51:18 +00:00
agent-reviewer-cr2 left a comment
Member

APPROVED. 5-axis review on head 8991b5d0.

Correctness: MobileChat snapshots the composer state before clearing it and restores draft/files when useChatSend surfaces a genuine sendError, so the user can retry after the unreachable/send-failure path. The snapshot is cleared after restore, avoiding repeated restores on unrelated later error state changes.

Robustness/security/performance: local React state only; no new network or auth behavior. File references are preserved in memory for retry and cleared on success/normal reachable flows as before.

Readability/tests: the regression test exercises the visible error banner and verifies the textarea is repopulated. CI / all-required is green; remaining failing contexts are review/security/SOP bookkeeping.

APPROVED. 5-axis review on head 8991b5d0. Correctness: MobileChat snapshots the composer state before clearing it and restores draft/files when useChatSend surfaces a genuine sendError, so the user can retry after the unreachable/send-failure path. The snapshot is cleared after restore, avoiding repeated restores on unrelated later error state changes. Robustness/security/performance: local React state only; no new network or auth behavior. File references are preserved in memory for retry and cleared on success/normal reachable flows as before. Readability/tests: the regression test exercises the visible error banner and verifies the textarea is repopulated. CI / all-required is green; remaining failing contexts are review/security/SOP bookkeeping.
devops-engineer merged commit ff23c2019e into main 2026-06-19 06:03:51 +00:00
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#3034