diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_request_builders.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_request_builders.rs index 58363e5ed..c1d521d5e 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_request_builders.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_actions/provider_request_builders.rs @@ -345,10 +345,12 @@ pub(in crate::agent) fn build_game_creator_background_agent_context( )?; let repository_context = build_repository_startup_context_at(root)?; let repository_prompt = render_repository_startup_context_for_prompt(&repository_context); - let identity_instruction = if matches!(mode, AgentBackgroundContextMode::FinalReply) { - "" - } else if template_agent_id == GAME_CREATOR_PROJECT_SUPERVISOR_AGENT_ID { - game_creator_project_supervisor_identity_contract_prompt() + let identity_instruction = if template_agent_id == GAME_CREATOR_PROJECT_SUPERVISOR_AGENT_ID { + if matches!(mode, AgentBackgroundContextMode::FinalReply) { + "" + } else { + game_creator_project_supervisor_identity_contract_prompt() + } } else { "请只以这个专业 Agent 的身份行动。" }; @@ -731,6 +733,7 @@ mod tests { let ordinary_prompt = &ordinary_request.messages[1].content; assert!(!ordinary_prompt.contains(supervisor_identity_contract)); assert!(ordinary_prompt.contains(ORDINARY_NOTICE)); + assert!(ordinary_prompt.contains("请只以这个专业 Agent 的身份行动")); assert!(!ordinary_prompt.contains(SUPERVISOR_NOTICE)); assert!(!ordinary_prompt.contains(MEMORY_MARKER)); @@ -778,6 +781,21 @@ mod tests { ); assert!(!final_user_prompt.contains(supervisor_identity_contract)); assert!(!final_user_prompt.contains("你拥有最终回复权")); + + let (_, _, ordinary_final_request) = + build_game_creator_agent_background_final_reply_request( + &root, + "code-prototype", + &ordinary_state.session_id, + &ordinary_state.run_id, + &ordinary_state.current_task, + &plan, + &[], + ) + .expect("build ordinary final reply request"); + assert!(ordinary_final_request.messages[1] + .content + .contains("请只以这个专业 Agent 的身份行动")); } #[test]