Guanghu Domestic Migration a27e87cb99 chore: import sanitized domestic snapshot for REPO-007
Source snapshot: 97d7f0fae96dc04b7ddad56fc1db6a108ed662cc

[SEC-CLEAN] · pre-push-clean v1.0 · 109处敏感信息已自动转乱码
2026-07-17 15:59:55 +08:00

4.6 KiB
Raw Permalink Blame History

Agent调度器

下一轮指引: 完成后→与GH-API-001对接 · Agent通过API领取工单而非直接查DB 仓库路径: /guanghu-self-hosted/agent-scheduler/ 优先级: P0 分支名: feat/gh-agent-scheduler 创建时间: 2026年4月25日 15:30 审核结果: 审核通过 · 霜砚AG-SY-WEB-001

【审核时间】2026-04-25T15:42 CST 【分支】feat/gh-agent-scheduler @ qinfendebingshuo/guanghulab 【文件】9/9全部存在且语法正确

【逐项检查】 files_exist: 9文件全齐(http://scheduler.py 14048B / boot_http://integration.py 4117B / llm_http://client.py 6875B / git_http://ops.py 6428B / self_http://checker.py 9438B / http://config.py 3134B / test_http://scheduler.py 8305B / requirements.txt 146B / http://README.md 3978B) python_syntax: http://7个.py文件AST解析通过 asyncio: 全异步架构(asyncio.wait_for超时 / asyncio.create_subprocess_exec / httpx.AsyncClient) boot_protocol: boot_http://integration.py正确读取L-1层身份 · 优雅降级到默认值 tool_receipt: record_receipt()回执stub就绪 · Phase-0日志输出 · Phase-1+对接API llm_retry: 3次重试 + 指数退避(2^attempt秒) · 错误兜底LLMResponse dual_model_stub: route_expression(Kimi) / route_reasoning(DeepSeek) 预留 git_ops: clone/checkout/add/commit/push全异步 · commit格式[{编号}] {标题} directory_isolation: SelfChecker._check_directory_isolation强制隔离 prefix: GH-SCHED-001贯穿所有文件docstring timeout: WORK_ORDER_TIMEOUT=1800s(30min) + asyncio.wait_for logging: 5级层级logger(agent-scheduler / .boot / .llm / .git / .selfcheck) tests: 10条用例覆盖config/boot/llm/selfcheck核心路径

【轻微建议(不阻塞)】 ⚠️ requirements.txt含pydantic/uvicorn但代码未import · 建议下轮清理

【结论】全部约束满足 · 代码质量合格 · 架构清晰 · 准予合体 开发内容: 【目标】Agent调度引擎 · 让半体能在光湖服务器上自主接单开发

【技术栈】Python 3.10+ · asyncio

【核心流程】

  1. 启动: 调用Boot Protocol(Phase-0-001/006)加载Agent人格
  2. 轮询: 查询work_orders表中status=pending且assigned_agent=自己的工单
  3. 领取: 更新status→developing · 写execution_log
  4. 执行: a. 读取工单dev_content+constraints b. 调用LLM API生成代码(预留双模型接口: Kimi表达/DeepSeek推理) c. 写入文件到仓库路径 d. Git操作: checkout分支→add→commit→push
  5. 自检: 运行约束检查→更新self_check_result→status=self_checking→reviewing
  6. 回执: 调用tool-receipt(Phase-0-005)记录操作日志

【LLM集成】

  • llm_http://client.py: 统一封装 · 支持OpenAI兼容API
  • 环境变量: LLM_API_KEY / LLM_BASE_URL / LLM_MODEL
  • 预留双模型路由stub(Phase 2实现L1层时替换)

【Git集成】

  • git_http://ops.py: clone/checkout/add/commit/push
  • 环境变量: GITHUB_TOKEN / REPO_URL
  • commit message格式: [{工单编号}] {描述}

【交付物】

□ 检查1 触发器正常 □ 检查2 工单数据库正常 □ 检查3 ⚠️ GitHub访问正常·/guanghu-self-hosted/在main不存在(预期) □ 检查4 指令页已更新 □ 检查5 自动唤醒正常 负责Agent: 培园A04 阶段编号: Phase-NOW-004