|
|
@@ -1599,6 +1599,30 @@ it('queues an unsubmitted turn while computer capacity is unavailable and submit
|
|
|
expect(requests.filter(request=>request.method==='prompt.submit')).toHaveLength(1)
|
|
|
})
|
|
|
|
|
|
+it('fails an unsubmitted turn immediately when the computer runner is offline',async()=>{
|
|
|
+ const a=store.updateAgent(owner,agent('离线电脑').id,{execution:'computer',computer:'vm'}),c=direct(a.id)
|
|
|
+ nodes.targetForAgent=vi.fn(()=>{throw new HttpError(503,'执行节点未连接,请启动 Runner 后重试','runner_offline')})
|
|
|
+ const run=runtime.send(owner,c.id,{requestId:randomUUID(),content:'不能无声等待'})
|
|
|
+ await vi.waitFor(()=>expect(store.require<WorkspaceRun>(owner,'run',run.id).status).toBe('failed'))
|
|
|
+ const work=store.list<Work>(owner,'turn').find(work=>work.runId===run.id)!
|
|
|
+ expect(work.resourceWait).toBe(false)
|
|
|
+ expect(work.error).toBe('执行节点未连接,请启动 Runner 后重试')
|
|
|
+ expect(store.messages(owner,c.id).at(-1)?.content).toBe('执行失败:执行节点未连接,请启动 Runner 后重试')
|
|
|
+})
|
|
|
+
|
|
|
+it('can stop an unsubmitted turn that is waiting for computer capacity',async()=>{
|
|
|
+ const a=store.updateAgent(owner,agent('可停止等候').id,{execution:'computer',computer:'vm'}),c=direct(a.id)
|
|
|
+ nodes.targetForAgent=vi.fn(()=>{throw new HttpError(429,'资源不足','computer_quota')})
|
|
|
+ const run=runtime.send(owner,c.id,{requestId:randomUUID(),content:'等待中停止'})
|
|
|
+ const work=await vi.waitFor(()=>{
|
|
|
+ const current=store.list<Work>(owner,'turn').find(work=>work.runId===run.id)
|
|
|
+ expect(current?.resourceWait).toBe(true)
|
|
|
+ return current!
|
|
|
+ })
|
|
|
+ await runtime.stop(owner,run.id)
|
|
|
+ await vi.waitFor(()=>expect(store.require<Work>(owner,'turn',work.id).status).toBe('interrupted'))
|
|
|
+})
|
|
|
+
|
|
|
it('forwards a generated artifact to a new task without changing its original provenance',async()=>{
|
|
|
const a=agent('产物接收者'),c=direct(a.id)
|
|
|
const first=runtime.send(owner,c.id,{requestId:randomUUID(),content:'first'})
|