fix(bedrock): drop ActionRequired and ToolConfirmationRequest blocks instead of sending blank text (#12843)
Some checks are pending
Live Provider Tests / check-fork (push) Waiting to run
Canary / Prepare Version (push) Waiting to run
Canary / build-cli-linux (push) Blocked by required conditions
Canary / Upload Install Script (push) Waiting to run
Canary / bundle-macos-arm64 (push) Blocked by required conditions
Canary / bundle-macos-x64 (push) Blocked by required conditions
Canary / bundle-windows (push) Blocked by required conditions
Canary / bundle-windows-cuda (push) Blocked by required conditions
Canary / Release (push) Blocked by required conditions
Unused Dependencies / machete (push) Waiting to run
CI / changes (push) Waiting to run
CI / goose ACP npm packages (push) Blocked by required conditions
CI / Check Rust Code Format (push) Blocked by required conditions
CI / Build and Test Rust Project (push) Blocked by required conditions
CI / Build Lean ACP Binary (push) Blocked by required conditions
CI / Check and Test GDK Agent Crates on wasm32 (push) Blocked by required conditions
CI / Check goose-sdk UniFFI (push) Blocked by required conditions
CI / Test Kotlin GDK package (push) Blocked by required conditions
CI / Build and Test TLS Backend (native-tls) (push) Blocked by required conditions
CI / Build and Test TLS Backend (rustls-tls) (push) Blocked by required conditions
CI / Build and Test Roaming Feature (push) Blocked by required conditions
CI / Build Rust Project on Windows (push) Waiting to run
CI / Check MSRV (push) Blocked by required conditions
CI / Lint Rust Code (push) Blocked by required conditions
CI / Check Generated Schemas are Up-to-Date (push) Blocked by required conditions
CI / Check GDK Release Configuration (push) Waiting to run
CI / Check GDK API Reference is Up-to-Date (push) Waiting to run
CI / Test and Lint Electron Desktop App (push) Blocked by required conditions
CI / Test Desktop Updater Install (ubuntu-latest) (push) Blocked by required conditions
CI / Test Desktop Updater Install (windows-latest) (push) Blocked by required conditions
MCP Conformance / Build Conformance Binaries (push) Waiting to run
MCP Conformance / Conformance 2025-11-25 / 0.1.16 (push) Blocked by required conditions
MCP Conformance / Conformance 2025-11-25 / 0.2.0-alpha.10 (push) Blocked by required conditions
MCP Conformance / Conformance 2026-07-28 / 0.2.0-alpha.10 (push) Blocked by required conditions
Create Minor Release PR / check-version-bump-pr (push) Waiting to run
Create Minor Release PR / release (push) Blocked by required conditions
Live Provider Tests / changes (push) Blocked by required conditions
Live Provider Tests / Build Binary (push) Blocked by required conditions
Live Provider Tests / Smoke Tests (push) Blocked by required conditions
Live Provider Tests / Smoke Tests (Code Execution) (push) Blocked by required conditions
Live Provider Tests / Compaction Tests (push) Blocked by required conditions
Publish Ask AI Bot Docker Image / docker (push) Waiting to run
Publish Docker Image / docker (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run

This commit is contained in:
Abhijay Jain 2026-10-18 08:01:18 +00:00 • committed by GitHub
parent bfcc6ee6f1
commit 34a222e3f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -165,6 +165,12 @@ pub fn to_bedrock_message_with_caching(
.content
.iter()
.filter(|content| {
if matches!(
content,
MessageContent::ActionRequired(_) | MessageContent::ToolConfirmationRequest(_)
) {
return false;
}
if !thinking_is_stale {
return true;
}
@ -196,11 +202,11 @@ pub fn to_bedrock_message_with_caching(
pub fn to_bedrock_message_content(content: &MessageContent) -> Result<bedrock::ContentBlock> {
Ok(match content {
MessageContent::Text(text) => bedrock::ContentBlock::Text(text.text.to_string()),
MessageContent::ToolConfirmationRequest(_tool_confirmation_request) => {
bedrock::ContentBlock::Text("".to_string())
MessageContent::ToolConfirmationRequest(_) => {
bail!("ToolConfirmationRequest should be filtered before Bedrock conversion")
}
MessageContent::ActionRequired(_action_required) => {
bedrock::ContentBlock::Text("".to_string())
MessageContent::ActionRequired(_) => {
bail!("ActionRequired should be filtered before Bedrock conversion")
}
MessageContent::Image(image) => {
bedrock::ContentBlock::Image(to_bedrock_image(&image.data, &image.mime_type)?)
@ -1666,4 +1672,42 @@ mod tests {
assert!(!bedrock_model_supports_temperature(&config));
assert_eq!(inference_config.temperature(), None);
}
#[test]
fn test_elicitation_message_becomes_empty() {
use crate::conversation::message::{ActionRequired, ActionRequiredData};
use rmcp::model::Role;
let elicitation_request = Message::new(
Role::Assistant,
Utc::now().timestamp(),
vec![MessageContent::ActionRequired(ActionRequired {
data: ActionRequiredData::Elicitation {
id: "elicit-1".to_string(),
message: "Choose something".to_string(),
requested_schema: serde_json::json!({}),
},
})],
);
let elicitation_response = Message::new(
Role::User,
Utc::now().timestamp(),
vec![MessageContent::ActionRequired(ActionRequired {
data: ActionRequiredData::ElicitationResponse {
id: "elicit-1".to_string(),
user_data: serde_json::json!({"choice": "yes"}),
action: rmcp::model::ElicitationAction::Accept,
},
})],
);
let request_result =
to_bedrock_message_with_caching(&elicitation_request, false, None).unwrap();
let response_result =
to_bedrock_message_with_caching(&elicitation_response, false, None).unwrap();
assert!(request_result.content().is_empty());
assert!(response_result.content().is_empty());
}
}