Preserve typed input when a viewed cloud agent session ends#13276
Preserve typed input when a viewed cloud agent session ends#13276warp-dev-github-integration[bot] wants to merge 4 commits into
Conversation
|
@warp-dev-github-integration[bot] I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR splits the cloud follow-up input enable path from the post-submission reset path so typed drafts survive when a viewed cloud/ambient agent session ends, and adds a regression test for that behavior. I did not find correctness, security, or spec-drift issues in the changed code; no approved spec context was provided for this PR.
Concerns
- This is a user-facing behavior change, but the PR description does not include screenshots or a screen recording demonstrating the end-to-end flow. For this user-facing change, please include screenshots or a short recording showing a viewed cloud/ambient session with a typed draft, the session ending/tearing down, and the draft still present with the input editable.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
|
Thanks for the review. On the request for a screen recording of the end-to-end flow:
Requesting manual UI confirmation from a reviewer in a build-capable environment: view a running cloud/ambient session, type a draft into the input, let the session end/teardown, and confirm the draft survives and the input is editable in agent mode. CI will run Posted by the factory-client agent. |
|
CI is red, but the failure is not from this PR — it's a pre-existing compile error on The
Evidence this is unrelated to this change:
A re-run won't help (deterministic compile error), and fixing that unrelated modal test here would be out-of-scope for this bug fix. This should clear once Posted by the factory-client agent. |
When viewing a remote/cloud (ambient) agent session, enabling the cloud-followup input on teardown reused `Input::reset_after_cloud_followup_submission`, which clears the editor buffer — wiping any un-submitted draft the user had typed. Split the two concerns: `Input::enable_cloud_followup_input` now enables the followup input (Editable + unfrozen text colors) WITHOUT clearing the buffer, and `reset_after_cloud_followup_submission` clears the buffer and then calls `enable_cloud_followup_input` (the genuine post-submission reset). `TerminalView::enable_cloud_followup_input` uses the non-destructive method, so drafts survive session teardown while a real followup submission still clears as before. CHANGELOG-BUG-FIX: Fixed the agent input box being cleared when a cloud agent session you're viewing ends. Co-Authored-By: Warp <agent@warp.dev>
2c953a3 to
1af7f4f
Compare
The previous change preserved the input buffer unconditionally when enabling the cloud-followup input on session teardown, which regressed test_on_session_share_ended_clears_frozen_followup_input_for_owned_ambient_session: an in-flight (frozen/loading) prompt must still be cleared so the user gets a fresh followup input. Distinguish the two cases via the editor's ephemeral loading state: a frozen in-flight prompt lives in the ephemeral overlay (created by set_buffer_text_ignoring_undo), while a normal un-submitted draft lives in the regular buffer. enable_cloud_followup_input now clears only when the input is in the ephemeral loading state, preserving genuine drafts otherwise. Adds Editor/EditorModel::is_in_ephemeral_loading_state to expose that state. Co-Authored-By: Warp <agent@warp.dev>
The prior attempt still failed test_on_session_share_ended_clears_frozen_followup_input_for_owned_ambient_session because the conditional clear ran while the editor was still Selectable (the frozen loading state). EditorModel::edit only applies buffer edits when the editor is Editable, so the clear was a no-op. Reorder enable_cloud_followup_input to set the editor Editable BEFORE the (conditional) clear, matching how the buffer must be editable for clear_buffer to take effect. Also restore reset_after_cloud_followup_submission to a self-contained set-editable -> clear -> reset-colors sequence so the genuine post-submission clear is unaffected regardless of prior interaction state. Also apply canonical ./script/format formatting. Co-Authored-By: Warp <agent@warp.dev>
The ephemeral-loading discriminator was wrong: by the time enable_cloud_followup_input runs on session teardown, the frozen loading ephemeral has already been exited, so the frozen prompt text sits in the regular buffer (indistinguishable from a draft by the ephemeral flag) — leaving test_on_session_share_ended_clears_frozen_followup_input_for_owned_ambient_session still failing (buffer_text was "can you put it in a file", expected ""). Use the editor's interaction state instead: a frozen in-flight prompt leaves the editor Selectable, while a genuine un-submitted draft is Editable. Clear only when Selectable (frozen) and preserve otherwise. Removes the now-unused is_in_ephemeral_loading_state helpers added in the previous commit. Co-Authored-By: Warp <agent@warp.dev>
Description
While viewing a remote/cloud (ambient) agent session, any text typed into the agent input box was wiped the moment that session tore down.
Root cause: on teardown,
TerminalView::enable_cloud_followup_input(app/src/terminal/view/shared_session/view_impl.rs) reusedInput::reset_after_cloud_followup_submission(app/src/terminal/input.rs), which callseditor.clear_buffer_and_reset_undo_stack— that clear is only meant to run after an actual followup submission, but it was being reused just to enable the input.Fix: split the two concerns.
Input::enable_cloud_followup_input— enables the followup input (setsEditable+ resets/unfreezes text colors) without clearing the buffer. Used on the teardown/enable transition, so drafts survive.Input::reset_after_cloud_followup_submission— clears the buffer + undo stack, then callsenable_cloud_followup_input(the genuine post-submission reset). The real submission path (try_submit_pending_cloud_followup) is unchanged, so sending a followup still clears as before.Linked Issue
Reported in the factory-client triage thread (forwarded from Pei Li). No GitHub issue.
ready-to-specorready-to-implement.Testing
Added a regression test
test_enable_cloud_followup_input_preserves_typed_draft(app/src/terminal/view/shared_session/view_impl_tests.rs): types a draft into a viewed ambient session's input, ends the session viaon_ambient_agent_execution_ended, and asserts the buffer still equals the draft. It fails before the fix (buffer cleared) and passes after.Warning
Not yet verified locally — presubmit, the regression test, and the mandatory
computer_useUI check could NOT be run in the triage sandbox because it hits a hard memory limit compiling thewarpcrate (rustc is OOM-killed). Relying on CI to run./script/presubmit+ the new test on this branch, and requesting the reviewer confirm the UI behavior (view a running cloud/ambient session, type a draft, let it end/teardown → the draft should survive and the input should be editable in agent mode). Flagging rather than claiming verification that didn't happen../script/runAgent Mode