修复 Agent Runtime 锁等待竞态
Project CI / Frontend tests (pull_request) Successful in 5m12s
Project CI / Backend tests (pull_request) Successful in 8m4s
Project CI / Repository checks (pull_request) Successful in 4m28s
Project CI / Native shell tests (pull_request) Successful in 16m19s

延长运行时任务锁的有界等待窗口。

避免慢速磁盘或 CI 负载下误报 Agent 正在执行。
This commit is contained in:
2026-09-02 17:52:24 +08:00
parent bbcb89c9d4
commit d0a7c8ed25
@@ -2403,13 +2403,17 @@ pub(super) fn try_acquire_game_creator_agent_runtime_task_lock_with_wait(
root: &Path,
agent_id: &str,
) -> Result<Option<AgentRuntimeTaskLock>, String> {
for attempt in 0..25 {
// Runtime state transitions can persist several audit projections while holding
// the lane lock. Keep the wait bounded, but allow a slow CI/disk-backed
// transition to finish before reporting a false busy error.
const MAX_ATTEMPTS: usize = 100;
for attempt in 0..MAX_ATTEMPTS {
if let Some(runtime_lock) =
try_acquire_game_creator_agent_runtime_task_lock(root, agent_id)?
{
return Ok(Some(runtime_lock));
}
if attempt < 24 {
if attempt + 1 < MAX_ATTEMPTS {
std::thread::sleep(Duration::from_millis(10));
}
}