fix: preserve active team run across session restart#682
Open
hyoseop1231 wants to merge 1 commit into
Open
Conversation
When a team session is restarted (e.g., after adding agents), the TeamRunManager was recreated with no active run state. This caused team_send_message to fail with 'no active team run for run-scoped wake' which propagated as 'local team tool returned an error'. Fix: capture the active run ID from the old session before creating a new one, then resume it on the new session's TeamRunManager after publication. - Add TeamRunManager::resume_run() to restore a carried-over run - In ensure_session_inner, capture carried_run_id before session creation - Call resume_run after the new session is inserted into self.sessions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a team session is restarted (e.g., after adding agents to an existing team), the
TeamRunManageris recreated with no active run state. This causesteam_send_messageto fail with:Which propagates through the MCP bridge as
"local team tool returned an error".Root Cause
ensure_session_innerinservice.rscreates a newTeamSession(and thus a newTeamRunManager) when the session needs to be restarted. The freshTeamRunManagerstarts withstate: None, so any subsequentteam_send_messagecall fails becauserequire_active_team_run_for_team_workfinds no active run.Fix
manager.rs: AddedTeamRunManager::resume_run(run_id)— restores a carried-over run record inAcceptedstatus on a fresh manager.service.rs: Inensure_session_inner, before creating a new session, capturecarried_run_idfrom any existing session'scurrent_active_run_id(). After the new session is published inself.sessions, callresume_runto restore the run.Verification
cargo test -p aionui-team: 409 passed, 0 failed