huskies: merge 736_story_drain_and_prepend_buffered_status_events_on_the_user_s_next_agent_message

This commit is contained in:
dave
2026-04-27 19:31:34 +00:00
parent aa7b26a24a
commit 63a30a9319
4 changed files with 182 additions and 2 deletions
+12
View File
@@ -48,6 +48,11 @@ pub(super) async fn run_agent_spawn(
watcher_tx: broadcast::Sender<WatcherEvent>,
merge_jobs: Arc<Mutex<HashMap<String, MergeJob>>>,
inactivity_timeout_secs: u64,
// Formatted `<recent-events>` block drained from the previous session's
// buffer. Prepended to the first agent turn so the agent sees what
// happened while it was idle (story 736). `None` when there were no
// buffered events.
buffered_events_block: Option<String>,
) {
// Re-bind to the legacy `_clone` / `_owned` names so the body below remains
// a verbatim copy of the original closure (story 157).
@@ -169,6 +174,13 @@ pub(super) async fn run_agent_spawn(
}
};
// Prepend buffered pipeline events from the previous idle period so the
// agent sees what happened while it was not running (story 736).
let effective_prompt = match buffered_events_block {
Some(block) if !block.is_empty() => format!("{block}\n\n{effective_prompt}"),
_ => effective_prompt,
};
// Step 3: transition to Running now that the worktree is ready.
{
if let Ok(mut agents) = agents_ref.lock()