Skip to content

Dragging a tab into a new window breaks its wakeup channel, causing input lag and elevated CPU #14387

Closed

Description

@bholmesdev

What happened

Dragging a tab out into its own window permanently breaks the terminal wakeup channel for that session. From the moment the drag starts, the PTY event loop keeps producing output but can no longer wake its receiver, and Warp begins logging Failed to send Wakeup event: Closed(..) on the hot PTY read path.

The user-visible symptoms after the drag-out:

  • Typed characters lag behind keystrokes
  • Pasted images take about a second to appear
  • Noticeably increased CPU and machine heat

None of this was happening before the drag. The tab in question was running Claude Code on an active task, so the PTY was producing output continuously, which appears to make the problem much more pronounced.

Expected behavior

Dragging a tab into a new window should be a transfer of ownership. The session's wakeup channel should be rewired to the new window's receiver, and rendering/input latency should be unchanged.

Steps to reproduce

  1. Start a long-running, output-heavy process in a tab. I used Claude Code working through a task; yes or a verbose build would likely work too.
  2. While it is actively streaming output, drag that tab out of the window and drop it to create a new window.
  3. Type into the new window, or paste an image.
  4. Observe input lag and elevated CPU. Watch the log for Failed to send Wakeup event: Closed(..).

Evidence from logs

The failures begin in the exact same second as the drag, and continue afterward. Condensed timeline:

02:01:44Z [INFO] [warpui_core::core::app] dispatching typed action: warp::workspace::action::WorkspaceAction::StartTabDrag
02:01:44Z [INFO] [warpui::platform::mac::window] Opening window with id 2
02:01:44Z [INFO] [warpui::platform::mac::window] Using discrete GPU for rendering new window.
02:01:44Z [INFO] [warp::terminal::local_tty::terminal_manager] Creating terminal model with 0 restored blocks
02:01:44Z [INFO] [warp::workspace::cross_window_tab_drag] tab_drag: begin_multi_tab_drag source_wid=0 preview_wid=2 source_tab_index=15
02:01:44Z [INFO] [warp::terminal::local_tty::unix] Starting shell /bin/zsh
02:01:44Z [INFO] [warp::terminal::local_tty::unix] Successfully spawned child zsh process with pid 81140
02:01:44Z [WARN] [warp::terminal::event_listener] Failed to send Wakeup event: Closed(..)   <-- starts here
02:01:45Z [INFO] [warp::workspace::cross_window_tab_drag] tab_drag: on_drop ENTER phase=Floating has_dedicated_preview=true drop_resolution_attempted_before=false
02:01:45Z [INFO] [warp::workspace::cross_window_tab_drag] tab_drag: finalize branch=Floating+dedicated_preview -> finalize_preview_as_new_window (CREATES NEW WINDOW) source_wid=0 preview_wid=2

The drag itself finalized cleanly via finalize_preview_as_new_window, so this is not a failed or aborted drag.

Volume: 1,315 Failed to send Wakeup event: Closed(..) warnings between 02:01:44Z and 02:06:43Z. Zero occurrences anywhere earlier in the log. The rate is bursty and correlates with terminal output, peaking around 50 per second:

  50  2026-07-28T02:01:57Z
  46  2026-07-28T02:01:54Z
  39  2026-07-28T02:02:06Z
  39  2026-07-28T02:01:55Z
  36  2026-07-28T02:01:58Z

Likely cause

ChannelEventListener::send_wakeup_event in app/src/terminal/event_listener.rs:40-44:

pub fn send_wakeup_event(&self) {
    if let Err(e) = self.wakeups_tx.try_send(()) {
        log::warn!("Failed to send Wakeup event: {e:?}");
    }
}

Closed(..) means the receiving half of wakeups_tx was dropped. Per the comment on the struct, this channel exists specifically so the throttled receiver can coalesce wakeups during high-throughput output. Two consequences follow, and I believe they map directly onto the two reported symptoms:

  1. Lag: with the wakeup receiver gone, nothing is driving the coalesced render/wake path for that terminal anymore, so output and input echo only get painted incidentally.
  2. CPU and heat: this is an unthrottled log::warn! on the per-PTY-read hot path. With an agent streaming output, that is tens of formatted log lines and disk writes per second, on top of an event loop still parsing ANSI for a model whose consumer is gone.

The teardown of the drag preview window (wid 2) looks like the point where the receiver is dropped without the surviving session's sender being rewired.

Secondary observations

These came out of the same investigation and may or may not be related. Flagging them rather than asserting they are bugs:

  • Drag preview spawns a real shell. begin_multi_tab_drag creates a terminal model and spawns an actual /bin/zsh (pid 81140) purely for the drag preview. A second one was spawned earlier in the same interaction (pid 80690). If these are throwaway, spawning real shells per drag is expensive.
  • Using discrete GPU for rendering new window on Apple Silicon. This machine is an M4 Pro with no discrete GPU, so this code path looks vestigial or misreported on ARM Macs.
  • 23 live PTY reader threads in the CPU sample. Most are correctly parked in kevent, so they are not the CPU hog, but the count seems high.

What I could not confirm

  • Whether the memory footprint is related. The sample shows a 4.3 GB physical footprint with a 5.1 GB peak, but this instance had been running for 7 days, so I would not attribute that to the drag.
  • The main thread was idle in nextEventMatchingMask during the sample, and no single thread showed a runaway spin. CPU was bursty (measured 32.5%, 20.7%, 6.7% across three consecutive samples) rather than pinned, which is consistent with output-correlated log spam rather than a tight infinite loop.

Environment

  • Warp version: v0.2026.07.11.08.41.00 (WarpDev / internal development build)
  • macOS 26.5.2 (25F84), Apple M4 Pro, ARM64
  • Process uptime at time of capture: launched 2026-07-20, so about 7 days

Attachments

Log excerpt and CPU sample are zipped at ~/Desktop/warp-tab-drag-perf.zip, containing:

  • timeline.log - filtered drag and wakeup events
  • warp_dev-drag-window.log - full log for the affected window
  • warpdev-cpu-sample.txt - sample(1) output captured while the issue was occurring

Activity

  1. added
    bug
    os:mac
    area:window-tabs-panes
    area:performance:cpu
    on Jul 28, 2026
  2. warp-for-oss commented on Jul 28, 2026

    @warp-for-oss
    Contributor

    @bholmesdev

    Here's what I found while triaging this issue:

    Thanks for the detailed logs — this looks actionable and distinct from existing tab-drag/CPU reports. The timing points to the tab detach/new-window transfer breaking the terminal redraw wakeup path, with output-heavy commands amplifying the lag and CPU/log churn.

    I have a few follow-up questions before I can narrow this down:

    1. Can you attach the referenced log/profile archive, or redacted copies of the timeline log and CPU sample, directly to this issue?
    2. Can you confirm whether a fresh Warp session using a simple output-heavy command such as yes reproduces the same lag after dragging the tab into a new window?

    Reply in-thread with those details and the triage workflow will automatically re-evaluate the issue and update the diagnosis, labels, and next steps.

    Maintainer details

    I concluded that dragging a running, output-heavy tab into a new window appears to leave the PTY event loop with a closed terminal wakeup receiver, causing redraw/input lag and hot-path wakeup warning spam..

    Triage summary

    This looks like a real cross-window tab-drag regression rather than a generic Claude Code or high-output performance report. The report provides concrete steps and a timestamped log sequence showing tab drag start, preview/new-window creation, then repeated Failed to send Wakeup event: Closed(..) warnings with no earlier occurrences.

    Reproduction assessment

    Reproducibility is high from the report: the trigger is specific (drag an actively outputting tab into a new window), the environment is identified, and the wakeup failures are tightly correlated with the drag lifecycle. Confirmation on a fresh/current build and with a simple output-heavy command would still help separate the core tab-transfer bug from long-running session or Claude Code-specific amplification.

    Likely root cause

    ChannelEventListener::send_wakeup_event sends terminal redraw wakeups into wakeups_tx; the receiver is consumed by TerminalView::new through a throttled stream that calls handle_terminal_wakeup. The local PTY event loop calls send_wakeup_event after processing PTY bytes, so a Closed(..) result means the event-loop/model side is still alive while the receiver side has been dropped.

    The relevant drag path creates a dedicated preview window for multi-tab drags, transfers the live pane-group/view tree into that window, and then promotes the preview to a permanent window on a floating drop. The most plausible root cause is that this transfer/promotion/source-cleanup lifecycle drops or detaches the TerminalView wakeup receiver while leaving the terminal model and PTY event loop sender alive. Under continuous output, that would both prevent normal coalesced redraw wakeups and emit warning logs on the PTY read hot path.

    Relevant files inspected:

    • app/src/workspace/cross_window_tab_drag.rs
    • app/src/workspace/view.rs
    • app/src/root_view.rs
    • app/src/terminal/event_listener.rs
    • app/src/terminal/local_tty/event_loop.rs
    • app/src/terminal/local_tty/terminal_manager.rs
    • app/src/terminal/view.rs
    • crates/warpui_core/src/core/app.rs

    Duplicate check

    I searched all open issues and recent closed issues. I found related tab-drag and performance reports, but not two matching duplicates for this specific wakeup-channel failure. #14346 is related to cross-window tab dragging, but its failure mode is wrong-tab removal when the source tab list changes mid-drag, not a closed terminal wakeup receiver after creating a new window.

    Question reasoning

    1. Can you attach the referenced log/profile archive, or redacted copies of the timeline log and CPU sample, directly to this issue? — The issue currently references a local Desktop path that maintainers cannot access; the full logs/profile would help verify the receiver-close sequence and thread behavior.
    2. Can you confirm whether a fresh Warp session using a simple output-heavy command such as yes reproduces the same lag after dragging the tab into a new window? — This isolates the tab-transfer bug from the 7-day process uptime and Claude Code-specific output pattern, and would further raise confidence in the minimal repro.

    This is my automated analysis and may be incorrect. A maintainer will verify the details.

    Powered by Oz

  3. added
    area:shell-terminal
    needs-info
    repro:high
    triaged
    on Jul 28, 2026
  4. bholmesdev commented on Jul 28, 2026

    @bholmesdev
    ContributorAuthor
  5. warp-for-oss commented on Jul 28, 2026

    @warp-for-oss
    Contributor

    @bholmesdev

    Here's what I found while triaging this issue:

    Thanks for the detailed logs and reproduction steps. This looks actionable without more reporter info: the wakeup failures begin during cross-window tab drag and are likely amplified by output-heavy terminal activity, which matches the lag and CPU symptoms.

    Maintainer details

    I concluded that dragging an output-heavy terminal tab into a new window appears to break or orphan the terminal wakeup path during cross-window tab-drag preview/adoption, causing repeated wakeup-send failures, input/render lag, and CPU overhead..

    Triage summary

    This is an actionable high-repro bug in the cross-window tab-drag path for live terminal sessions. The report's log timeline shows Failed to send Wakeup event: Closed(..) starting at the same timestamp as StartTabDrag / preview-window creation and continuing during output-heavy PTY activity, which matches the reported input/render lag and CPU overhead.

    Code-path notes

    • app/src/terminal/event_listener.rs logs every failed wakeups_tx.try_send(()) in ChannelEventListener::send_wakeup_event; a closed receiver on this path can become log spam under PTY output.
    • app/src/terminal/local_tty/event_loop.rs calls send_wakeup_event() after processing PTY bytes, so output-heavy commands or agents amplify the failure rate.
    • app/src/terminal/local_tty/terminal_manager.rs creates the wakeups_tx / wakeups_rx pair, passes the sender into the terminal model/event loop, and passes the receiver into the terminal surface.
    • app/src/terminal/view.rs consumes the receiver via a throttled spawn_stream_local(..., Self::handle_terminal_wakeup, ...), so dropping or orphaning that stream/receiver would produce the observed Closed send errors.
    • app/src/root_view.rs and app/src/workspace/view.rs show that multi-tab cross-window drag creates a transferred preview window using NewWorkspaceSource::TransferredTab; that source currently calls add_tab_with_pane_layout(Default::default()), creating a real placeholder terminal before adopt_transferred_pane_group swaps in the dragged pane group.
    • Workspace::adopt_transferred_pane_group detaches the placeholder pane group via detach_panes_for_close, which currently goes through detach_panes / DetachType::HiddenForClose; local TTY manager cleanup is primarily tied to manager drop, while on_view_detached only handles shared-session lifecycle. That makes a receiver-dropped / sender-still-live race plausible for the throwaway preview placeholder.
    • crates/warpui_core/src/core/app.rs documents that transfer_view_tree_to_window should preserve subscriptions via dynamic window lookup, so the likely first investigation target is the preview placeholder/adoption lifecycle, with transferred-view wakeup-stream ownership as a secondary check.

    Duplicate search

    I checked all open non-PR issues via the GitHub API and also recent closed issues from the last 7 days. Closest related issues include #14346 (different cross-window tab-drag corruption), #13975 (PTY reader lifecycle/leak), #9119 (dragging a window causing disk I/O lag), and #10626 (CPU/input lag in a VM), but none match both the tab-drag-to-new-window wakeup-channel failure and the output-correlated Closed(..) log spam. Fewer than two likely duplicates were found, so this should not be marked duplicate.

    Remaining ambiguity

    No reporter follow-up is required for initial routing. The main unresolved engineering question is whether the closed receiver belongs to the transferred live terminal or to the preview placeholder terminal; the extra shell spawned for the preview and the placeholder detach path make the latter a strong candidate.

    This is my automated analysis and may be incorrect. A maintainer will verify the details.

    Powered by Oz

  6. bholmesdev commented on Jul 28, 2026

    @bholmesdev
    ContributorAuthor

    Confirmed on Warp Stable

    I made this problem occur again on Warp Stable v0.2026.07.22.09.01.01. The behavior is the same as the development build in the initial report.

    Only a drag that creates a window causes the failures

    The stable log contains two drags. The two drags are 3 seconds apart. Only the second drag causes the failures.

    15:46:47  StartTabDrag -> begin_single_tab_drag (source window IS preview)
    15:46:49  finalize -> FocusSelf
              Result: 0 wakeup failures
    
    15:46:50  StartTabDrag -> begin_multi_tab_drag preview_wid=1
    15:46:50  Opening window with id 1
    15:46:51  finalize -> finalize_preview_as_new_window (CREATES NEW WINDOW)
    15:46:50  Failed to send Wakeup event: Closed(..)   <- the failures start here
    

    The first drag moved the tab in the same window. It did not create a window. It caused no failures.

    The second drag created a new window. It caused failures in the same second.

    This shows that the cause is in the finalize_preview_as_new_window path. A drag inside one window is safe.

    Quantity of failures

    There were 991 failures at the time of the capture. The quantity continued to increase. The rate was 17 failures in 6 seconds.

    The maximum rate was 48 failures in one second. The development build showed 50 failures in one second. The two builds are equivalent.

    Two corrections to the initial report

    1. The discrete GPU message is not related to the drag.

    The stable log shows the message Using discrete GPU for rendering new window for window id 0 at start. The message occurs for each new window. Do not use this message as evidence for this problem.

    2. The CPU load did not increase on the stable build.

    The stable process stayed near 0 percent. The failures continued at the same time.

    This result agrees with the log spam theory. The cost increases with the quantity of PTY output. My development session had an agent that made much output. My stable session had an idle shell.

    The stable log therefore confirms the mechanism. It does not confirm the performance effect. To measure the performance effect, run an agent or a command that makes much output before you drag the tab.

    Log file

    The stable log warp.log is attached. The relevant period is 15:46:47Z to 15:47:40Z.

  7. warp-for-oss commented on Jul 28, 2026

    @warp-for-oss
    Contributor

    @bholmesdev

    Here's what I found while triaging this issue:

    Confirmed on Stable and narrowed to dragging a tab from a multi-tab window out into a new window; same-window tab dragging is not implicated. The current code path creates a temporary preview window with a placeholder terminal before adopting the moved tab, so this looks actionable in the tab-transfer/preview-window lifecycle.

    Maintainer details

    I concluded that dragging a tab from a multi-tab window into a new window reproducibly causes wakeup-channel failures on the preview/new-window transfer path, with performance impact when the affected PTY is output-heavy..

    Triage summary

    The trusted follow-up confirms this on Stable and narrows the trigger to the multi-tab drag path that creates a new window. A same-window tab drag did not produce wakeup failures, while the begin_multi_tab_drag / finalize_preview_as_new_window path did.

    Reproduction assessment

    Reproducibility is high: the issue has exact steps, timestamp-correlated logs, and confirmation on both the original development build and Stable v0.2026.07.22.09.01.01. The performance/CPU impact appears proportional to PTY output volume, so an idle shell may reproduce the wakeup failures without reproducing high CPU.

    Likely technical cause

    The code supports a likely failure mode in the dedicated preview-window path rather than a generic terminal input issue:

    • app/src/workspace/view.rs starts cross-window handling from Workspace::on_tab_drag; for multi-tab sources it calls create_transferred_window(...) and then CrossWindowTabDrag::begin_multi_tab_drag.
    • app/src/root_view.rs creates the preview via NewWorkspaceSource::TransferredTab, transfers the real pane group with ctx.transfer_view_tree_to_window(...), then calls Workspace::adopt_transferred_pane_group.
    • Workspace::configure handles NewWorkspaceSource::TransferredTab by first calling add_tab_with_pane_layout(Default::default(), ...), which creates a placeholder/default terminal before the real pane group is adopted.
    • Workspace::adopt_transferred_pane_group swaps the real pane group into the placeholder tab and calls placeholder_pane_group.detach_panes_for_close(...); that goes through PaneGroup::detach_panes with DetachType::HiddenForClose.
    • TerminalManager::on_view_detached is documented to preserve non-Closed detaches, and the local GUI implementation only overrides it for shared-session cleanup. on_shell_determined also only checks whether the window is still open before spawning the shell.
    • ChannelEventListener::send_wakeup_event logs Failed to send Wakeup event: Closed(..) when the receiver side of the wakeup channel has been dropped.

    This points to the placeholder terminal created for the drag preview as a plausible source of the closed wakeup channel/log spam, especially because the report's logs show a new shell spawning at preview creation. Implementation should verify whether the fix is to avoid creating a real terminal for TransferredTab placeholders, or to force-close the placeholder terminal with a permanent detach/shutdown before or during adoption. It should also verify whether the real moved session's wakeup receiver is affected, since the reporter observed visible input lag in the promoted window.

    Duplicate check

    I enumerated all open non-PR issues in warpdotdev/warp and checked recently closed issues from the last 7 days. No issue matched the same wakeup-channel/new-window tab-drag signature closely enough to mark this as a duplicate.

    This is my automated analysis and may be incorrect. A maintainer will verify the details.

    Powered by Oz

  8. added
    area:performance
    area:terminal-input
    and removed
    needs-info
    on Jul 28, 2026
  9. added
    ready-to-implement
    on Jul 28, 2026
  10. warp-for-oss commented on Jul 28, 2026

    @warp-for-oss
    Contributor

    This issue has been labeled ready-to-implement and is open for contributions involving code changes. If you'd like to tackle it, feel free to open a pull request against this issue. You can also comment @oz-agent on this issue to have the bot draft an implementation PR automatically.

  11. warp-agent-staging commented on Jul 28, 2026

    @warp-agent-staging
    Contributor

    Your GitHub account is not connected to Warp. Connect it here.

  12. bholmesdev commented on Jul 28, 2026

    @bholmesdev
    ContributorAuthor

    @oz-agent implement this

  13. warp-agent-staging commented on Jul 28, 2026

    @warp-agent-staging
    Contributor

    Your GitHub account is not connected to Warp. Connect it here.

  14. warp-for-oss commented on Jul 28, 2026

    @warp-for-oss
    Contributor

    @bholmesdev

    I'm implementing this issue with no spec context.

    You can view the conversation on Warp.

    I created a new draft implementation PR for this issue.

    Next steps:

    • Review the implementation changes in the PR.
    • Complete any manual verification needed for this issue before merging.

    Powered by Oz

  15. added a commit that references this issue on Jul 31, 2026
    80a4e46
  16. added a commit that references this issue on Aug 30, 2026
    a35f0c2
  17. added a commit that references this issue on Nov 16, 2026
    720aa6e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:performancearea:performance:cpuarea:shell-terminalarea:terminal-inputarea:window-tabs-panesbugos:macready-to-implementrepro:hightriagedwarp:auto-triage-review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions