Repository navigation
Notify Warp and third-party agents when another run is waiting #16809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
warp-agent-staging
wants to merge
5
commits into
master
Choose a base branch
from
factory/orchestration-waited-on
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fc60527
Deliver waited-on lifecycle notifications to Warp and third-party agents
warp-agent-staging[bot] cb5b3fd
Use sender-relative waiting lifecycle protocol
warp-agent-staging[bot] 4a4ecb0
Pin orchestration protocol to its merged main commit
warp-agent-staging[bot] f2fa523
Normalize waiting lifecycle notifications to waiter identity
warp-agent-staging[bot] 4c32ce3
Preserve recipient-owned waited-on event semantics
warp-agent-staging[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
app/src/ai/agent_sdk/driver/harness/claude_code/parent_bridge_tests.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| use super::*; | ||
| use crate::server::server_api::ServerApiProvider; | ||
| use crate::server::server_api::ai::MockAIClient; | ||
|
|
||
| fn waited_on_event(run_id: &str, waiter: Option<&str>) -> AgentRunEvent { | ||
| serde_json::from_value(serde_json::json!({ | ||
| "event_type": "run_waited_on", | ||
| "run_id": run_id, | ||
| "ref_id": waiter, | ||
| "occurred_at": "2026-11-12T00:00:00Z", | ||
| "sequence": 42 | ||
| })) | ||
| .unwrap() | ||
| } | ||
|
|
||
| #[test] | ||
| fn waited_on_is_surfaced_read_only_without_mailbox_reads_or_acknowledgments() { | ||
| let server_api = ServerApiProvider::new_for_test().get(); | ||
| futures::executor::block_on(async move { | ||
| let state = tempfile::tempdir().unwrap(); | ||
| ensure_parent_bridge_state_dir(state.path()).unwrap(); | ||
| let mut consumer = MessageBridgeEventConsumer { | ||
| run_id: "root-run".to_string(), | ||
| state_dir: state.path().to_path_buf(), | ||
| server_api, | ||
| }; | ||
| consumer | ||
| .on_event(waited_on_event("root-run", Some("child-run"))) | ||
| .await | ||
| .unwrap(); | ||
| consumer | ||
| .on_event(waited_on_event("root-run", Some("child-run"))) | ||
| .await | ||
| .unwrap(); | ||
| let staged = | ||
| parent_bridge_message_records(&parent_bridge_staged_dir(state.path())).unwrap(); | ||
| assert_eq!(staged.len(), 1); | ||
| assert_eq!(staged[0].1.sender_run_id, "child-run"); | ||
| assert_eq!(staged[0].1.event_type.as_deref(), Some("run_waited_on")); | ||
|
|
||
| let mut client = MockAIClient::new(); | ||
| client.expect_read_agent_message().times(0); | ||
| client.expect_mark_message_delivered().times(0); | ||
| let hydrator = MessageHydrator::new(Arc::new(client) as Arc<dyn AIClient>); | ||
| prepare_parent_bridge_hook_output(&hydrator, state.path(), 6000) | ||
| .await | ||
| .unwrap(); | ||
| let output: MessageBridgeHookOutput = serde_json::from_slice( | ||
| &fs::read(parent_bridge_hook_output_file(state.path())).unwrap(), | ||
| ) | ||
| .unwrap(); | ||
| assert_eq!(output.surfaced_count, 1); | ||
| assert!( | ||
| output | ||
| .additional_context | ||
| .contains("Read-only lifecycle notification\n\nRun child-run is waiting for you") | ||
| ); | ||
| assert!( | ||
| !output | ||
| .additional_context | ||
| .contains("Lead agent mailbox message") | ||
| ); | ||
|
|
||
| fs::write(parent_bridge_hook_output_ack_file(state.path()), "").unwrap(); | ||
| acknowledge_parent_bridge_hook_output(&hydrator, state.path()) | ||
| .await | ||
| .unwrap(); | ||
| assert!( | ||
| parent_bridge_message_records(&parent_bridge_surfaced_dir(state.path())) | ||
| .unwrap() | ||
| .is_empty() | ||
| ); | ||
| assert!(!parent_bridge_hook_output_file(state.path()).exists()); | ||
| assert!(!parent_bridge_hook_output_ack_file(state.path()).exists()); | ||
| }); | ||
| } | ||
|
|
||
| #[test] | ||
| fn waited_on_for_another_run_or_without_waiter_is_not_staged() { | ||
| let server_api = ServerApiProvider::new_for_test().get(); | ||
| futures::executor::block_on(async move { | ||
| let state = tempfile::tempdir().unwrap(); | ||
| let mut consumer = MessageBridgeEventConsumer { | ||
| run_id: "self-run".to_string(), | ||
| state_dir: state.path().to_path_buf(), | ||
| server_api, | ||
| }; | ||
| consumer | ||
| .on_event(waited_on_event("other-run", Some("self-run"))) | ||
| .await | ||
| .unwrap(); | ||
| consumer | ||
| .on_event(waited_on_event("self-run", None)) | ||
| .await | ||
| .unwrap(); | ||
| consumer | ||
| .on_event(waited_on_event("self-run", Some(""))) | ||
| .await | ||
| .unwrap(); | ||
| assert!( | ||
| parent_bridge_message_records(&parent_bridge_staged_dir(state.path())) | ||
| .unwrap() | ||
| .is_empty() | ||
| ); | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.