Skip to content

fix(team): add session-mode endpoint and harden wake race#238

Merged
zhuqingyv merged 4 commits into
mainfrom
fix/team-wake-status-deadlock
May 12, 2026
Merged

fix(team): add session-mode endpoint and harden wake race#238
zhuqingyv merged 4 commits into
mainfrom
fix/team-wake-status-deadlock

Conversation

@zhuqingyv

Copy link
Copy Markdown
Contributor

Summary

  • Add POST /api/teams/{id}/session-mode endpoint so frontend can switch permission mode for all team agents (fixes 404 for aionrs teams)
  • Check conversation DB status before creating StreamRelay to prevent duplicate streaming
  • Claim conversation as Running in DB at point-of-no-return and reset on warmup failure

Test plan

  • cargo clippy clean
  • cargo test --workspace passes (5492 tests)
  • Manual: switch mode in team panel with aionrs agent, confirm no 404

🤖 Generated with Claude Code

zhuqingyu-netizen and others added 4 commits May 12, 2026 11:06
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>
@zhuqingyv zhuqingyv merged commit ba12c6f into main May 12, 2026
5 checks passed
@zhuqingyv zhuqingyv deleted the fix/team-wake-status-deadlock branch May 12, 2026 07:31
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