Repository navigation
Conversation
A project's Node can now be started ahead of its first session (Warm). A session arriving meanwhile waits for that same Node; if the prewarm fails, the session confirms it stopped and cold-starts once itself. A Node already up marks the runtime preparation stage as reused. Idle Nodes (no workspace owner, no Node command in flight, no caller about to own one) stop after IdleTimeout (default 60m); beyond MaxIdle (default 7) the least recently used stop first. The Demo Node is exempt, a Node still starting is not counted, and one whose stop is unconfirmed stays registered so no second incarnation starts in its directory.
RecentProjects orders projects across tenants by their latest chat conversation, or their creation when they have none.
server.Options.ProjectCreated is told about each stored project, so main can prewarm its Node without the creation request waiting.
Startup warms the Demo first, then the most recently active projects up to V2_NODE_IDLE_MAX, one at a time; a created project is warmed in the background. V2_NODE_IDLE_TIMEOUT and V2_NODE_IDLE_MAX tune idle reclaim. The README describes prewarming and the reclaim policy.
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.
Refs ora-space/circus#1028
v2,不涉及 specs。只改
v2-server/,接口契约不变,界面没有变化。改了什么
V2_NODE_IDLE_MAX个,一次一个。runtime阶段遇到已就绪的 Node 时,直接复用并标记reused。Node 还在预热时,会话等同一个 Node,不会再起第二个。V2_NODE_IDLE_TIMEOUT(默认60m)的停止;空闲 Node 超过V2_NODE_IDLE_MAX(默认3)个时,先停最久没用的。Demo 不回收。规则和默认值的依据写在
v2-server/README.md的「项目 Node 的预热与回收」一节。commit
perf(v2): prewarm project Nodes and reclaim idle ones:agentruntime的预热、复用、失败兜底和回收,附单测。feat(v2): list projects by latest activity for prewarming:store.RecentProjects。feat(v2): announce projects created through the API:server.Options.ProjectCreated。perf(v2): prewarm Nodes at startup and after project creation:main里的接线、两个环境变量和 README。实测
条件:OpenCode + DeepSeek Flash,同一任务,各 3 轮,取中位数。建完项目等 10 s 再开对话;每轮结束删除对话、再停 30 s;两边都用新库和新数据目录。单位是秒。
V2_NODE_IDLE_TIMEOUT设成20s验证回收:被回收的项目再开对话时冷启动,runtime 2.2 s,首条输出 23.6 s。验证
internal/agentruntime(带-race):新增 12 个预热、回收用例,覆盖预热失败、预热中开对话、回收后开对话。internal/store:TestRecentProjectsOrdersByLatestConversationThenCreation,用TEST_DATABASE_URL跑。internal/server:TestProjectRepositoryLifecycle。v2-server:TestNodeIdlePolicy。