From fb4adfb587edc05f5ff2f1000fdbee0ff58fd060 Mon Sep 17 00:00:00 2001 From: Jimmy <1fe240cd1a8cf775f6f3060f115e5a303181f3abf28ad4cb0c2515f4a02b36a8@meshllm.communities.buzz.xyz> Date: Wed, 2 Sep 2026 12:08:42 +1000 Subject: [PATCH] fix(buzz-agent): preserve prompt date context Signed-off-by: Jimmy <1fe240cd1a8cf775f6f3060f115e5a303181f3abf28ad4cb0c2515f4a02b36a8@meshllm.communities.buzz.xyz> --- Cargo.lock | 1 + crates/buzz-agent/Cargo.toml | 1 + crates/buzz-agent/src/prompt.rs | 16 +++++++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 9cec3385d6..e5728601b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -979,6 +979,7 @@ dependencies = [ "axum", "base64 0.22.1", "buzz-model-catalog", + "chrono", "dirs", "fs2", "futures", diff --git a/crates/buzz-agent/Cargo.toml b/crates/buzz-agent/Cargo.toml index ac6ff9137b..f883c2ae68 100644 --- a/crates/buzz-agent/Cargo.toml +++ b/crates/buzz-agent/Cargo.toml @@ -62,6 +62,7 @@ serde = { workspace = true } serde_json = { workspace = true } serde_yaml = { workspace = true } reqwest = { workspace = true, features = ["json", "rustls", "form"] } +chrono = { workspace = true } rmcp = { version = "3", default-features = false, features = ["client", "transport-child-process"] } arc-swap = "1" getrandom = "0.4" diff --git a/crates/buzz-agent/src/prompt.rs b/crates/buzz-agent/src/prompt.rs index 3ba58489a7..429213691b 100644 --- a/crates/buzz-agent/src/prompt.rs +++ b/crates/buzz-agent/src/prompt.rs @@ -73,7 +73,7 @@ impl SessionPrompt { } state.composer.render( &PromptContext { - current_date_time: String::new(), + current_date_time: chrono::Utc::now().format("%Y-%m-%d %H:00 %:z").to_string(), goose_mode: self.mode, variables: Default::default(), }, @@ -119,6 +119,20 @@ mod tests { assert!(built.contains("Always ship the sprocket first.")); } + #[tokio::test] + async fn override_renders_current_date_time() { + let prompt = SessionPrompt::new(GooseMode::Auto); + prompt + .set_override("It is currently {{ current_date_time }}".to_string()) + .await; + let built = prompt.build(Path::new(".")).await.unwrap(); + assert!(built.starts_with("It is currently 20"), "{built:?}"); + assert!( + !built.contains("{{"), + "template variable was not rendered: {built:?}" + ); + } + #[tokio::test] async fn instructions_are_loaded_once() { let root = tempfile::tempdir().unwrap();