Fix timing footer being saved to context window
The timing footer (e.g., ⏱️ 19.4s | 💭 4.7s) was being saved to the conversation history as a separate assistant message. This happened because stream_completion_with_tools returns the timing footer in TaskResult.response for display, but the caller was also saving it to context. Fix: Strip the timing footer (identified by \n\n⏱️) before saving to context window. The timing footer remains display-only. Also includes: - Research tool blank line fix: only add visual separator for research tool output, not all tools - Research tool webdriver propagation: pass parent's webdriver browser choice (Safari vs Chrome headless) to scout subprocess
This commit is contained in:
@@ -7,6 +7,7 @@ use tokio::process::Command;
|
||||
|
||||
use crate::ui_writer::UiWriter;
|
||||
use crate::ToolCall;
|
||||
use g3_config::WebDriverBrowser;
|
||||
|
||||
use super::executor::ToolContext;
|
||||
|
||||
@@ -156,14 +157,21 @@ pub async fn execute_research<W: UiWriter>(
|
||||
let g3_path = std::env::current_exe()
|
||||
.unwrap_or_else(|_| std::path::PathBuf::from("g3"));
|
||||
|
||||
// Spawn the scout agent
|
||||
let mut child = Command::new(&g3_path)
|
||||
// Build the command with appropriate webdriver flags
|
||||
let mut cmd = Command::new(&g3_path);
|
||||
cmd
|
||||
.arg("--agent")
|
||||
.arg("scout")
|
||||
.arg("--webdriver") // Scout needs webdriver for web research
|
||||
.arg("--new-session") // Always start fresh for research
|
||||
.arg("--quiet") // Suppress log file creation
|
||||
.arg(query)
|
||||
.arg("--quiet"); // Suppress log file creation
|
||||
|
||||
// Propagate the webdriver browser choice from the parent g3 instance
|
||||
match ctx.config.webdriver.browser {
|
||||
WebDriverBrowser::ChromeHeadless => { cmd.arg("--chrome-headless"); }
|
||||
WebDriverBrowser::Safari => { cmd.arg("--webdriver"); }
|
||||
}
|
||||
|
||||
let mut child = cmd.arg(query)
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.spawn()
|
||||
|
||||
Reference in New Issue
Block a user