Skip to content

[fix](VA) Keep in-progress playwright-cli commands in computer-use recordings - #14544

Merged
vkodithala merged 3 commits into
masterfrom
va-keep-playwright-recordings
Jul 31, 2026
Merged

[fix](VA) Keep in-progress playwright-cli commands in computer-use recordings#14544
vkodithala merged 3 commits into
masterfrom
va-keep-playwright-recordings

Conversation

@vkodithala

@vkodithala vkodithala commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Description

On Linux, computer-use video recordings are smart-trimmed after stopping: only committed recording action groups produce keep-windows, and everything else is hard-cut. Shell commands never enter the recording timeline, so when the agent drives the browser via playwright-cli, all of that on-screen work was cut from the video.

This PR keeps in-progress playwright-cli commands in the recording:

  • ShellCommandExecutor now detects playwright-cli invocations (skipping leading env-var assignments and resolving the program path's file name, so npm install playwright-cli or echo playwright-cli don't match) and opens a recording action group before the command starts.
  • When the command finishes (any exit code), the pending group is committed; if the action is cancelled or the block is not found, it is discarded.
  • A playwright-cli command that outlives the executor's poll window returns a long-running snapshot; the group stays open and is committed when a later ReadShellCommandOutput poll observes the finished block. Since that poll runs in a separate executor call, a new RecordingController::commit_action_group_now helper commits the pending group using the recording's own elapsed clock (no-op when no recording is active or no group is pending).
  • If the recording is stopped/finalized while a group is still pending (e.g. a long-running playwright-cli session never observed finished), claiming the active recording for finalization settles the pending group at the stop point instead of dropping it, via a shared ActiveRecording::commit_pending_group_now helper also used by begin_action_group's auto-commit.

Other shell commands (npm/cargo/etc.) never open a group, so they remain trimmed exactly as before. Behavior is unchanged when no recording is active: all recording calls no-op unless a recording is Active for the conversation.

Linked Issue

None — recording-quality fix scoped and dispatched via Oz orchestration.

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Testing

  • Added a unit test for the playwright-cli command detector (detects_playwright_cli_commands) covering plain, env-prefixed, and absolute-path invocations plus non-matches (npm install playwright-cli, echo playwright-cli, cargo build).

  • Added a regression test (finalization_commits_open_pending_group) asserting that finalizing while a group is pending commits its window instead of dropping it.

  • cargo nextest run -p warp -E 'test(detects_playwright_cli_commands) or test(block_working_directory_updated_does_not_drain_finish_senders) or test(/recording_controller/)' — 17/17 passed.

  • ./script/format --check — clean.

  • cargo clippy --workspace --exclude warp_completer --all-targets --tests -- -D warnings, cargo clippy -p warp --all-targets --tests -- -D warnings, and cargo clippy -p warp_completer --all-targets --tests -- -D warnings — all green.

  • I have manually tested my changes locally with ./script/run

Runtime behavior only differs on Linux (macOS recordings keep everything, no smart cut), so this was verified on macOS via build + unit tests rather than a live recording.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-BUG-FIX: In-progress playwright-cli browser automation is now preserved in computer-use video recordings instead of being trimmed out.

Co-Authored-By: Oz oz-agent@warp.dev

Shell commands never enter the recording timeline, so browser automation
driven via playwright-cli was hard-cut from computer-use videos by the
post-stop smart trim. Open a recording action group when a playwright-cli
command starts and commit it when the command finishes (including via a
later ReadShellCommandOutput poll for long-running sessions), so that
on-screen work is kept. Other shell commands remain trimmed as before.

Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label Jul 30, 2026
@warp-for-oss

warp-for-oss Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

@vkodithala

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 /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@warp-for-oss warp-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR adds recording action groups around playwright-cli shell commands so Linux computer-use smart trimming can retain browser automation work, with a detector test and a helper to commit pending groups from later shell-output polling.

Concerns

  • Long-running playwright-cli commands that are still in progress when recording finalization runs remain only in pending_group, but finalization publishes only committed actions; this can still produce no artifact for a recording containing only that command, or trim the command window when earlier actions exist.
  • This is a user-facing recording-output change, but the PR description does not include a Linux recording or screen recording demonstrating the end-to-end behavior. Please attach a short recording showing a playwright-cli command preserved in the persisted computer-use video.

Verdict

Found: 0 critical, 2 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

Comment thread app/src/ai/blocklist/action_model/execute/shell_command.rs
A group left pending by a long-running playwright-cli command could reach
finalization without ever being committed, so its window was trimmed. Commit
any open pending group with the recording's current elapsed time when the
active recording is claimed for finalization, sharing the settle logic used
by begin_action_group's auto-commit and commit_action_group_now.

Co-Authored-By: Oz <oz-agent@warp.dev>
@vkodithala
vkodithala requested a review from danielpeng2 July 30, 2026 18:36
@vkodithala vkodithala changed the title Keep in-progress playwright-cli commands in computer-use recordings [fix](VA) Keep in-progress playwright-cli commands in computer-use recordings Jul 30, 2026

@danielpeng2 danielpeng2 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a couple non-blocking comments

Comment thread app/src/ai/blocklist/action_model/execute/shell_command.rs Outdated
// computer-use recording: open an action group before the command
// starts so the smart cut does not trim its on-screen work.
let conversation_id = input.conversation_id;
let is_playwright_cli = is_playwright_cli_command(command);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a now thing, but i wonder if we want to let the agent decide which actions should be visible in a recording. hardcoded detection of the playwright CLI seems fine, but if the agent ever uses any other command to control the desktop, that'd be missed.

one idea is to augment the run_command tool we provide to the agent with a is_meaningful_action parameter or something like that

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think this is a fair point. Probably OOS here but something we should consider.

Move the playwright-cli detection and the decision to open a recording
action group out of ShellCommandExecutor and into
RecordingController::maybe_begin_action_group, so the executor no longer
leaks a recording implementation detail.

Co-Authored-By: Oz <oz-agent@warp.dev>
@vkodithala
vkodithala merged commit 52061d2 into master Jul 31, 2026
27 checks passed
@vkodithala
vkodithala deleted the va-keep-playwright-recordings branch July 31, 2026 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants