Skip to content

Fix runtime drift guards and write-path audit bridging - #1

Open
lisihao wants to merge 1 commit into
codex/capsule-proof-adapter-runtimefrom
codex/runtime-drift-writepath-fix
Open

Fix runtime drift guards and write-path audit bridging#1
lisihao wants to merge 1 commit into
codex/capsule-proof-adapter-runtimefrom
codex/runtime-drift-writepath-fix

Conversation

@lisihao

@lisihao lisihao commented May 31, 2026

Copy link
Copy Markdown
Owner

摘要

  • 修复 terminal sprint 在 autopilot / graph projection / runtime status 多写入器之间被回写成非终态的漂移问题
  • tools/graph_scheduler.py 收口为 canonical wrapper,避免 tools/lib 双实现分叉
  • runtime_doctor 增加 state_surface_drift 检查,并清理 runtime_write_path_audit 的剩余 warn/error
  • evolution_engine 增加 sprint-scoped legacy event -> session-log v2 桥接

变更边界

in-scope

  • runtime_status terminal sticky guard
  • graph_scheduler closeout / projection runtime bridge
  • solar-autopilot-monitor terminal child downgrade guard
  • runtime_doctor.state_surface_drift
  • runtime_write_path_audit 分类规则与回归
  • evolution_engine sprint-scoped event bridge
  • tools/graph_scheduler.py -> canonical wrapper

out-of-scope

  • 不改 planner / builder / evaluator 的产品逻辑
  • 不改 quota / routing / scoring / lease 规则
  • 不处理仓库里其他并行 feature 的脏改动
  • 不做历史全量 sprint 的语义重写,只修 runtime/drift/write-path 主链

关键改动文件

  • harness/lib/runtime_status.py
  • harness/lib/graph_scheduler.py
  • harness/tools/solar-autopilot-monitor.py
  • harness/lib/runtime_doctor.py
  • harness/lib/runtime_write_path_audit.py
  • harness/tools/runtime_write_path_audit.py
  • harness/lib/evolution_engine.py
  • harness/tools/evolution_engine.py
  • harness/tools/graph_scheduler.py
  • drift / wrapper / audit 回归测试

验证矩阵

检查 结果
python3 harness/lib/runtime_write_path_audit.py --root harness --json warn=0, error=0
python3 /Users/lisihao/.solar/harness/lib/runtime_write_path_audit.py --root /Users/lisihao/.solar/harness --json warn=0, error=0
bash harness/tests/runtime/test-runtime-write-path-audit.sh PASS runtime write-path audit classifies ok/warn/error
python3 -m pytest -q harness/tests/test_runtime_doctor_state_surface_drift.py harness/tests/graph/test_graph_scheduler_tool_wrapper.py harness/tests/graph/test_runtime_status.py harness/tests/graph/test_graph_status_sync.py harness/tests/control_plane/test-autopilot-pane-gate-reconcile.py 35 passed
python3 -m py_compile ... 通过

Reviewer Guide

  1. 先看 runtime_status.py,确认 terminal -> non-terminal 默认不可降级。
  2. 再看 graph_scheduler.py,确认 graph closeout/projection 全部桥到中心 writer。
  3. 再看 solar-autopilot-monitor.py,确认 terminal child 不会再被 dependency_blocked 打回 queued。
  4. 最后看 runtime_write_path_audit.py 与测试,确认 source/live 审计都已经 warn=0 error=0

风险

  • 这条 PR 主要修 runtime 守卫与审计口径,未覆盖其他并行 feature 分支。
  • tools/graph_scheduler.py 由独立实现收口成 wrapper,虽然回归已覆盖 CLI 可用性,但如果外部有人依赖旧内部实现细节,需在合并后再观察一轮。

@lisihao

lisihao commented May 31, 2026

Copy link
Copy Markdown
Owner Author

Merge note:

  • This PR is intentionally based on codex/capsule-proof-adapter-runtime, not main.
  • Verified in an isolated worktree so the original /Users/lisihao/Solar dirty workspace was not touched.
  • Scope is runtime/drift/write-path guards only; other parallel changes remain out of scope.
  • After merge, monitor one cycle of autopilot + graph closeout to confirm no terminal sprint regresses to queued.

@lisihao lisihao added the bug Something isn't working label May 31, 2026
lisihao added a commit that referenced this pull request Jun 10, 2026
来源: 2026-06-10 卡点系统盘点 (~/.solar/reports/2026-06-10-solar-harness-卡点系统盘点.md)

根因 (P0 卡点#1): TERMINAL_STATUSES 含 failed → ready_nodes() 永久跳过失败
节点 → 无重派路径 → evaluator 判一次 FAIL = 节点永久死 = 整条 epic DAG 永不
放行下游。55 个 sprint / 65 个 failed 节点全因此卡死, coordinator 每天空扫
(近2h 4098 次 graph_nodes_dispatched / 1458 次 dependency_blocked)。

新增 lib/graph_redispatch.py:
- 扫 failed 节点; redispatch_count<max(默认2) → 清上轮 eval + 重置 pending
  (带 retry 上限) + 喂回 evaluator 拒绝理由让 builder 针对性重做
- 超上限 → 保持 failed + 写 dag-human-review-queue.jsonl + 桌面通知 (响亮喊人,
  不假装解决)
- --limit 总闸防一次性打爆 operator 池; 默认 dry-run, --apply 才改 graph
- coordinator %30 分支接入: 每~5min 低速自动重派至多 SOLAR_DAG_REDISPATCH_LIMIT(3) 个

依赖 graph_scheduler.py set_node_status 新增 allow_reopen_failed 参数 (受控放行
failed→pending, 默认 False 不改原语义); 该文件混分支前序改动, 留待统一 commit,
运行时已同步生效。

验证: set_node_status 单测 4/4 (默认挡住+受控放行+不影响passed+重开后ready);
重派器单测 6/6 (dry-run/上限重派/转人工/human-queue/limit总闸/events);
真实 dry-run 扫 55 sprint/65 节点; 灰度 apply 3 个真实 failed→pending,
端到端验真 ready_nodes 重新选中 + DAG failed_nodes 清空。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant