清理测试用途代码并减少七十条编译警告
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m10s
Project CI / Backend tests (pull_request) Failing after 15s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m26s
Project CI / Frontend tests (pull_request) Successful in 1m59s
Project CI / Repository checks (pull_request) Failing after 18s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m30s
Project CI / Native shell tests (pull_request) Successful in 5m38s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 8m38s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 7m23s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m10s
Project CI / Backend tests (pull_request) Failing after 15s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m26s
Project CI / Frontend tests (pull_request) Successful in 1m59s
Project CI / Repository checks (pull_request) Failing after 18s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m30s
Project CI / Native shell tests (pull_request) Successful in 5m38s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 8m38s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 7m23s
收紧测试辅助代码的编译范围并删除退役实现和冗余包装 逐项核对原测试断言,仅保留现役契约覆盖并调整必要调用 移除未消费的Pending错误载荷,保留持久错误记录和恢复验证 保留四条待澄清契约项,更新警告清单与实施文档 验证一百七十八个定向Rust测试,默认构建警告从一百二十条降至五十条
This commit is contained in:
@@ -935,11 +935,11 @@ fn render_rust(manifest: &PromptBundleManifest, sections: &BTreeMap<String, Stri
|
||||
let mut output =
|
||||
String::from("// @generated by build.rs from prompts/runtime/manifest.json\n\n");
|
||||
output.push_str(&format!(
|
||||
"pub(crate) const RUNTIME_PROMPT_BUNDLE_ID: &str = {};\n",
|
||||
"#[cfg(test)]\npub(crate) const RUNTIME_PROMPT_BUNDLE_ID: &str = {};\n",
|
||||
rust_literal(&manifest.id)
|
||||
));
|
||||
output.push_str(&format!(
|
||||
"pub(crate) const RUNTIME_PROMPT_BUNDLE_VERSION: &str = {};\n",
|
||||
"#[cfg(test)]\npub(crate) const RUNTIME_PROMPT_BUNDLE_VERSION: &str = {};\n",
|
||||
rust_literal(&manifest.version)
|
||||
));
|
||||
output.push_str("pub(crate) fn runtime_prompt_bundle_section(id: &str) -> Option<&'static str> {\n match id {\n");
|
||||
|
||||
@@ -720,6 +720,7 @@ pub(super) fn resolve_direct_codex_project_authority(
|
||||
Ok((project_root.clone(), project_root))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn resolve_direct_codex_game_workspace(
|
||||
project_root: &std::path::Path,
|
||||
) -> Result<std::path::PathBuf, String> {
|
||||
@@ -1933,6 +1934,7 @@ fn direct_tools_mcp_executable_path() -> Result<std::path::PathBuf, platform_llm
|
||||
Ok(current_executable)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn configure_game_creator_codex_app_server_command(
|
||||
command: &mut tokio::process::Command,
|
||||
llm: &GameCreatorLlmConfig,
|
||||
@@ -2513,6 +2515,7 @@ impl CodexAppServerConnection {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
async fn spawn_with_executable_and_credential_at_workspace(
|
||||
llm: &GameCreatorLlmConfig,
|
||||
credential: &CodexAppServerCredential,
|
||||
|
||||
@@ -313,6 +313,7 @@ async fn proxy_codex_provider_request(
|
||||
.unwrap_or_else(|_| proxy_error(StatusCode::BAD_GATEWAY, "provider response invalid"))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) async fn start_codex_provider_proxy(
|
||||
upstream_base_url: &str,
|
||||
upstream_bearer_token: &str,
|
||||
|
||||
@@ -1225,6 +1225,7 @@ fn design_panic_error(_payload: Box<dyn std::any::Any + Send>) -> String {
|
||||
DESIGN_PANIC_PUBLIC_ERROR.to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) async fn continue_design_agent_at(
|
||||
root: &Path,
|
||||
resources: &DesignResources,
|
||||
@@ -1311,6 +1312,7 @@ async fn recover_uncertain_design_batch(
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) async fn decide_design_phase_at(
|
||||
root: &Path,
|
||||
resources: &DesignResources,
|
||||
|
||||
@@ -100,12 +100,6 @@ fn direct_codex_game_outputs(root: &Path) -> Vec<(String, GameCreationAppAssetKi
|
||||
]
|
||||
}
|
||||
|
||||
fn direct_existing_game_sources_exist(root: &Path) -> bool {
|
||||
direct_codex_game_outputs(root)
|
||||
.iter()
|
||||
.all(|(path, _, _)| root.join(path).is_file())
|
||||
}
|
||||
|
||||
/// Art generation is an external, billable side effect. Existing direct
|
||||
/// projects therefore stay in their same-thread code-edit/preview loop unless
|
||||
/// the user explicitly asks for a new game or a visual regeneration.
|
||||
@@ -6625,14 +6619,6 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn existing_game_edits_do_not_request_a_fresh_art_generation_by_default() {
|
||||
let root = tempfile::tempdir().expect("temp dir");
|
||||
init_local_game_project_at(root.path(), "direct-edit-intent", "继续编辑")
|
||||
.expect("init project");
|
||||
std::fs::write(root.path().join("game/index.html"), "<!doctype html>").expect("index");
|
||||
std::fs::write(root.path().join("game/style.css"), "body {};").expect("style");
|
||||
std::fs::write(root.path().join("game/game.js"), "console.log('edit');").expect("script");
|
||||
|
||||
assert!(direct_existing_game_sources_exist(root.path()));
|
||||
for prompt in [
|
||||
"把棋盘上移一点",
|
||||
"修复闪烁",
|
||||
|
||||
@@ -329,6 +329,7 @@ impl DirectThreadEvent {
|
||||
/// 本轮开口用户条目的 canonical itemId:只有生命周期事件有,其余返回 `None`。
|
||||
///
|
||||
/// 只读已存入事件的值,不在读取时重算——重放要用的就是原事件的身份。
|
||||
#[cfg(test)]
|
||||
pub(crate) fn user_item_id(&self) -> Option<&str> {
|
||||
match self {
|
||||
Self::TurnStarted { user_item_id, .. } | Self::TurnCompleted { user_item_id, .. } => {
|
||||
@@ -361,6 +362,7 @@ impl DirectThreadEvent {
|
||||
/// 事件级阶段时间(毫秒):只有四种生命周期事件有,其余事件返回 `None`。
|
||||
///
|
||||
/// 只读已存入事件的值,不在读取时取钟——重放要用的就是原事件的时间。
|
||||
#[cfg(test)]
|
||||
pub(crate) fn at(&self) -> Option<u64> {
|
||||
match self {
|
||||
Self::TurnStarted { at, .. }
|
||||
|
||||
@@ -395,6 +395,7 @@ fn direct_resource_request_uuid(turn_id: &str, domain: &str, request_fingerprint
|
||||
uuid::Uuid::from_bytes(bytes).hyphenated().to_string()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn direct_tool_bridge_state(root: PathBuf) -> Arc<DirectToolBridgeState> {
|
||||
direct_tool_bridge_state_with_search(root, false)
|
||||
}
|
||||
|
||||
@@ -1145,6 +1145,7 @@ pub(crate) fn external_generation_submit_rejection_is_definitive(
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) async fn wait_for_external_generation_result(
|
||||
client: &reqwest::Client,
|
||||
api_base_url: &str,
|
||||
|
||||
@@ -342,14 +342,6 @@ pub(super) fn unix_timestamp_nanos() -> u128 {
|
||||
.as_nanos()
|
||||
}
|
||||
|
||||
pub(crate) fn build_game_creator_role_agent_chat_request(
|
||||
root: &Path,
|
||||
agent_id: &str,
|
||||
prompt: &str,
|
||||
) -> Result<(GameCreatorLlmConfig, String, LlmRunRequest), String> {
|
||||
build_game_creator_role_agent_chat_request_for_session(root, agent_id, None, prompt)
|
||||
}
|
||||
|
||||
pub(crate) fn build_game_creator_role_agent_chat_request_for_session(
|
||||
root: &Path,
|
||||
agent_id: &str,
|
||||
|
||||
@@ -48,10 +48,13 @@ pub(in crate::agent) use tool_plan_protocol::*;
|
||||
pub(crate) use action_audit::agent_runtime_action_receipt_public_safe_detail_for_test;
|
||||
#[cfg(test)]
|
||||
pub(crate) use action_audit::agent_runtime_action_receipt_safe_detail_for_owner_for_test;
|
||||
#[cfg(test)]
|
||||
pub(crate) use action_audit::{
|
||||
agent_runtime_git_commit_safe_detail_value, agent_runtime_tool_action_fingerprint,
|
||||
agent_runtime_tool_action_id, agent_runtime_tool_action_input_summary,
|
||||
append_agent_runtime_action_receipt,
|
||||
agent_runtime_git_commit_safe_detail_value, append_agent_runtime_action_receipt,
|
||||
};
|
||||
pub(crate) use action_audit::{
|
||||
agent_runtime_tool_action_fingerprint, agent_runtime_tool_action_id,
|
||||
agent_runtime_tool_action_input_summary,
|
||||
append_agent_runtime_action_receipt_with_project_revision_before,
|
||||
append_agent_runtime_tool_call_record, AgentRuntimeToolPolicyBlock,
|
||||
};
|
||||
@@ -85,7 +88,6 @@ pub(crate) use parallel_read::{
|
||||
rewind_game_creator_agent_runtime_parallel_read_batch_for_test_at,
|
||||
};
|
||||
pub(crate) use pending_confirmation_ledger::{
|
||||
agent_runtime_contains_secret_key_prefix,
|
||||
game_creator_agent_runtime_pending_tool_action_exists,
|
||||
read_game_creator_agent_runtime_pending_tool_action,
|
||||
write_game_creator_agent_runtime_pending_tool_action,
|
||||
@@ -140,7 +142,8 @@ pub(crate) use structured_plan::{
|
||||
// 复核,只对测试开放;生产代码必须用 `_for_agent`。
|
||||
#[cfg(test)]
|
||||
pub(crate) use tool_plan_protocol::parse_game_creator_agent_tool_plan_llm_response;
|
||||
pub(crate) use tool_plan_protocol::parse_game_creator_agent_tool_plan_response;
|
||||
#[cfg(test)]
|
||||
pub(crate) use tool_plan_protocol::parse_game_creator_agent_tool_plan_response_classified;
|
||||
pub(crate) use tool_policy_snapshot::{
|
||||
agent_runtime_acceptance_evidence_tools,
|
||||
agent_runtime_autonomous_design_foundation_command_is_allowed, agent_runtime_executable_tools,
|
||||
|
||||
@@ -77,6 +77,7 @@ pub(crate) fn append_agent_runtime_tool_call_record(
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn append_agent_runtime_action_receipt(
|
||||
root: &Path,
|
||||
runtime: &AgentRuntimeState,
|
||||
|
||||
-14
@@ -207,20 +207,6 @@ fn agent_runtime_serialized_string_value(value: &str) -> &str {
|
||||
value
|
||||
}
|
||||
|
||||
pub(crate) fn agent_runtime_contains_secret_key_prefix(content: &str, prefix: &str) -> bool {
|
||||
content
|
||||
.match_indices(prefix)
|
||||
.any(|(index, _)| agent_runtime_secret_token_end(content, index, prefix).is_some())
|
||||
}
|
||||
|
||||
pub(in crate::agent) fn agent_runtime_secret_token_end(
|
||||
content: &str,
|
||||
index: usize,
|
||||
prefix: &str,
|
||||
) -> Option<usize> {
|
||||
agent_runtime_secret_token_end_with_minimum(content, index, prefix, 8)
|
||||
}
|
||||
|
||||
pub(in crate::agent) fn agent_runtime_secret_token_end_with_minimum(
|
||||
content: &str,
|
||||
index: usize,
|
||||
|
||||
+17
-7
@@ -469,8 +469,8 @@ fn response_stream_finalization_commits_exactly_one_canonical_assistant() {
|
||||
.expect("finalize response stream assistant")
|
||||
{
|
||||
AgentBackgroundFinalizationOutcome::Completed(completed) => completed,
|
||||
AgentBackgroundFinalizationOutcome::Pending(error) => {
|
||||
panic!("response stream finalization remained pending: {error}")
|
||||
AgentBackgroundFinalizationOutcome::Pending => {
|
||||
panic!("response stream finalization remained pending")
|
||||
}
|
||||
AgentBackgroundFinalizationOutcome::Stale(blocker) => {
|
||||
panic!(
|
||||
@@ -706,7 +706,7 @@ fn response_stream_finalization_recovers_missing_stream_after_project_revision_d
|
||||
.expect("inject finalization interruption before stream commit");
|
||||
assert!(matches!(
|
||||
outcome,
|
||||
AgentBackgroundFinalizationOutcome::Pending(_)
|
||||
AgentBackgroundFinalizationOutcome::Pending
|
||||
));
|
||||
assert!(read_game_creator_agent_runtime_response_stream_at(
|
||||
root,
|
||||
@@ -767,9 +767,19 @@ fn response_stream_finalization_repairs_streaming_after_commit_write_failure() {
|
||||
.expect("finalization commit failure remains recoverable");
|
||||
assert!(matches!(
|
||||
outcome,
|
||||
AgentBackgroundFinalizationOutcome::Pending(ref error)
|
||||
if error.contains("injected-response-stream-commit-failure")
|
||||
AgentBackgroundFinalizationOutcome::Pending
|
||||
));
|
||||
let audit = std::fs::read_to_string(root.join(".agent/agent.db"))
|
||||
.expect("read finalization pending audit");
|
||||
assert!(audit.lines().any(|line| {
|
||||
let record: serde_json::Value = serde_json::from_str(line).expect("agent db record");
|
||||
record.get("recordType").and_then(serde_json::Value::as_str)
|
||||
== Some("agent.runtime.background_task.finalization_pending")
|
||||
&& record
|
||||
.get("error")
|
||||
.and_then(serde_json::Value::as_str)
|
||||
.is_some_and(|error| error.contains("injected-response-stream-commit-failure"))
|
||||
}));
|
||||
let ready =
|
||||
read_game_creator_agent_runtime_response_stream_at(root, &state.agent_id, &state.run_id)
|
||||
.expect("read repaired ready stream")
|
||||
@@ -835,7 +845,7 @@ fn response_stream_committed_checkpoint_recovers_by_idempotent_cleanup() {
|
||||
.expect("inject committed checkpoint interruption");
|
||||
assert!(matches!(
|
||||
outcome,
|
||||
AgentBackgroundFinalizationOutcome::Pending(_)
|
||||
AgentBackgroundFinalizationOutcome::Pending
|
||||
));
|
||||
let committed_before =
|
||||
read_game_creator_agent_runtime_response_stream_at(root, &state.agent_id, &state.run_id)
|
||||
@@ -899,7 +909,7 @@ fn completed_orphan_finalization_cleanup_keeps_newer_terminal_run() {
|
||||
.expect("leave completed orphan finalization");
|
||||
assert!(matches!(
|
||||
outcome,
|
||||
AgentBackgroundFinalizationOutcome::Pending(_)
|
||||
AgentBackgroundFinalizationOutcome::Pending
|
||||
));
|
||||
assert!(read_game_creator_agent_runtime_finalization_journal(
|
||||
root,
|
||||
|
||||
+1
-8
@@ -1,13 +1,6 @@
|
||||
use super::*;
|
||||
|
||||
pub(crate) fn parse_game_creator_agent_tool_plan_response(
|
||||
content: &str,
|
||||
) -> Result<AgentRuntimeToolPlan, String> {
|
||||
parse_game_creator_agent_tool_plan_response_classified(content)
|
||||
.map_err(|error| error.to_string())
|
||||
}
|
||||
|
||||
pub(in crate::agent) fn parse_game_creator_agent_tool_plan_response_classified(
|
||||
pub(crate) fn parse_game_creator_agent_tool_plan_response_classified(
|
||||
content: &str,
|
||||
) -> Result<AgentRuntimeToolPlan, AgentRuntimeToolPlanProtocolError> {
|
||||
let stripped = strip_llm_thinking_blocks(content);
|
||||
|
||||
@@ -287,11 +287,9 @@ pub(crate) use entrypoints::acquire_game_creator_manifest_invalidation_event_sin
|
||||
#[allow(unused_imports)]
|
||||
pub(crate) use entrypoints::{
|
||||
chat_with_game_creator_agent_at, chat_with_game_creator_role_agent_at,
|
||||
chat_with_game_creator_role_agent_for_session_at, chat_with_game_creator_role_agent_runtime_at,
|
||||
chat_with_game_creator_role_agent_for_session_at,
|
||||
chat_with_game_creator_role_agent_runtime_for_session_at,
|
||||
chat_with_game_creator_role_agent_stream_at,
|
||||
chat_with_game_creator_role_agent_stream_for_session_at,
|
||||
configure_game_creator_manifest_invalidation_event_sink, emit_direct_game_creator_progress,
|
||||
chat_with_game_creator_role_agent_stream_for_session_at, emit_direct_game_creator_progress,
|
||||
emit_game_creator_agent_runtime_update, emit_game_creator_manifest_invalidated,
|
||||
game_creator_agent_runtime_update_event, generate_local_game_draft_at,
|
||||
read_game_creator_agent_runtime_at, read_game_creator_agent_runtime_for_session_at,
|
||||
|
||||
@@ -215,6 +215,7 @@ pub(crate) fn start_game_creator_manifest_invalidation_event_sink(
|
||||
Ok(GameCreatorManifestInvalidationEventSink { port, token })
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn configure_game_creator_manifest_invalidation_event_sink(
|
||||
port: u16,
|
||||
token: &str,
|
||||
@@ -578,16 +579,6 @@ pub(crate) async fn chat_with_game_creator_role_agent_for_session_at(
|
||||
Ok(GameCreatorChatAgentReply { reply_text })
|
||||
}
|
||||
|
||||
pub(crate) async fn chat_with_game_creator_role_agent_runtime_at(
|
||||
root: &Path,
|
||||
agent_id: &str,
|
||||
prompt: &str,
|
||||
run_id: &str,
|
||||
) -> Result<(GameCreatorChatAgentReply, AgentRuntimeState), String> {
|
||||
chat_with_game_creator_role_agent_runtime_for_session_at(root, agent_id, None, prompt, run_id)
|
||||
.await
|
||||
}
|
||||
|
||||
pub(crate) async fn chat_with_game_creator_role_agent_runtime_for_session_at(
|
||||
root: &Path,
|
||||
agent_id: &str,
|
||||
@@ -631,19 +622,6 @@ pub(crate) async fn chat_with_game_creator_role_agent_runtime_for_session_at(
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) async fn chat_with_game_creator_role_agent_stream_at<F>(
|
||||
root: &Path,
|
||||
agent_id: &str,
|
||||
prompt: &str,
|
||||
on_delta: F,
|
||||
) -> Result<GameCreatorChatAgentReply, String>
|
||||
where
|
||||
F: FnMut(&platform_llm::LlmStreamDelta),
|
||||
{
|
||||
chat_with_game_creator_role_agent_stream_for_session_at(root, agent_id, None, prompt, on_delta)
|
||||
.await
|
||||
}
|
||||
|
||||
pub(crate) async fn chat_with_game_creator_role_agent_stream_for_session_at<F>(
|
||||
root: &Path,
|
||||
agent_id: &str,
|
||||
|
||||
@@ -3600,7 +3600,7 @@ async fn run_game_creator_agent_background_task_pass_without_deadline(
|
||||
continuation,
|
||||
}
|
||||
}
|
||||
Ok(AgentBackgroundFinalizationOutcome::Pending(_)) => {
|
||||
Ok(AgentBackgroundFinalizationOutcome::Pending) => {
|
||||
AgentBackgroundTaskOutcome::FinalizationPending
|
||||
}
|
||||
Err(error) => {
|
||||
|
||||
@@ -31,14 +31,18 @@ pub(in crate::agent) use verification::*;
|
||||
|
||||
pub(crate) use autonomous_completion::autonomous_game_build_root_run_active_at;
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) use context_bundle::{
|
||||
build_game_creator_agent_runtime_context_bundle,
|
||||
continuation_from_game_creator_agent_runtime_context_bundle,
|
||||
game_creator_agent_runtime_context_bundle_path, game_creator_agent_runtime_context_project_id,
|
||||
persist_game_creator_agent_runtime_context, read_game_creator_agent_runtime_context_bundle,
|
||||
read_game_creator_agent_runtime_context_bundle_for_idle_compaction,
|
||||
game_creator_agent_runtime_context_bundle_path,
|
||||
write_game_creator_agent_runtime_context_bundle,
|
||||
};
|
||||
pub(crate) use context_bundle::{
|
||||
continuation_from_game_creator_agent_runtime_context_bundle,
|
||||
game_creator_agent_runtime_context_project_id, persist_game_creator_agent_runtime_context,
|
||||
read_game_creator_agent_runtime_context_bundle,
|
||||
read_game_creator_agent_runtime_context_bundle_for_idle_compaction,
|
||||
};
|
||||
pub(crate) use context_window::{
|
||||
agent_runtime_context_window_applies, sanitize_agent_runtime_context_observation,
|
||||
AgentRuntimeContextCheckpoint,
|
||||
@@ -62,7 +66,6 @@ pub(crate) use models::{
|
||||
AgentRuntimeProviderActionBatchPreparation, AgentRuntimeProviderRequestSnapshot,
|
||||
AgentRuntimeToolAction, AgentRuntimeToolObservation, AgentRuntimeToolPlan,
|
||||
AgentRuntimeVerificationGate, ParsedAgentRuntimeToolPlan,
|
||||
AGENT_RUNTIME_LOCK_STALE_AFTER_SECONDS,
|
||||
};
|
||||
#[cfg(test)]
|
||||
pub(crate) use provider_control::mark_game_creator_agent_runtime_provider_success_handoff_needs_reconciliation_for_test;
|
||||
@@ -77,11 +80,14 @@ pub(crate) use response_stream::{
|
||||
};
|
||||
pub(crate) use run_configuration::{
|
||||
agent_runtime_run_profile_identity_at, bind_game_creator_agent_runtime_run_profile_at,
|
||||
game_creator_agent_runtime_project_revision_path,
|
||||
game_creator_agent_runtime_provider_transient_retry_policy_at,
|
||||
game_creator_agent_runtime_run_profile_binding_path,
|
||||
read_game_creator_agent_runtime_run_profile_binding,
|
||||
};
|
||||
#[cfg(test)]
|
||||
pub(crate) use run_configuration::{
|
||||
game_creator_agent_runtime_project_revision_path,
|
||||
game_creator_agent_runtime_run_profile_binding_path,
|
||||
};
|
||||
pub(crate) use steering::{
|
||||
acquire_game_creator_agent_runtime_steer_project_write_lock_with_wait,
|
||||
consume_game_creator_agent_runtime_steers,
|
||||
@@ -94,8 +100,9 @@ pub(crate) use steering::{
|
||||
unregister_game_creator_agent_runtime_provider_request,
|
||||
validate_game_creator_agent_runtime_steer_notification_at,
|
||||
};
|
||||
#[cfg(test)]
|
||||
pub(crate) use verification::game_creator_agent_runtime_verification_gate_path;
|
||||
pub(crate) use verification::{
|
||||
game_creator_agent_runtime_verification_gate_path,
|
||||
read_game_creator_agent_runtime_project_revision,
|
||||
read_game_creator_agent_runtime_verification_gate,
|
||||
write_game_creator_agent_runtime_project_revision,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use super::*;
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn game_creator_agent_runtime_context_bundle_path(
|
||||
root: &Path,
|
||||
agent_id: &str,
|
||||
|
||||
@@ -79,6 +79,7 @@ fn game_creator_agent_runtime_goal_contract_relative_path(
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn game_creator_agent_runtime_goal_contract_path(
|
||||
root: &Path,
|
||||
root_agent_id: &str,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
use super::*;
|
||||
|
||||
pub(crate) const AGENT_RUNTIME_LOCK_STALE_AFTER_SECONDS: u64 = 300;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum AgentBackgroundTaskOutcome {
|
||||
Finished,
|
||||
@@ -84,7 +82,7 @@ pub(crate) enum AgentBackgroundFinalizationOutcome {
|
||||
Completed(AgentRuntimeState),
|
||||
Cancelled(AgentRuntimeState),
|
||||
Stale(AgentRuntimeToolObservation),
|
||||
Pending(String),
|
||||
Pending,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use super::*;
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn game_creator_agent_runtime_project_revision_path(root: &Path) -> PathBuf {
|
||||
root.join(AGENT_RUNTIME_PROJECT_REVISION_RELATIVE_PATH)
|
||||
}
|
||||
@@ -61,6 +62,7 @@ pub(in crate::agent) fn game_creator_agent_runtime_run_profile_binding_relative_
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn game_creator_agent_runtime_run_profile_binding_path(
|
||||
root: &Path,
|
||||
agent_id: &str,
|
||||
|
||||
@@ -11,6 +11,7 @@ pub(in crate::agent) fn game_creator_agent_runtime_verification_gate_relative_pa
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn game_creator_agent_runtime_verification_gate_path(
|
||||
root: &Path,
|
||||
agent_id: &str,
|
||||
|
||||
@@ -1311,12 +1311,12 @@ where
|
||||
) {
|
||||
let error = redact_agent_runtime_error(root, &error, 500);
|
||||
record_game_creator_agent_runtime_finalization_pending(root, &state, &error);
|
||||
return Ok(AgentBackgroundFinalizationOutcome::Pending(error));
|
||||
return Ok(AgentBackgroundFinalizationOutcome::Pending);
|
||||
}
|
||||
if let Err(error) = checkpoint(AgentRuntimeFinalizationCheckpoint::Prepared) {
|
||||
let error = redact_agent_runtime_error(root, &error, 500);
|
||||
record_game_creator_agent_runtime_finalization_pending(root, &state, &error);
|
||||
return Ok(AgentBackgroundFinalizationOutcome::Pending(error));
|
||||
return Ok(AgentBackgroundFinalizationOutcome::Pending);
|
||||
}
|
||||
match advance_game_creator_agent_runtime_finalization_at(
|
||||
root,
|
||||
@@ -1347,7 +1347,7 @@ where
|
||||
Err(error) => {
|
||||
let error = redact_agent_runtime_error(root, &error, 500);
|
||||
record_game_creator_agent_runtime_finalization_pending(root, &state, &error);
|
||||
Ok(AgentBackgroundFinalizationOutcome::Pending(error))
|
||||
Ok(AgentBackgroundFinalizationOutcome::Pending)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2588,6 +2588,7 @@ pub(crate) fn try_open_game_creator_agent_runtime_task_lock_file(
|
||||
))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn game_creator_agent_runtime_task_lock_is_available(
|
||||
root: &Path,
|
||||
agent_id: &str,
|
||||
@@ -2596,43 +2597,6 @@ pub(crate) fn game_creator_agent_runtime_task_lock_is_available(
|
||||
Ok(try_open_game_creator_agent_runtime_task_lock_file(root, &relative_path)?.is_some())
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct AgentRuntimeTaskLockStatus {
|
||||
pub(crate) is_stale: bool,
|
||||
pub(crate) belongs_to_previous_process: bool,
|
||||
}
|
||||
|
||||
pub(crate) fn read_game_creator_agent_runtime_lock_status(
|
||||
path: &Path,
|
||||
) -> AgentRuntimeTaskLockStatus {
|
||||
let Ok(content) = fs::read_to_string(path) else {
|
||||
return AgentRuntimeTaskLockStatus {
|
||||
is_stale: true,
|
||||
belongs_to_previous_process: true,
|
||||
};
|
||||
};
|
||||
let Ok(value) = serde_json::from_str::<serde_json::Value>(&content) else {
|
||||
return AgentRuntimeTaskLockStatus {
|
||||
is_stale: true,
|
||||
belongs_to_previous_process: true,
|
||||
};
|
||||
};
|
||||
let pid = value.get("pid").and_then(serde_json::Value::as_u64);
|
||||
let created_at = value
|
||||
.get("createdAt")
|
||||
.and_then(serde_json::Value::as_u64)
|
||||
.unwrap_or(0);
|
||||
let is_stale = created_at == 0
|
||||
|| unix_timestamp().saturating_sub(created_at) > AGENT_RUNTIME_LOCK_STALE_AFTER_SECONDS;
|
||||
let belongs_to_previous_process = pid
|
||||
.map(|pid| pid != u64::from(std::process::id()))
|
||||
.unwrap_or(true);
|
||||
AgentRuntimeTaskLockStatus {
|
||||
is_stale,
|
||||
belongs_to_previous_process,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn write_game_creator_agent_runtime_state(
|
||||
root: &Path,
|
||||
state: &AgentRuntimeState,
|
||||
|
||||
@@ -48,6 +48,8 @@ pub(crate) use delivery::{
|
||||
build_static_delegate_result_for_child_at, wake_waiting_static_delegate_parent_run_for_test_at,
|
||||
};
|
||||
#[cfg(test)]
|
||||
pub(crate) use isolated_joins::render_isolated_join_status_batch_with_limit;
|
||||
#[cfg(test)]
|
||||
pub(crate) use media::validate_agent_runtime_canvas_replacement_authorization_at;
|
||||
|
||||
pub(crate) use action_history::{
|
||||
@@ -57,8 +59,7 @@ pub(crate) use command_ops::{
|
||||
observe_agent_runtime_limited_command, observe_agent_runtime_project_verify,
|
||||
};
|
||||
pub(crate) use delegation::{
|
||||
observe_agent_runtime_agent_delegate, observe_agent_runtime_agent_message,
|
||||
observe_agent_runtime_agent_spawn_isolated,
|
||||
observe_agent_runtime_agent_message, observe_agent_runtime_agent_spawn_isolated,
|
||||
};
|
||||
pub(crate) use delivery::{
|
||||
agent_runtime_delegation_id, dispatch_isolated_agent_join_at,
|
||||
@@ -66,9 +67,7 @@ pub(crate) use delivery::{
|
||||
reconcile_game_creator_agent_delegate_receipts_at,
|
||||
};
|
||||
#[allow(unused_imports)]
|
||||
pub(crate) use isolated_joins::{
|
||||
mark_isolated_join_claim_observed_at, render_isolated_join_status_batch,
|
||||
};
|
||||
pub(crate) use isolated_joins::mark_isolated_join_claim_observed_at;
|
||||
#[cfg(test)]
|
||||
pub(crate) use media::observe_agent_runtime_platform_art_asset_generation_after_dispatch_for_test;
|
||||
#[allow(unused_imports)]
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user