Fix CLI subagent interactions for oz agents#12384
Conversation
|
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 keeps LRC user takeover from marking the conversation/task as cancelled and adds block-scoped LRC interaction updates for shared sessions. I did not find approved spec context for this PR; the security pass did not identify separate security issues.
Concerns
- The code now imports and populates
LongRunningCommandAgentInteraction, but the PR diff does not update thesession-sharing-protocoldependency/Cargo lockfile to a revision that provides that type and the new universal context fields. Unless master has already been updated separately, this will fail to compile.
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
|
/oz-review |
|
I'm re-reviewing this pull request in response to a review 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 updates CLI subagent cancellation semantics, adds block-scoped long-running-command interaction state to shared-session context updates, and suppresses remote update echoes for viewer event replay. The protocol update and visual evidence are present, and I did not find security-specific issues in the changed lines.
Concerns
- CLISubagentUserTakeover can still fall through to
send_follow_up_for_conversationwhen the drained action phase contains any other completed result that triggers a follow-up, which contradicts the intended wait-until-command-finish/control-hand-back behavior. - The new block-scoped LRC interaction is added to sharer initial context, but viewer join handling does not apply that field from
universal_developer_input_context, so late-joining viewers can still initialize with stale interaction state until another update occurs.
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
| .any(|result| result.result.should_trigger_request_upon_completion())) | ||
| || has_manual_follow_up; | ||
| if !should_trigger_follow_up_request { | ||
| if should_preserve_in_progress_status { |
There was a problem hiding this comment.
CLISubagentUserTakeover still falls through to send_follow_up_for_conversation, so the agent resumes immediately instead of waiting for the command to finish or control to be handed back. Skip auto-follow-up for is_cli_subagent_user_takeover() before this trigger path.
| auto_approve_agent_actions: Some(auto_approve_agent_actions), | ||
| selected_model: None, | ||
| long_running_command_agent_interaction_state, | ||
| long_running_command_agent_interaction, |
There was a problem hiding this comment.
NetworkEvent::JoinedSuccessfully; only later UniversalDeveloperInputContextUpdated events read long_running_command_agent_interaction. Late-joining viewers can still start with stale control/tagged-in state until another state change is broadcast, so apply this initial field during join under the remote update guard too.
Description
Was investigating sources of ambient agent tasks becoming canceled by user automatically: https://linear.app/warpdotdev/issue/REMOTE-1887/maa-requests-getting-canceled#comment-75459dec
It can happen when we receive a NotInteracting LRC state, which is interpreted as user takeover of a CLI subagent monitored requested command. This is meant to cancel the conversation stream because the agent is no longer monitoring, but it also set the conversation status to canceled, which updates the ambient agent state to canceled by user.
But I also see the sharer receiving NotInteracting from the viewer when not expected. I believe there may be stale updates from the viewer causing this. We definitely should have LRC state updates apply to a specific block so we can discard stale updates.
And finally, some bugs with cloud mode were causing echoes of LRC state updates. The problematic flow was:
So this is a combination of 3 fixes:
Requires protocol change to be merged first, before updating cargo.toml: warpdotdev/session-sharing-protocol#27
Testing
./script/runScreenshots / Videos
Tested with warpdotdev/session-sharing-protocol#27
https://www.loom.com/share/f09e7b1d7e35412a99a7c2947104a460