修复单 Agent 指令中断恢复轮次

修正 Provider 返回后消费 steer 时的下一轮 context 索引
新增 Runner 强杀恢复的正式 Provider 隔离验收入口与证据门禁
补充同 run steer 回归和 V1.17 PASS 事实源
This commit is contained in:
AIGameCreator App
2026-07-16 11:10:03 +08:00
parent 0b608edd01
commit 6ff4556201
7 changed files with 1430 additions and 18 deletions
+1
View File
@@ -16,6 +16,7 @@
"agent-run:smoke": "node scripts/smoke-agent-run-local-provider.mjs",
"agent-runtime:real-e2e": "node scripts/agent-runtime-real-e2e.mjs",
"agent-runtime:steer-real-e2e": "node scripts/agent-runtime-steer-real-e2e.mjs",
"agent-runtime:steer-runner-kill-real-e2e": "node scripts/agent-runtime-real-e2e.mjs --suite steer-runner-kill",
"typecheck": "node ../../node_modules/typescript/bin/tsc -p tsconfig.json --noEmit && node scripts/check-config.mjs"
},
"dependencies": {
File diff suppressed because it is too large Load Diff
@@ -5342,7 +5342,7 @@ async fn run_game_creator_agent_background_task_pass_with_context(
&task,
&plan,
&mut observations,
loop_index,
loop_index.saturating_add(1),
&context_tracker,
) {
Ok(_) => {
@@ -5407,7 +5407,7 @@ async fn run_game_creator_agent_background_task_pass_with_context(
&task,
&plan,
&mut observations,
loop_index,
loop_index.saturating_add(1),
&context_tracker,
) {
Ok(true) => {
@@ -41031,6 +41031,17 @@ async fn background_agent_runtime_inflight_steer_discards_old_plan_without_new_t
.recv_timeout(Duration::from_secs(3))
.expect("second planning request after steer");
assert!(second_request.contains("不要创建旧方案文件"));
let replanning = read_game_creator_agent_runtime_at(&root, "code-prototype")
.expect("read replanning runtime after steer")
.state;
let recovered_context = read_game_creator_agent_runtime_context_bundle(&root, &replanning)
.expect("read restart-safe steer context")
.expect("restart-safe steer context exists");
assert_eq!(recovered_context.applied_steer_cursor, 1);
assert_eq!(
recovered_context.next_loop_index.saturating_add(1),
replanning.loop_iteration
);
response_sender
.send(final_tool_plan_response(
"已按新要求收束,没有执行旧写入计划。",
@@ -4600,7 +4600,9 @@
- 验收:确定性回归覆盖 schema、native function 显式字段与文本兼容、限制、单调性、外层失败进度保留、终态保留、动作下标零推进、未完成 final 门禁、损坏状态、v3/v2 恢复、finalization v2 state 丢失恢复、公共审计零正文、计划元数据 revision/policy 中立和两类 UI。恢复/steer 专项必须证明同一 run/session、revision 不回退、终态不丢、旧动作零执行和副作用零重放。真实 Provider 必须在无计划/工具配方的 disposable 项目中自行建立并多次更新计划,经历一次 same-run steer 与一次 Runner 重启,最终只在全部步骤 completed 后写唯一 assistant,并由 Runtime state、v3 bundle、task/event/Agent DB/conversation 和副作用计数交叉取证;截至 2026-07-15 尚未记录该专项 PASS。
- 全量回归修正:context bundle v3 为保持计划快照一致,会在每个 action / observation 后同步;repository startup fingerprint 因此不能继续从最新 bundle 读取,否则同一 planning 批次的前置验证改变规范文件后,后续旧写动作会错误放行。pending action 升级为 `game-creator-pending-action.v4`,绑定 Provider planning 实际渲染的 repository fingerprint;同批 actions、确认和恢复统一复核该快照,旧 v1-v3 失败关闭。五类写动作 drift 回归证明旧动作零执行。
- 终审补充:finalization v2 读取边界必须再次要求所有结构化步骤 `completed` 且 active index 为空;仅重算合法 `planSnapshotFingerprint / finalizationId` 的未完成快照也失败关闭。开发 CLI 的 Runtime JSON 只输出状态和安全身份,递归移除 `sessionPath / eventPath / taskPath`,不把项目绝对存储位置写入命令 transcript;Tauri/App 内部结果结构保持不变。
- 验收现状:确定性回归已通过,真实 `gpt-5.5 llm-runtime` 连续三轮均在首个 Provider planning POST 返回前因同一 TLS record-layer failure 失败,未产生 plan/tool/kill/steer 证据;第三轮绝对路径、密钥和诱饵泄漏为 0。V1.17 继续保持未 PASSProvider 恢复后必须完整重跑。
- 历史验收:2026-07-15 的确定性回归已通过,真实 `gpt-5.5 llm-runtime` 连续三轮均在首个 Provider planning POST 返回前因同一 TLS record-layer failure 失败,未产生 plan/tool/kill/steer 证据;第三轮绝对路径、密钥和诱饵泄漏为 0。当时 V1.17 保持未 PASS不能以短请求或确定性测试代替完整重跑。
- 2026-07-16 恢复修正:Provider interrupted 和 Provider completed 两条“返回后发现并消费 steer”路径在持久化 continuation 时,`nextLoopIndex` 必须使用 `loop_index + 1`,因为当前循环已被消费且随后立即进入下一轮;循环入口和普通 tool observation 后仍保持各自既有索引语义。旧实现写入当前 `loop_index` 后继续,可能形成 context `nextLoopIndex=5`、Runtime `loopIteration=7`,Runner 重启遂错误失败关闭为轮次不匹配。定向回归在替代 planning 请求期间同时核对 steer cursor 为 1 和 `context.nextLoopIndex + 1 == runtime.loopIteration`
- 2026-07-16 真实结论:正式 `openai_chat / gpt-5.5` 的隔离 `steer-runner-kill` suite PASS。专用任务不再耦合预览、图片、隔离 reviewer、外部素材或 Git 提交;Agent 真实观察一次非零验收,以唯一 patchset 完成两文件原子修复,审阅完整正文差异并通过 Agent/宿主复验。计划 revision 4、3 个步骤已完成时注入一次 steerProvider lifecycle 唯一进入 `interrupted`Linux pidfd 强杀 Runner 并更换 boot 后仍保持原 Agent/Session/runcursor 单调保持 1,最终 revision 7 的 6 步全部完成。24 组 Provider request identity 全部闭合,旧动作执行、副作用重放、重复 action/message/receipt、遗留 finalization,以及任务/steer/根因正文、API Key、诱饵、项目路径和正式配置路径公共泄漏均为 0;唯一 assistant/completed 和隔离 Runner/AppData/项目 sentinel 清理全部成立。V1.17 当前门禁状态为 PASS。
## 2026-07-15 AI 游戏创作 Agent Runtime V1.18 单 Agent 持久 Goal mode
File diff suppressed because one or more lines are too long
+1
View File
@@ -145,6 +145,7 @@
"ai-game-creator-shell:agent-run:smoke": "npm --prefix apps/ai-game-creator-shell run agent-run:smoke",
"ai-game-creator-shell:agent-runtime:real-e2e": "npm --prefix apps/ai-game-creator-shell run agent-runtime:real-e2e --",
"ai-game-creator-shell:agent-runtime:steer-real-e2e": "npm --prefix apps/ai-game-creator-shell run agent-runtime:steer-real-e2e --",
"ai-game-creator-shell:agent-runtime:steer-runner-kill-real-e2e": "npm --prefix apps/ai-game-creator-shell run agent-runtime:steer-runner-kill-real-e2e --",
"ai-game-creator-shell:typecheck": "npm --prefix apps/ai-game-creator-shell run typecheck",
"ai-game-creator-shell:check": "npm run ai-game-creator-shell:typecheck && npm run test -- apps/ai-game-creator-shell/tests && cargo test -p platform-llm --manifest-path server-rs/Cargo.toml && cargo test -p platform-agent --manifest-path server-rs/Cargo.toml game_creation && cargo test -p shared-contracts --manifest-path server-rs/Cargo.toml game_creation_app && cargo test --manifest-path apps/ai-game-creator-shell/src-tauri/Cargo.toml && npm run ai-game-creator-shell:agent-run:smoke",
"check:native-shells": "node scripts/check-native-shells.mjs"