diff --git a/src-tauri/src/acp/connection.rs b/src-tauri/src/acp/connection.rs index 70fb0bb6d3..0a1219f8d5 100644 --- a/src-tauri/src/acp/connection.rs +++ b/src-tauri/src/acp/connection.rs @@ -10718,9 +10718,16 @@ async fn try_bridge_antigravity_ask( req: &RequestPermissionRequest, responder: Responder, ) -> Result<(), Responder> { + // Gated on Antigravity's own interaction id fingerprint rather than + // AgentType::Antigravity: interaction_ is minted uniquely by + // antigravity-acp, and this ensures custom agents running Antigravity (e.g. + // custom:antigravity-b) also bridge into interactive question cards (#1024). let tool_call_id = req.tool_call.tool_call_id.to_string(); if !crate::acp::question::is_antigravity_interaction_id(&tool_call_id) - || state.read().await.agent_type != AgentType::Antigravity + || !matches!( + state.read().await.agent_type, + AgentType::Antigravity | AgentType::Custom(_) + ) { return Err(responder); } @@ -20872,7 +20879,7 @@ async fn take_antigravity_answered_close( state: &Arc>, tool_call_id: &str, ) -> bool { - agent_type == AgentType::Antigravity + matches!(agent_type, AgentType::Antigravity | AgentType::Custom(_)) && crate::acp::question::is_antigravity_interaction_id(tool_call_id) && state .write() @@ -50510,6 +50517,8 @@ mod tests { for (agent_type, enabled, decline, bridged) in [ (AgentType::Antigravity, true, false, true), (AgentType::Antigravity, true, true, true), + // Custom agents running Antigravity (e.g. custom:antigravity-b) are bridged too. + (AgentType::Custom("antigravity-b"), true, false, true), // The ask feature's kill switch keeps the approval card, as it does // for every other native ask bridge. (AgentType::Antigravity, false, false, false), @@ -50703,6 +50712,12 @@ mod tests { ("failed", "Interaction cancelled"), 2, ), + ( + AgentType::Custom("antigravity-b"), + Some(&answered), + ("completed", "Response received"), + 2, + ), ( AgentType::Codex, Some(&answered), @@ -50776,7 +50791,7 @@ mod tests { other => panic!("unexpected output {other:?} ({case})"), }; match (agent_type, card) { - (AgentType::Antigravity, Some(outcome)) => { + (AgentType::Antigravity | AgentType::Custom(_), Some(outcome)) => { let expected = crate::acp::question::grok_result_card_output(outcome); assert_eq!(output, expected.to_string(), "{case}"); assert_eq!(call.label, "ask_user_question", "{case}"); @@ -50790,7 +50805,7 @@ mod tests { _ => assert!(output.contains("Response received"), "{output}"), } // Each record is consumed by the frame it was waiting for. - if agent_type == AgentType::Antigravity { + if matches!(agent_type, AgentType::Antigravity | AgentType::Custom(_)) { assert!(guard.antigravity_answered_interactions.is_empty(), "{case}"); } } @@ -51869,4 +51884,4 @@ mod trae_handshake_tests { ); } } -} +} \ No newline at end of file