Skip to content

Remote new task: sent prompt briefly sticks in composer before transcript #1713

Backlog

Description

@AnthonyRonning

Summary

Creating a new task on a remote computer in Maple Work can briefly show the just-sent prompt inside the New Task composer after the UI has already switched to the chat view. The text then moves into the transcript once the first send actually goes out.

Expected: after Enter/Send, the UI should transition directly into the chat view with the prompt represented in the transcript area — or stay on the New Task screen until that can happen without showing the prompt in the wrong place.

Actual: the chat layout/bottom composer appears first, while the prompt still lives in the composer; a moment later the composer clears and the transcript bubble appears.

Local projects do not show this noticeably because the relevant calls complete within roughly a frame. Remote projects expose it because task creation and subscription are network round trips.

Reproduction

  1. Open Maple Work.
  2. Select a remote computer/project.
  3. Start a new task.
  4. Type a prompt in the New Task composer and press Enter/Send.
  5. Observe the transition: chat view appears first; the prompt briefly remains in/near the composer; then the transcript bubble appears.

Also worth checking:

  • Whether the draft had a non-default permission mode (Read only / Full access) or MCP changes — these add settle_new_session work and widen the window.
  • Enter vs click Send.
  • Failure/retry paths and navigation away during creation.
  • Whether the same build on a local project exhibits the same frame-level sequence (likely yes, just imperceptible).

Likely mechanism

The first send deliberately splits “leave the New Task hero” from “send the message”:

  1. create_for_first_send builds a status-only first_send_preview (SendPreview::new(...).status_only()) and stores the actual send in pending_first_send.

    • File: apps/maple-agent/app/src/ui/chat/mod.rs (create_for_first_send, create_for_first_send / first-send path; exact line numbers will drift).
    • The inline comment states the intended behavior: the text stays in the composer while the task is being created.
  2. shows_empty_state() in apps/maple-agent/app/src/ui/chat/sending.rs treats any current send preview as leaving the empty state. So even a status-only preview switches rendering away from the centered New Task layout into the chat layout with the bottom composer.

  3. The composer is put into a disabled/“Creating task” state but still holds the draft text.

  4. Only after:

    1. create_session resolves,
    2. subscribe_new_session is acknowledged, and
    3. settle_new_session applies any permission/MCP changes the draft carries,

    does finish_new_session run, which sets the active session and calls run_first_send.

  5. run_first_send takes the composer text, calls the normal send path, clears the composer, and creates the real preview/transcript entry.

  6. Authoritative user-message/run events then replace/confirm that optimistic preview.

So the intermediate frame is: chat layout is visible, but the user message is still only composer text with a status-only preview elsewhere.

Why remote differs from local

The code path is the same, but remote execution changes timing:

  • Local: create + subscribe usually complete inside the same/next frame, so the user never sees the intermediate state.
  • Remote: create_session is a network round trip to the selected computer; then subscription is awaited; then permission/MCP settle can add more round trips. For that entire window, the UI has already left the empty state but the message has not moved to the transcript.

The backend selection uses the selected computer’s connection (app/src/backend.rs), and remote task calls go over that connection rather than in-process IPC.

Regression context

This does not look like a fresh regression from the latest transcript/history commits. The mechanism traces mainly to:

  • 0cb4218c — fix(agent): smooth composer sends and preserve remote drafts (#1199) — introduced the status-only first-send preview / preserve-draft behavior.
  • 5e3793ae — feat(agent): persist local state in host-owned SQLite (#1204) — part of the create/subscribe/settle flow and host-owned state around task creation; the first-send path was shaped in this era.
  • aec3a588 — Agent: rework the motion layer on springs, with timing in one place (#1575) — may have made the same state more noticeable; not proven to be the cause.

Recent commits specifically reviewed and not implicated as the origin:

Important caveat: it may have been present since late October and only become noticeable on slower remote links, or more visible after the motion rework. We have not proven which prior release contains it.

Multi-agent investigation summary

Four agents independently reviewed this read-only. They strongly agreed on the mechanism and differed mainly on fix preference.

Codex

  • The source shows a clear timing mismatch: layout switches as soon as a pending preview exists, but the preview hides the message body and leaves the prompt in the composer.
  • create_session, then subscription acknowledgment, then permission/integration changes happen before finish_new_session → run_first_send clears the composer and inserts the visible transcript preview.
  • Local IPC hides this; remote round trips expose it.
  • Suggested fix: atomically capture the submitted prompt, clear the composer, and show the optimistic transcript body during the transition; carry the retained send through creation/subscription; preserve failure recovery and navigation cancellation; keep the subscription acknowledgment gate.
  • Confidence: high on mechanism, lower on exact release attribution.

Claude Code

  • Traced the exact sequence: create_for_first_send sets a status-only first_send_preview; shows_empty_state() becomes false; render takes the transcript + bottom-composer branch; composer remains with text and a “Creating task” label.
  • Text remains because that is explicitly documented in code: composer shows “creating” until the send goes out.
  • Only after create_session, subscribe, and any permission-mode/MCP settle does run_first_send read the composer, clear it, and insert the message.
  • Noted New Task may add create_scratch_project for scratch projects, but the layout stays in the empty state during that step.
  • Regression read: none found in current master/0.0.25-era code for this first-send path; likely predates those changes or is latency exposure.
  • Suggested fixes:
    1. Make the first send optimistic: clear composer and show full bubble immediately; carry the preview into the send; keep failure restore.
    2. Smaller alternative: keep empty-state layout until task exists; shows_empty_state() ignores the status-only first-send preview.
    3. Later: fold subscribe and permission mode into create to reduce round trips; needs protocol/version compatibility review.
  • Verification: compare previous release against stage; time create_session / subscribe / settle on a remote first send; check non-default permission mode widens the window.

Grok Build

  • Described the same sequence and emphasized that create_session creates an empty timeline; the user message row is created later by the send path.
  • Remote adds network round trips; local usually completes before the next paint.
  • Identified 0cb4218c (Fix Agent composer transitions and remote draft navigation #1199) and the subscription-before-send behavior around 5e3793ae (feat(agent): add host-owned SQLCipher local storage #1204) as the origin, not the later transcript pager/retry/steering commits.
  • Suggested fix: make the frame that leaves the hero the same frame that shows the transcript bubble — optimistic transcript body + immediate composer clear — or keep the hero/empty state until run_first_send.
  • Warned against clearing the composer without a restore path: failed creates must return the draft.

Antigravity

  • High-confidence version of the same diagnosis, with a concrete implementation sketch:
    1. In create_for_first_send, create first_send_preview without .status_only() so show_body is true immediately.
    2. Clear the composer immediately, matching send_to_session.
    3. Transfer/carry the preview into sending_previews when handing off to the send path, preserving timestamps so the bubble does not replay its entrance animation.
    4. Send action.text() rather than the current composer contents from run_first_send, so text typed after the send was initiated does not accidentally become the sent message.
    5. Hide the New Task project chip once first_send_preview exists, so it does not briefly appear in the bottom composer area.
    6. Update pending_first_send_renders_at_the_conversation_position to the new contract.
  • Alternative: keep shows_empty_state() true while selected_session.is_none() even when first_send_preview.is_some(), so the New Task screen waits and then transitions atomically.
  • Also suggested reducing remote latency by letting AgentCreateSessionRequest carry initial permission mode and/or combining create + subscribe on the host — but that is a wire/version-compat change.
  • Confidence: high on mechanism; moderate on why Anthony saw it now specifically. Non-default permission mode/MCP toggles add measurable extra RTTs and should be checked when reproducing.

Consensus

Suggested fix options

Option A — Optimistic first send (preferred UX)

On Enter/Send:

  1. Create the first-send preview with body visible.
  2. Clear the composer immediately.
  3. Show the user bubble in the transcript immediately, even before the remote task exists.
  4. Carry that preview into the eventual send path instead of recreating/replaying it.
  5. If creation fails or the user navigates away, use the existing restore paths (give_back_first_send / pending_first_send) to return the text.
  6. Decide and encode behavior for text typed during task creation:
    • Current behavior sends whatever is in the composer at send time.
    • Optimistic behavior should send the captured action text and not absorb later typing into the already-sent message.

Pros: matches user expectation; no misplaced prompt. Cons: changes intentional “edit while creating” semantics; needs careful failure handling.

Option B — Hold the New Task/empty state until the task exists

Make shows_empty_state() return true while the first send is still only pending/status-only and no session exists. The UI remains on the New Task screen until finish_new_session, then switches to chat with the bubble already present.

Pros: smallest conceptual change; avoids moving text into transcript early. Cons: remote creation may feel like the send “does nothing” for a moment unless the composer/status clearly communicates progress.

Option C — Reduce remote round trips

Fold subscribe and/or initial permission-mode application into session creation, or skip the settle call when nothing differs.

Pros: improves the fundamental latency. Cons: protocol/host compatibility and versioning concerns; should be its own change, not bundled casually with the UI fix.

Tests and checks to update

  • apps/maple-agent/app/src/ui/chat/tests.rs
    • pending_first_send_renders_at_the_conversation_position — currently asserts the first-send pending state renders at the conversation position with no pending-send-body and keeps the composer editable. This likely needs to change for the chosen fix.
    • first_send_immediately_leaves_the_hero_without_inventing_history — may also change depending on Option A vs B.
  • sending.rs shows_empty_state() behavior if Option B is chosen.
  • Failure-path tests: create failure, navigation away during create, non-default permission mode, MCP changes pending.
  • Manual remote QA: Enter and Send button; default vs Read only vs Full access; with/without MCP changes; slow remote link or artificial delay.

Working notes / pitfalls

  • Do not simply clear the composer on Enter without a restore path; failed creates must give the draft back.
  • Be careful with run_first_send currently reading composer_text(cx) — anything typed during creation currently rides along with the send.
  • If the preview is shown optimistically, preserve its timestamp/identity when handing off to the real send so it does not re-animate.
  • Hiding the New Task project chip once first send starts would remove another transient inconsistency.
  • Do not treat this as a transcript-paging bug; the transcript history work is probably innocent.
  • Do not change shared remote protocol casually; if Option C is pursued, it needs compatibility review.

Acceptance criteria

  • On a remote computer, pressing Enter/Send on a new task never shows the sent prompt stranded in the composer after the chat view appears.
  • The user message appears either immediately (Option A) or exactly when the chat view appears (Option B), not one async round trip later.
  • Failed task creation restores or preserves the draft exactly as before.
  • Local behavior does not regress.
  • Tests covering first-send layout, failure restore, and navigation-away-during-create are updated and pass.
  • Manual remote verification notes are attached to the PR.

Status

Investigation only so far; no code has been changed for this issue.

Activity

  1. added
    bug
    on Nov 27, 2026
  2. Alhibb commented on Dec 1, 2026

    @Alhibb

    Hi! Are external contributions welcome on this issue?

    I traced the transition in apps/maple-agent/app/src/ui/chat/ (create_for_first_send using .status_only() while keeping text in the composer until run_first_send) and would be happy to put together a PR. Do you prefer Option A (showing the optimistic SendPreview bubble immediately, clearing the composer, and carrying the preview's entrance timestamp/attachments into sending_previews on handoff) or Option B (keeping the hero until task setup finishes)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions