From 2b86286e537ad0765e467da6d1d5946e0e021a29 Mon Sep 17 00:00:00 2001 From: Jonathan Mohrbacher Date: Sun, 22 Nov 2026 00:04:51 -0500 Subject: [PATCH 1/2] [NO-JIRA] session/prompt _meta.goose.messageId and truncate_from_message for honk /undo (R21) Port of fork #14 onto v1.60.2. A client can choose the id goose stores a prompt's user message under (_meta.goose.messageId on session/prompt) and later delete history from that message onward with _goose/unstable/session/conversation/truncate_from_message {sessionId, messageId} -> {found}. The boundary is the message's row, so a message stored in the same second before it survives (the timestamp-based truncate deletes it). Refused while the session has an active run or live voice interaction. Truncation clears the session's current-context usage, which described the removed rows; accumulated totals stay. goose advertises agentCapabilities._meta.goose.truncateFromMessage. The 1.54 hint-requeue half is not needed: 1.60 rebuilds subdirectory hints from the conversation every turn. X-Shepherd-Wake: johnnymo87/goose#27 --- .github/workflows/patched-test.yml | 9 +- crates/goose-sdk-types/src/custom_requests.rs | 24 +++- crates/goose/acp-meta.json | 5 + crates/goose/acp-schema.json | 49 +++++++ crates/goose/src/acp/server.rs | 13 +- .../goose/src/acp/server/custom_dispatch.rs | 11 +- .../src/acp/server/truncate_from_message.rs | 131 ++++++++++++++++++ crates/goose/src/session/session_manager.rs | 40 +++++- crates/goose/tests/acp_server_test.rs | 89 +++++++++++- 9 files changed, 358 insertions(+), 13 deletions(-) create mode 100644 crates/goose/src/acp/server/truncate_from_message.rs diff --git a/.github/workflows/patched-test.yml b/.github/workflows/patched-test.yml index 7a6569011c30..41a912999538 100644 --- a/.github/workflows/patched-test.yml +++ b/.github/workflows/patched-test.yml @@ -126,12 +126,17 @@ jobs: "agents::platform_extensions::summon::subagent_policy::tests::subagent_policy_strict_start_accepts_extensions_that_start" \ "agents::platform_extensions::summon::subagent_policy::tests::subagent_policy_strict_start_fails_on_an_extension_that_does_not_start" \ "agents::platform_extensions::summon::subagent_policy::tests::subagent_policy_delegate_fails_when_its_extension_does_not_start" \ - "agents::platform_extensions::summon::subagent_policy::tests::subagent_policy_delegate_without_policy_runs_on_after_a_failed_extension" + "agents::platform_extensions::summon::subagent_policy::tests::subagent_policy_delegate_without_policy_runs_on_after_a_failed_extension" \ + "acp::server::truncate_from_message::tests::message_id_from_meta_reads_goose_message_id" \ + "acp::server::truncate_from_message::tests::message_id_from_meta_rejects_empty_or_non_string" \ + "acp::server::truncate_from_message::tests::agent_capabilities_advertise_truncate_from_message" \ + "session::session_manager::tests::test_truncate_conversation_from_message_keeps_same_second_previous_rows" run_exact_tests --release -p goose --features "$F" --test acp_server_test -- \ "test_prompt_reports_context_error_when_compaction_limit_is_exhausted" \ "test_prompt_fails_and_streams_the_error" \ - "test_manual_compaction_refusal_fails_without_replacing_context" + "test_manual_compaction_refusal_fails_without_replacing_context" \ + "test_prompt_message_id_and_truncate_from_message" run_exact_tests --release -p goose --features "$F" --test acp_session_settings_test -- \ "test_session_settings_set_rejects_invalid_input" \ diff --git a/crates/goose-sdk-types/src/custom_requests.rs b/crates/goose-sdk-types/src/custom_requests.rs index 5c05c808956a..c44ccd4fcaea 100644 --- a/crates/goose-sdk-types/src/custom_requests.rs +++ b/crates/goose-sdk-types/src/custom_requests.rs @@ -1,4 +1,4 @@ -// Modified by Jonathan Mohrbacher, 2026: register the session_settings custom request module. +// Modified by Jonathan Mohrbacher, 2026: register the session_settings custom request module; TruncateSessionConversationFromMessageRequest. use agent_client_protocol::schema::v1::{ AvailableCommand, ContentBlock, McpServer, Meta, SessionInfo, }; @@ -857,6 +857,28 @@ pub struct TruncateSessionConversationRequest { pub truncate_from: i64, } +/// Truncate a session conversation from the message with the given id onward +/// (that message included). The boundary is the message's row, so messages +/// stored in the same second before it are kept. Refused while the session has +/// an active run. +#[derive(Debug, Default, Clone, Serialize, Deserialize, JsonSchema, JsonRpcRequest)] +#[request( + method = "_goose/unstable/session/conversation/truncate_from_message", + response = TruncateSessionConversationFromMessageResponse +)] +#[serde(rename_all = "camelCase")] +pub struct TruncateSessionConversationFromMessageRequest { + pub session_id: String, + pub message_id: String, +} + +#[derive(Debug, Default, Clone, Serialize, Deserialize, JsonSchema, JsonRpcResponse)] +#[serde(rename_all = "camelCase")] +pub struct TruncateSessionConversationFromMessageResponse { + /// False when no message with that id exists in the session (nothing was removed). + pub found: bool, +} + /// Update the project association for a session. #[derive(Debug, Default, Clone, Serialize, Deserialize, JsonSchema, JsonRpcRequest)] #[request(method = "_goose/unstable/session/project/update", response = EmptyResponse)] diff --git a/crates/goose/acp-meta.json b/crates/goose/acp-meta.json index 2c9ee62443f1..853403e9b15f 100644 --- a/crates/goose/acp-meta.json +++ b/crates/goose/acp-meta.json @@ -410,6 +410,11 @@ "requestType": "TruncateSessionConversationRequest_unstable", "responseType": "EmptyResponse" }, + { + "method": "_goose/unstable/session/conversation/truncate_from_message", + "requestType": "TruncateSessionConversationFromMessageRequest_unstable", + "responseType": "TruncateSessionConversationFromMessageResponse_unstable" + }, { "method": "_goose/unstable/session/project/update", "requestType": "UpdateSessionProjectRequest_unstable", diff --git a/crates/goose/acp-schema.json b/crates/goose/acp-schema.json index 9dc433cad052..eca2ed98f6da 100644 --- a/crates/goose/acp-schema.json +++ b/crates/goose/acp-schema.json @@ -5127,6 +5127,38 @@ "x-side": "agent", "x-method": "_goose/unstable/session/conversation/truncate" }, + "TruncateSessionConversationFromMessageRequest_unstable": { + "type": "object", + "properties": { + "sessionId": { + "type": "string" + }, + "messageId": { + "type": "string" + } + }, + "required": [ + "sessionId", + "messageId" + ], + "description": "Truncate a session conversation from the message with the given id onward\n(that message included). The boundary is the message's row, so messages\nstored in the same second before it are kept. Refused while the session has\nan active run.", + "x-side": "agent", + "x-method": "_goose/unstable/session/conversation/truncate_from_message" + }, + "TruncateSessionConversationFromMessageResponse_unstable": { + "type": "object", + "properties": { + "found": { + "type": "boolean", + "description": "False when no message with that id exists in the session (nothing was removed)." + } + }, + "required": [ + "found" + ], + "x-side": "agent", + "x-method": "_goose/unstable/session/conversation/truncate_from_message" + }, "UpdateSessionProjectRequest_unstable": { "type": "object", "properties": { @@ -8000,6 +8032,15 @@ "description": "Params for _goose/unstable/session/conversation/truncate", "title": "TruncateSessionConversationRequest_unstable" }, + { + "allOf": [ + { + "$ref": "#/$defs/TruncateSessionConversationFromMessageRequest_unstable" + } + ], + "description": "Params for _goose/unstable/session/conversation/truncate_from_message", + "title": "TruncateSessionConversationFromMessageRequest_unstable" + }, { "allOf": [ { @@ -8764,6 +8805,14 @@ ], "title": "GetSessionInfoResponse_unstable" }, + { + "allOf": [ + { + "$ref": "#/$defs/TruncateSessionConversationFromMessageResponse_unstable" + } + ], + "title": "TruncateSessionConversationFromMessageResponse_unstable" + }, { "allOf": [ { diff --git a/crates/goose/src/acp/server.rs b/crates/goose/src/acp/server.rs index bca77f680e26..f2ba5fa3d46a 100644 --- a/crates/goose/src/acp/server.rs +++ b/crates/goose/src/acp/server.rs @@ -1,4 +1,4 @@ -// Modified by Jonathan Mohrbacher, 2026: session/prompt turn_failed errors carry data.kind and data.message; register session_settings (settings/set) and honour session/prompt _meta.goose.maxTurns. +// Modified by Jonathan Mohrbacher, 2026: session/prompt turn_failed errors carry data.kind and data.message; register session_settings (settings/set) and honour session/prompt _meta.goose.maxTurns; session/prompt _meta.goose.messageId sets the stored user message id; advertise truncateFromMessage. use crate::acp::custom_notifications::*; use crate::acp::custom_requests::*; pub(super) use crate::acp::response_builder::{ @@ -129,6 +129,7 @@ mod sources; mod tool_calls; mod tool_notifications; mod tools; +mod truncate_from_message; pub type AcpProviderFactory = Arc BoxFuture<'static, Result>> + Send + Sync>; @@ -409,6 +410,10 @@ fn meta_tags(meta: Option<&Meta>) -> Result, agent_client_ fn agent_capabilities_meta() -> Option { let mut goose = serde_json::Map::new(); goose.insert("recipeParameterScopes".to_string(), serde_json::json!({})); + goose.insert( + truncate_from_message::TRUNCATE_FROM_MESSAGE_CAPABILITY.to_string(), + serde_json::json!(true), + ); if cfg!(feature = "local-inference") { goose.insert("localInference".to_string(), serde_json::json!({})); } @@ -2244,6 +2249,7 @@ impl AcpConnection { args: PromptRequest, ) -> Result { let max_turns = session_settings::max_turns_from_meta(args.meta.as_ref())?; + let message_id = truncate_from_message::message_id_from_meta(args.meta.as_ref())?; // The ACP session_id IS the thread ID. let session_id = args.session_id.0.to_string(); @@ -2284,7 +2290,10 @@ impl AcpConnection { return Err(error); } - let user_message = Self::convert_acp_prompt_to_message(&args.prompt); + let mut user_message = Self::convert_acp_prompt_to_message(&args.prompt); + if let Some(message_id) = message_id { + user_message = user_message.with_id(message_id); + } // The client's trace context must stay attached while the turn's spans and tool calls are polled. #[cfg(feature = "otel")] let trace_cx = crate::otel::trace_context::extract_from_meta(args.meta.as_ref()) diff --git a/crates/goose/src/acp/server/custom_dispatch.rs b/crates/goose/src/acp/server/custom_dispatch.rs index 93787aad7287..1a461dabba9f 100644 --- a/crates/goose/src/acp/server/custom_dispatch.rs +++ b/crates/goose/src/acp/server/custom_dispatch.rs @@ -1,4 +1,4 @@ -// Modified by Jonathan Mohrbacher, 2026: dispatch _goose/unstable/session/settings/set. +// Modified by Jonathan Mohrbacher, 2026: dispatch _goose/unstable/session/settings/set; dispatch truncate_from_message. use super::*; use goose_acp_macros::custom_methods; @@ -687,6 +687,15 @@ impl AcpConnection { self.on_truncate_session_conversation(req).await } + #[custom_method(TruncateSessionConversationFromMessageRequest)] + async fn dispatch_truncate_session_conversation_from_message( + &self, + req: TruncateSessionConversationFromMessageRequest, + ) -> Result { + self.on_truncate_session_conversation_from_message(req) + .await + } + #[custom_method(UpdateSessionProjectRequest)] async fn dispatch_update_session_project( &self, diff --git a/crates/goose/src/acp/server/truncate_from_message.rs b/crates/goose/src/acp/server/truncate_from_message.rs new file mode 100644 index 000000000000..e1ef5b0b9811 --- /dev/null +++ b/crates/goose/src/acp/server/truncate_from_message.rs @@ -0,0 +1,131 @@ +// Modified by Jonathan Mohrbacher, 2026: client-chosen prompt message ids and truncate_from_message (honk /undo). +//! A client can choose the id goose stores a prompt's user message under +//! (`_meta.goose.messageId` on `session/prompt`) and later delete history from that +//! message onward with `_goose/unstable/session/conversation/truncate_from_message`. +//! Upstream's truncate cuts by timestamp, which also deletes a message stored in the +//! same second before the boundary. + +use super::*; + +pub(super) const TRUNCATE_FROM_MESSAGE_CAPABILITY: &str = "truncateFromMessage"; + +/// The caller owns uniqueness; truncation cuts from the first row with the id. +pub(super) fn message_id_from_meta( + meta: Option<&Meta>, +) -> Result, agent_client_protocol::Error> { + let Some(value) = meta + .and_then(|meta| meta.get("goose")) + .and_then(|goose| goose.get("messageId")) + else { + return Ok(None); + }; + if value.is_null() { + return Ok(None); + } + match value.as_str().map(str::trim) { + Some(id) if !id.is_empty() => Ok(Some(id.to_string())), + _ => Err(agent_client_protocol::Error::invalid_params() + .data("_meta.goose.messageId must be a non-empty string")), + } +} + +impl AcpConnection { + pub(super) async fn on_truncate_session_conversation_from_message( + &self, + req: TruncateSessionConversationFromMessageRequest, + ) -> Result { + let session_id = req.session_id.trim(); + if session_id.is_empty() { + return Err( + agent_client_protocol::Error::invalid_params().data("sessionId cannot be empty") + ); + } + let message_id = req.message_id.trim(); + if message_id.is_empty() { + return Err( + agent_client_protocol::Error::invalid_params().data("messageId cannot be empty") + ); + } + // A running turn (or a live voice interaction, which writes messages) would write + // its tail after the cut. The check is not atomic with a prompt arriving next; + // callers that need that (honkd) serialize prompts and truncation themselves. + if self.runs().is_active(session_id) { + return Err(agent_client_protocol::Error::invalid_request().data(format!( + "session {session_id} has an active run or live voice interaction; truncate after it ends" + ))); + } + + self.services + .session_manager + .get_session(session_id, false) + .await + .map_err(|_| { + agent_client_protocol::Error::resource_not_found(Some(session_id.to_string())) + .data(format!("Session not found: {session_id}")) + })?; + let found = self + .services + .session_manager + .truncate_conversation_from_message(session_id, message_id) + .await + .internal_err()?; + Ok(TruncateSessionConversationFromMessageResponse { found }) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn meta(value: serde_json::Value) -> Meta { + serde_json::from_value(value).unwrap() + } + + #[test] + fn message_id_from_meta_reads_goose_message_id() { + assert_eq!(message_id_from_meta(None).unwrap(), None); + for absent in [ + serde_json::json!({ "other": 1 }), + serde_json::json!({ "goose": {} }), + serde_json::json!({ "goose": { "messageId": null } }), + ] { + assert_eq!(message_id_from_meta(Some(&meta(absent))).unwrap(), None); + } + assert_eq!( + message_id_from_meta(Some(&meta( + serde_json::json!({ "goose": { "messageId": " msg_honk_1 " } }) + ))) + .unwrap() + .as_deref(), + Some("msg_honk_1") + ); + } + + #[test] + fn message_id_from_meta_rejects_empty_or_non_string() { + for bad in [ + serde_json::json!(""), + serde_json::json!(" "), + serde_json::json!(7), + ] { + let error = message_id_from_meta(Some(&meta( + serde_json::json!({ "goose": { "messageId": bad } }), + ))) + .unwrap_err(); + assert_eq!( + error.code, + agent_client_protocol::schema::v1::ErrorCode::InvalidParams + ); + } + } + + #[test] + fn agent_capabilities_advertise_truncate_from_message() { + assert_eq!( + agent_capabilities_meta() + .and_then(|meta| meta.get("goose").cloned()) + .and_then(|goose| goose.get(TRUNCATE_FROM_MESSAGE_CAPABILITY).cloned()), + Some(serde_json::json!(true)) + ); + } +} diff --git a/crates/goose/src/session/session_manager.rs b/crates/goose/src/session/session_manager.rs index eb51927e981e..c1cd2430aaf6 100644 --- a/crates/goose/src/session/session_manager.rs +++ b/crates/goose/src/session/session_manager.rs @@ -1,4 +1,4 @@ -// Modified by Jonathan Mohrbacher, 2026: register parent links for provider headers. +// Modified by Jonathan Mohrbacher, 2026: register parent links for provider headers; truncate_conversation_from_message reports whether the message was found and clears stale context usage. use crate::agents::Container; use crate::config::paths::Paths; use crate::config::ExtensionConfig; @@ -644,11 +644,13 @@ impl SessionManager { .await } + /// Deletes the message with `message_id` and every later message. Returns false (and + /// deletes nothing) when the session has no message with that id. pub async fn truncate_conversation_from_message( &self, session_id: &str, message_id: &str, - ) -> Result<()> { + ) -> Result { self.storage .truncate_conversation_from_message(session_id, message_id) .await @@ -3052,7 +3054,7 @@ impl SessionStorage { &self, session_id: &str, message_id: &str, - ) -> Result<()> { + ) -> Result { let pool = self.pool().await?; let mut tx = pool.begin_with("BEGIN IMMEDIATE").await?; @@ -3074,10 +3076,20 @@ impl SessionStorage { .bind(boundary_id) .execute(&mut *tx) .await?; + + // The session's current usage describes the last provider call, whose context + // included the rows just removed; auto-compaction would act on it. Accumulated + // totals are spend and stay. + sqlx::query( + "UPDATE sessions SET input_tokens = NULL, output_tokens = NULL, total_tokens = NULL, cache_read_tokens = NULL, cache_write_tokens = NULL WHERE id = ?", + ) + .bind(session_id) + .execute(&mut *tx) + .await?; } tx.commit().await?; - Ok(()) + Ok(boundary.is_some()) } async fn search_chat_history( @@ -3810,15 +3822,33 @@ mod tests { .unwrap(); set_message_timestamp(&sm, &session.id, "next-prompt", timestamp).await; - sm.truncate_conversation_from_message(&session.id, "terminal-history") + sm.update(&session.id) + .usage(Usage::new(Some(900), Some(100), Some(1000))) + .accumulated_usage(Usage::new(Some(9000), Some(1000), Some(10000))) + .apply() .await .unwrap(); + assert!(!sm + .truncate_conversation_from_message(&session.id, "no-such-message") + .await + .unwrap()); + let untouched = sm.get_session(&session.id, false).await.unwrap(); + assert_eq!(untouched.usage.total_tokens, Some(1000)); + + assert!(sm + .truncate_conversation_from_message(&session.id, "terminal-history") + .await + .unwrap()); + let reloaded = sm.get_session(&session.id, true).await.unwrap(); let messages = reloaded.conversation.unwrap().messages().to_vec(); assert_eq!(messages.len(), 1); assert_eq!(messages[0].id.as_deref(), Some("assistant")); assert_eq!(messages[0].as_concat_text(), "assistant reply"); + assert_eq!(reloaded.usage.total_tokens, None); + assert_eq!(reloaded.usage.input_tokens, None); + assert_eq!(reloaded.accumulated_usage.total_tokens, Some(10000)); } #[tokio::test] diff --git a/crates/goose/tests/acp_server_test.rs b/crates/goose/tests/acp_server_test.rs index 1f9d5b696c6a..09552a66664d 100644 --- a/crates/goose/tests/acp_server_test.rs +++ b/crates/goose/tests/acp_server_test.rs @@ -1,4 +1,4 @@ -// Modified by Jonathan Mohrbacher, 2026: recipe settings.thinking_effort overrides the inherited delegate effort; turn_failed errors carry data.kind. +// Modified by Jonathan Mohrbacher, 2026: recipe settings.thinking_effort overrides the inherited delegate effort; turn_failed errors carry data.kind; session/prompt messageId and truncate_from_message. #![recursion_limit = "256"] #[allow(dead_code)] #[path = "acp_common_tests/mod.rs"] @@ -33,7 +33,8 @@ use common_tests::{ use goose::config::GooseMode; use goose::conversation::message::{Message, MessageMetadata}; use goose::custom_requests::{ - GetSessionInfoRequest, GetSessionInfoResponse, UpdateSessionProjectRequest, + GetSessionInfoRequest, GetSessionInfoResponse, TruncateSessionConversationFromMessageRequest, + UpdateSessionProjectRequest, }; use goose::recipe::{Recipe, Settings}; use goose::recipe_deeplink; @@ -1683,3 +1684,87 @@ fn test_manual_compaction_refusal_fails_without_replacing_context() { ); }); } + +#[test] +fn test_prompt_message_id_and_truncate_from_message() { + run_test(async { + let expected_session_id = ::expected_session_id(); + let openai = OpenAiFixture::new( + vec![( + format!("what is 1+1{TURN_CONTEXT_OPEN}"), + include_str!("acp_test_data/openai_basic.txt"), + )], + expected_session_id.clone(), + ) + .await; + let mut conn = + ::new(TestConnectionConfig::default(), openai).await; + let SessionData { session, .. } = conn.new_session().await.unwrap(); + let session_id = session.session_id().0.to_string(); + expected_session_id.set(&session_id); + let manager = SessionManager::new(conn.data_root()); + let stored = || async { + manager + .get_session(&session_id, true) + .await + .unwrap() + .conversation + .map(|conversation| conversation.messages().to_vec()) + .unwrap_or_default() + }; + let prompt = |message_id: serde_json::Value| { + let mut meta = serde_json::Map::new(); + meta.insert( + "goose".to_string(), + serde_json::json!({ "messageId": message_id }), + ); + conn.cx() + .send_request( + PromptRequest::new( + agent_client_protocol::schema::v1::SessionId::new(session_id.clone()), + vec![ContentBlock::Text(TextContent::new("what is 1+1"))], + ) + .meta(meta), + ) + .block_task() + }; + let truncate = |message_id: &str| { + conn.cx() + .send_request(TruncateSessionConversationFromMessageRequest { + session_id: session_id.clone(), + message_id: message_id.to_string(), + }) + .block_task() + }; + + let bad = prompt(serde_json::json!("")).await.unwrap_err(); + assert_eq!(bad.code, ErrorCode::InvalidParams); + assert!( + stored().await.is_empty(), + "a rejected prompt stores nothing" + ); + + let done = prompt(serde_json::json!("msg_honk_test_1")).await.unwrap(); + assert_eq!(done.stop_reason, StopReason::EndTurn); + let before = stored().await; + assert!( + before.len() >= 2, + "expected user + assistant rows: {before:?}" + ); + assert_eq!(before[0].id.as_deref(), Some("msg_honk_test_1")); + + let unknown = truncate("msg_honk_unknown").await.unwrap(); + assert!(!unknown.found); + assert_eq!(stored().await.len(), before.len()); + + assert!(truncate("msg_honk_test_1").await.unwrap().found); + assert!( + stored().await.is_empty(), + "truncating from the first message must remove the whole turn" + ); + assert!(!truncate("msg_honk_test_1").await.unwrap().found); + + let empty = truncate(" ").await.unwrap_err(); + assert_eq!(empty.code, ErrorCode::InvalidParams); + }); +} From 1dec11eb5f771260ca821fd918df9955386bb448 Mon Sep 17 00:00:00 2001 From: Jonathan Mohrbacher Date: Sun, 22 Nov 2026 00:11:30 -0500 Subject: [PATCH 2/2] [NO-JIRA] truncate_from_message: refuse while any turn holds the session, not only registered runs (R21) X-Shepherd-Wake: johnnymo87/goose#27 --- crates/goose/src/acp/server/truncate_from_message.rs | 5 +++-- crates/goose/src/agents/session_runtime.rs | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/goose/src/acp/server/truncate_from_message.rs b/crates/goose/src/acp/server/truncate_from_message.rs index e1ef5b0b9811..b6a1b49e5f05 100644 --- a/crates/goose/src/acp/server/truncate_from_message.rs +++ b/crates/goose/src/acp/server/truncate_from_message.rs @@ -47,9 +47,10 @@ impl AcpConnection { ); } // A running turn (or a live voice interaction, which writes messages) would write - // its tail after the cut. The check is not atomic with a prompt arriving next; + // its tail after the cut. Gateway and scheduler turns hold only the turn lock, so + // runs alone would miss them. The check is not atomic with a prompt arriving next; // callers that need that (honkd) serialize prompts and truncation themselves. - if self.runs().is_active(session_id) { + if self.services.runtime.is_busy(session_id) { return Err(agent_client_protocol::Error::invalid_request().data(format!( "session {session_id} has an active run or live voice interaction; truncate after it ends" ))); diff --git a/crates/goose/src/agents/session_runtime.rs b/crates/goose/src/agents/session_runtime.rs index 1ed4a5618f37..0d9902139ed1 100644 --- a/crates/goose/src/agents/session_runtime.rs +++ b/crates/goose/src/agents/session_runtime.rs @@ -1,3 +1,4 @@ +// Modified by Jonathan Mohrbacher, 2026: is_busy visible to truncate_from_message. use std::collections::HashMap; use std::sync::{Arc, Mutex}; @@ -189,7 +190,7 @@ impl SessionRuntime { /// A Live conversation runs without a turn, and a prompt registers its run before /// its turn starts. - fn is_busy(&self, session_id: &str) -> bool { + pub(crate) fn is_busy(&self, session_id: &str) -> bool { self.confirmations.has_active_turn(session_id) || self.runs.is_active(session_id) }