Skip to content

fix: preserve active team run across session restart#682

Open
hyoseop1231 wants to merge 1 commit into
iOfficeAI:mainfrom
hyoseop1231:fix/team-session-restart-preserve-run
Open

fix: preserve active team run across session restart#682
hyoseop1231 wants to merge 1 commit into
iOfficeAI:mainfrom
hyoseop1231:fix/team-session-restart-preserve-run

Conversation

@hyoseop1231

Copy link
Copy Markdown

Problem

When a team session is restarted (e.g., after adding agents to an existing team), the TeamRunManager is recreated with no active run state. This causes team_send_message to fail with:

error=Invalid request: no active team run for run-scoped wake
error_code=RuntimeContextMissing

Which propagates through the MCP bridge as "local team tool returned an error".

Root Cause

ensure_session_inner in service.rs creates a new TeamSession (and thus a new TeamRunManager) when the session needs to be restarted. The fresh TeamRunManager starts with state: None, so any subsequent team_send_message call fails because require_active_team_run_for_team_work finds no active run.

Fix

  1. manager.rs: Added TeamRunManager::resume_run(run_id) — restores a carried-over run record in Accepted status on a fresh manager.

  2. service.rs: In ensure_session_inner, before creating a new session, capture carried_run_id from any existing session's current_active_run_id(). After the new session is published in self.sessions, call resume_run to restore the run.

Verification

  • cargo test -p aionui-team: 409 passed, 0 failed
  • No existing test assertions modified
  • Binary built, deployed, and verified on live AionUi instance

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants