fix(team): add session-mode endpoint and harden wake race#238
Merged
Conversation
Previously set_status(Working) was called before try_wake/wake task, but early-return paths (no message, warmup fail, agent already running) only released wake_lock without resetting to Idle — causing permanent deadlock where agents never respond again. Move the status transition to right before send_message succeeds, and add Idle recovery on send failure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When spawning aionrs-type agents in team mode, the backend string "aionrs" was used directly as provider_id in ProviderWithModel. Since "aionrs" is an agent type (not a provider), the factory failed with "Provider 'aionrs' not found" during warmup, leaving spawned agents unable to start or respond to messages. Add resolve_provider_for_model() that iterates enabled providers to find the one containing the requested model, and use its real ID as provider_id. Applied to all three conversation-creation paths: create_team, add_agent, and persist_spawned_agent.
Collapse nested if-let into a single condition with `&&` to satisfy clippy::collapsible_if (introduced in #235).
…wake race - Add session-mode route so frontend can switch permission mode for all team agents in one call (fixes 404 for aionrs teams). - In try_wake, check conversation DB status before creating StreamRelay to prevent duplicate streaming output. - Claim conversation as Running in DB at point-of-no-return and reset on warmup failure to avoid status-stuck deadlock. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
POST /api/teams/{id}/session-modeendpoint so frontend can switch permission mode for all team agents (fixes 404 for aionrs teams)Test plan
🤖 Generated with Claude Code