fix(buzz-agent): preserve prompt date context

Signed-off-by: Jimmy <1fe240cd1a8cf775f6f3060f115e5a303181f3abf28ad4cb0c2515f4a02b36a8@meshllm.communities.buzz.xyz>
This commit is contained in:
Jimmy
2026-09-02 12:08:42 +10:00
parent 6c3e52f21f
commit fb4adfb587
3 changed files with 17 additions and 1 deletions

1
Cargo.lock generated
View File

@@ -979,6 +979,7 @@ dependencies = [
"axum",
"base64 0.22.1",
"buzz-model-catalog",
"chrono",
"dirs",
"fs2",
"futures",

View File

@@ -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"

View File

@@ -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();