Skip to content

V3 生命周期 — main→develop 等价映射

main 分支的 Manager 生命周期管理能力(9 commit)在 develop V3 架构中 已由 worker 模块完整吸收。本文档记录等价关系,说明为何 Group E 跳过移植。

等价映射

main 能力main 位置develop 等价位置说明
Agent CRUD + lifecycle APImanager/api/agents.pyservices/manager/app/api/agent_instances.pyV3 三层模型:AgentInstance 替代 Agent,含 publish/offline 状态机
部署编排服务manager/services/deployment_service.pyservices/manager/app/worker/router.py + k8s_manager.pydeploy_flow / suspend / destroy / wakeup / hot_reload / apply_config 全覆盖
K8s STS 管理manager/infra/k8s_manager.py(StatefulSet)services/manager/app/worker/k8s_manager.py(Deployment)V3 升级为 Deployment 模式,支持 replicas 缩放 + pod_manager 轮询
Pod 状态查询manager/infra/k8s_manager.py get_sts_statusservices/manager/app/worker/pod_manager.py独立模块,4 档轮询频率(deploying→running→suspended→destroyed)
idle 自动回收manager/services/deployment_service.py _check_idleservices/manager/app/worker/recycle_scheduler.pyRecycleScheduler 5min 检测 → 30min idle SUSPEND;CleanupScheduler 1h → 24h DESTROY
metric 周期采样manager/services/deployment_service.py _sampleservices/manager/app/worker/metric_sampler.pyMetricSampler 60s 采样 Pod CPU/内存 → resource_metric_samples 表,7d 保留
外键级联删除migrate_fk_cascade.sqlservices/manager/app/models/__init__.pyBase.metadata 已用 ondelete="CASCADE"(22 处),无需独立 migration
Deploy 事件面板admin DeployConfigTab.vueapps/admin/.../DeployEventsPanel.vue4 档轮询频率 + 实时事件流
健康检查巡检manager/services/deployment_service.py _monitorservices/manager/app/worker/router.py _update_active_loop60s 更新 last_active_at + profile 一致性巡检

V3 新增能力(main 无)

  • AgentDefinition / AgentVersion / AgentInstance 三层模型 — 草稿/发布/实例分离
  • ResourcePool 资源池 — 多租户资源隔离
  • AgentInstanceChannel — 实例↔渠道绑定(独立于 deployment)
  • profile_resolver — gateway 层 Profile 路由解析(60s 正缓存 + 10s 负缓存)
  • user_md_sync — USER.md 注入引擎 Pod(per-user 上下文)
  • minio_archiver — SUSPEND 时 PVC→MinIO 归档(零开销存档策略)

结论

develop V3 worker 已完整吸收 main 的生命周期能力,并在此基础上增加了 三层模型、资源池、Profile 路由等 V3 特性。Group E 跳过 cherry-pick, 仅文档化等价关系。

相关文件

  • services/manager/app/worker/ — background.py / k8s_manager.py / pod_manager.py / recycle_scheduler.py / metric_sampler.py / minio_archiver.py / user_md_sync.py / router.py
  • services/manager/app/api/agent_instances.py — V3 实例 API
  • services/manager/app/models/__init__.py — V3 三层模型 + ondelete CASCADE

相关记忆

  • [[monitoring-wiring-status]] — 监控栈部署状态

基于内网部署的企业级 AI 智能体平台