fix: 等待云端智能体资源释放后续接工具结果

This commit is contained in:
2026-09-24 17:02:24 +08:00
parent 0e22e0545d
commit 79914e1d06
4 changed files with 160 additions and 1 deletions

View File

@@ -92,6 +92,20 @@ export function teacherCloudTransport(account: TeacherAccount): TeacherCloudTran
if (!response.ok) {
const data = object(await response.json());
const detail = data.detail;
const conflict = detail && typeof detail === 'object' && !Array.isArray(detail)
? object(detail) : undefined;
const pendingRun = /^\/runs\/([^/]+)\/tool-results$/.exec(path)?.[1];
if (signal && response.status === 409 && pendingRun && body !== undefined
&& conflict?.code === 'run_busy'
&& conflict.active_run_id === decodeURIComponent(pendingRun)
&& conflict.active_run_status === 'interrupted') {
// Yuxi commits the interrupt before releasing its runtime. Keep the
// same result batch while that parent still owns the cleanup fence.
// The question's original deadline/cancellation bounds this wait.
await delay(500, undefined, { signal });
attempt--;
continue;
}
const message =
typeof detail === 'string'
? detail