huskies: merge 652_story_pass_resume_session_id_on_agent_respawn_so_new_sessions_inherit_prior_reasoning

This commit is contained in:
dave
2026-04-27 11:23:28 +00:00
parent 144f07f412
commit ac85cfce5d
8 changed files with 319 additions and 10 deletions
+17 -1
View File
@@ -292,6 +292,22 @@ impl AgentPool {
.map(|a| a.inactivity_timeout_secs)
.unwrap_or(300);
// If no explicit session_id_to_resume was provided, look up from the
// persistent session store. The key includes the model so a model
// change (e.g. sonnet → opus) produces a cache miss — intentional.
let effective_session_id = session_id_to_resume.or_else(|| {
let model = config
.find_agent(&resolved_name)
.and_then(|a| a.model.clone())
.unwrap_or_default();
crate::agents::session_store::lookup_session(
project_root,
story_id,
&resolved_name,
&model,
)
});
// Clone all values needed inside the background spawn.
// Spawn the background task. Worktree creation and agent launch happen here
// so `start_agent` returns immediately after registering the agent as
@@ -300,7 +316,7 @@ impl AgentPool {
project_root.to_path_buf(),
config.clone(),
resume_context.map(str::to_string),
session_id_to_resume,
effective_session_id,
story_id.to_string(),
resolved_name.clone(),
tx.clone(),