perf(team): lazy warm — only start agent processes on first message#282
Merged
Conversation
Remove eager restore_all_sessions at startup and add ensure_session calls in send_message/send_message_to_agent so team sessions are created on demand rather than blocking app startup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dispose_all still cleans up sessions correctly; the test now verifies cleanup via get_session_scheduler instead of asserting send_message fails (which now auto-rebuilds via ensure_session). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced May 16, 2026
piorpua
pushed a commit
that referenced
this pull request
May 16, 2026
🤖 I have created a release *beep* *boop* --- ## [0.1.4](v0.1.3...v0.1.4) (2026-05-16) ### Features * **ai-agent:** log every CLI detection + add doctor subcommand ([#285](#285)) ([5ef6d0a](5ef6d0a)) * **runtime:** full shell-style command in spawn logs ([#278](#278)) ([dd51616](dd51616)) ### Bug Fixes * **ai-agent:** negotiate OpenClaw protocol v3..v4 ([#288](#288)) ([dfeece0](dfeece0)) * **team:** model routing + schema unification + lazy warm mode persistence ([#286](#286)) ([199a392](199a392)) ### Performance Improvements * **team:** lazy warm — only start agent processes on first message ([#282](#282)) ([6281f31](6281f31)) ### Code Refactoring * **app:** extract CLI definitions to cli.rs ([#280](#280)) ([5685d52](5685d52)) * **app:** introduce commands/ module with layered bootstrap for subcommands ([#283](#283)) ([1216597](1216597)) * **app:** replace argv sniffing with clap Subcommand for mcp-* helpers ([#277](#277)) ([c3d137c](c3d137c)) * **app:** split monolithic lib.rs/main.rs into per-module files ([#284](#284)) ([f3462cb](f3462cb)) * rename binary from aionui-backend to aioncli ([#289](#289)) ([30eeca3](30eeca3)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.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
restore_all_sessionsat app startup that blocked startup for 12-30s (N agents × 4-6s serial warm)ensure_sessioncalls insend_message/send_message_to_agentso team sessions are created on-demand when user actually sends a messageHow it works
Before: app start →
restore_all_sessions()→ serial warm all teams' all agents → readyAfter: app start → ready (no team activity). First message →
ensure_session(idempotent, mutex-guarded) → warm agents → deliver messageFrontend follow-up needed
Frontend still calls
POST /api/conversations/{id}/warmupwhen entering a team page, which pre-warms agents unnecessarily. This should be removed separately (mnemo keyword:前端 team 页面进入即预热).Safety
ensure_sessionis idempotent (contains_key+ Mutex prevents concurrent re-entry)event_loop.rs:execute_turnhas fallback warmup if agent was killed by idle scannerTest plan
cargo clippy -p aionui-app -p aionui-team -- -D warningspassescargo build --releasesucceeds🤖 Generated with Claude Code