修复持锁 Provider 构建的二次取项目锁
Provider tool-plan 持锁路径改用 locked 阶段判定入口 保留未持锁调用方的单次加锁包装入口 修复澄清回答恢复 continuation 因非重入项目锁卡死
This commit is contained in:
+69
-2
@@ -152,8 +152,9 @@ pub(in crate::agent) fn remove_autonomous_art_director_non_canvas_validation_too
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(in crate::agent) fn build_game_creator_agent_background_tool_plan_request(
|
||||
fn build_game_creator_agent_background_tool_plan_request_at(
|
||||
root: &Path,
|
||||
project_lock: Option<&ProjectWriteLock>,
|
||||
agent_id: &str,
|
||||
session_id: &str,
|
||||
run_id: &str,
|
||||
@@ -509,7 +510,12 @@ pub(in crate::agent) fn build_game_creator_agent_background_tool_plan_request(
|
||||
)?)
|
||||
.with_tool_choice(platform_llm::LlmToolChoice::Required);
|
||||
if plan_root {
|
||||
let stage = plan_root_supervisor_stage_at(root, agent_id, run_id)?;
|
||||
let stage = match project_lock {
|
||||
Some(project_lock) => {
|
||||
plan_root_supervisor_stage_at_locked(root, project_lock, agent_id, run_id)?
|
||||
}
|
||||
None => plan_root_supervisor_stage_at(root, agent_id, run_id)?,
|
||||
};
|
||||
retain_plan_root_supervisor_native_tools(&mut request.function_tools, stage)?;
|
||||
// 固定单节点 schema 只对还在广告 agent.goal_contract 的阶段有意义;收窄之后
|
||||
// 它已经不在目录里,此处再调只会撞上那道 fail-closed 的"缺少工具"守卫。
|
||||
@@ -643,6 +649,67 @@ pub(in crate::agent) fn build_game_creator_agent_background_tool_plan_request(
|
||||
))
|
||||
}
|
||||
|
||||
pub(in crate::agent) fn build_game_creator_agent_background_tool_plan_request(
|
||||
root: &Path,
|
||||
agent_id: &str,
|
||||
session_id: &str,
|
||||
run_id: &str,
|
||||
task: &str,
|
||||
observations: &[AgentRuntimeToolObservation],
|
||||
loop_index: usize,
|
||||
) -> Result<
|
||||
(
|
||||
GameCreatorLlmConfig,
|
||||
String,
|
||||
LlmRunRequest,
|
||||
String,
|
||||
AgentRuntimeToolPlanRequestSnapshot,
|
||||
),
|
||||
String,
|
||||
> {
|
||||
build_game_creator_agent_background_tool_plan_request_at(
|
||||
root,
|
||||
None,
|
||||
agent_id,
|
||||
session_id,
|
||||
run_id,
|
||||
task,
|
||||
observations,
|
||||
loop_index,
|
||||
)
|
||||
}
|
||||
|
||||
pub(in crate::agent) fn build_game_creator_agent_background_tool_plan_request_locked(
|
||||
root: &Path,
|
||||
project_lock: &ProjectWriteLock,
|
||||
agent_id: &str,
|
||||
session_id: &str,
|
||||
run_id: &str,
|
||||
task: &str,
|
||||
observations: &[AgentRuntimeToolObservation],
|
||||
loop_index: usize,
|
||||
) -> Result<
|
||||
(
|
||||
GameCreatorLlmConfig,
|
||||
String,
|
||||
LlmRunRequest,
|
||||
String,
|
||||
AgentRuntimeToolPlanRequestSnapshot,
|
||||
),
|
||||
String,
|
||||
> {
|
||||
build_game_creator_agent_background_tool_plan_request_at(
|
||||
root,
|
||||
Some(project_lock),
|
||||
agent_id,
|
||||
session_id,
|
||||
run_id,
|
||||
task,
|
||||
observations,
|
||||
loop_index,
|
||||
)
|
||||
}
|
||||
|
||||
pub(in crate::agent) fn build_game_creator_agent_background_final_reply_request(
|
||||
root: &Path,
|
||||
agent_id: &str,
|
||||
|
||||
+6
-3
@@ -239,8 +239,9 @@ pub(in crate::agent) async fn request_game_creator_agent_background_tool_plan_at
|
||||
== AGENT_RUNTIME_RUN_PROFILE_AUTONOMOUS_GAME_BUILD
|
||||
&& agent_id == GAME_CREATOR_PROJECT_SUPERVISOR_AGENT_ID
|
||||
&& autonomous_manifest_dag_in_progress_at(root)?;
|
||||
let request = build_game_creator_agent_background_tool_plan_request(
|
||||
let request = build_game_creator_agent_background_tool_plan_request_locked(
|
||||
root,
|
||||
&_lock,
|
||||
agent_id,
|
||||
session_id,
|
||||
run_id,
|
||||
@@ -303,8 +304,9 @@ pub(in crate::agent) async fn request_game_creator_agent_background_tool_plan_at
|
||||
== AGENT_RUNTIME_RUN_PROFILE_AUTONOMOUS_GAME_BUILD
|
||||
&& agent_id == GAME_CREATOR_PROJECT_SUPERVISOR_AGENT_ID
|
||||
&& autonomous_manifest_dag_in_progress_at(root)?;
|
||||
let request = build_game_creator_agent_background_tool_plan_request(
|
||||
let request = build_game_creator_agent_background_tool_plan_request_locked(
|
||||
root,
|
||||
&_lock,
|
||||
agent_id,
|
||||
session_id,
|
||||
run_id,
|
||||
@@ -356,8 +358,9 @@ pub(in crate::agent) async fn request_game_creator_agent_background_tool_plan_at
|
||||
// that lock so a session successor cannot be used to re-label an
|
||||
// object assembled from an older session.
|
||||
if agent_id == GAME_CREATOR_PROJECT_PLANNING_AGENT_ID {
|
||||
built_request = build_game_creator_agent_background_tool_plan_request(
|
||||
built_request = build_game_creator_agent_background_tool_plan_request_locked(
|
||||
root,
|
||||
&_lock,
|
||||
agent_id,
|
||||
session_id,
|
||||
run_id,
|
||||
|
||||
Reference in New Issue
Block a user