From 3d68d56524fcf3ede27b5eb44356386831a68d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Fri, 2 Oct 2026 10:56:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E5=AD=98=E9=87=8C=E7=9A=84=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E8=A7=82=E5=AF=9F=E4=BF=9D=E6=8C=81=E5=8E=9F=E6=96=87?= =?UTF-8?q?=EF=BC=8C=E8=90=BD=E7=9B=98=E9=82=A3=E4=BB=BD=E6=8C=89=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E5=8F=A3=E5=BE=84=E8=84=B1=E6=95=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `build_game_creator_agent_runtime_pending_tool_action` 在嵌入 observations 前按存储口径脱敏:pending ledger 受 fail-closed 门禁保护,工具原文里的项目绝对路径会让整次持久化被拒 - `runtime_driver/main_loop`、`runtime_state` 的过期续跑、`runtime_actions/parallel_read` 不再把脱敏结果写回内存观察向量,prompt 继续用原文 - `parallel_read` 的前缀核对仍用脱敏投影比较,只是不再覆盖内存向量 - 持久化侧(context bundle / pending action)自己脱敏,内存与落盘两份从此解耦 --- .../src-tauri/src/agent/runtime_actions/parallel_read.rs | 5 ----- .../src/agent/runtime_actions/provider_action_batch.rs | 7 ++++++- .../src-tauri/src/agent/runtime_driver/main_loop.rs | 5 +---- .../src-tauri/src/agent/runtime_state.rs | 2 -- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/parallel_read.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/parallel_read.rs index e11fcd9e9..2b943d66d 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/parallel_read.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/parallel_read.rs @@ -717,7 +717,6 @@ pub(in crate::agent) fn project_game_creator_agent_runtime_parallel_read_batch( )); } } - *observations = stored_observations; let mut runtime_projected_count = 0_usize; let mut missing_projection_seen = false; @@ -892,10 +891,6 @@ pub(in crate::agent) fn project_game_creator_agent_runtime_parallel_read_batch( if !already_projected_to_context { context_tracker.record(&observation); observations.push(observation); - *observations = sanitize_game_creator_agent_runtime_context_observations_for_storage( - root, - observations, - ); persist_game_creator_agent_runtime_context( root, runtime, diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_action_batch.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_action_batch.rs index 13c3e4764..8cdf0665a 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_action_batch.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_action_batch.rs @@ -267,7 +267,12 @@ pub(in crate::agent) fn build_game_creator_agent_runtime_pending_tool_action( .map(|item| sanitize_agent_runtime_text(item, 180)) .collect(), fallback_response: sanitize_agent_runtime_text(&plan.response, 1_200), - observations: observations.to_vec(), + // pending action 是 fail-closed 门禁保护的 durable ledger:嵌进去的观察必须先按存储口径 + // 脱敏,否则工具输出里的绝对路径会让整次持久化被拒。给模型看的那份 observation 不受影响。 + observations: sanitize_game_creator_agent_runtime_context_observations_for_storage( + root, + observations, + ), project_revision_before: project_revision_before.clone(), verification_gate_before: read_game_creator_agent_runtime_verification_gate( root, diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver/main_loop.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver/main_loop.rs index 0df942e3f..8423f1cc8 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver/main_loop.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_driver/main_loop.rs @@ -1810,10 +1810,7 @@ async fn run_game_creator_agent_background_task_pass_without_deadline( final_reply_revision = Some(planning_request_revision.revision); } } - observations = sanitize_game_creator_agent_runtime_context_observations_for_storage( - &root, - &observations, - ); + // prompt 用的是内存里的原文;落盘那份由持久化自己按存储口径脱敏。 let _ = context_tracker.complete_loop(loop_index + 1); if let Err(error) = persist_game_creator_agent_runtime_context( &root, diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_state.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_state.rs index ad78e0a75..1d1763fc8 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_state.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_state.rs @@ -998,8 +998,6 @@ pub(crate) fn prepare_game_creator_agent_background_stale_continuation_at( plan.response.clear(); context_tracker.record(&blocker); observations.push(blocker); - *observations = - sanitize_game_creator_agent_runtime_context_observations_for_storage(root, observations); let next_loop_index = usize::try_from(state.loop_iteration).unwrap_or(usize::MAX); persist_game_creator_agent_runtime_context( root,