Clean up session file optionality for --no-session (#3230)

This commit is contained in:
Jack Amadeo
2025-07-02 16:05:05 -04:00
committed by GitHub
parent 2e97621348
commit c77c1b364d
10 changed files with 179 additions and 213 deletions
+2 -2
View File
@@ -18,7 +18,7 @@ pub struct BenchAgentError {
#[async_trait]
pub trait BenchBaseSession: Send + Sync {
async fn headless(&mut self, message: String) -> anyhow::Result<()>;
fn session_file(&self) -> PathBuf;
fn session_file(&self) -> Option<PathBuf>;
fn message_history(&self) -> Vec<Message>;
fn get_total_token_usage(&self) -> anyhow::Result<Option<i32>>;
}
@@ -52,7 +52,7 @@ impl BenchAgent {
pub(crate) async fn get_token_usage(&self) -> Option<i32> {
self.session.get_total_token_usage().ok().flatten()
}
pub(crate) fn session_file(&self) -> PathBuf {
pub(crate) fn session_file(&self) -> Option<PathBuf> {
self.session.session_file()
}
}
@@ -155,8 +155,15 @@ impl EvalRunner {
.canonicalize()
.context("Failed to canonicalize current directory path")?;
BenchmarkWorkDir::deep_copy(agent.session_file().as_path(), here.as_path(), false)
.context("Failed to copy session file to evaluation directory")?;
BenchmarkWorkDir::deep_copy(
agent
.session_file()
.expect("Failed to get session file")
.as_path(),
here.as_path(),
false,
)
.context("Failed to copy session file to evaluation directory")?;
tracing::info!("Evaluation completed successfully");
} else {