()
| 3249 | } |
| 3250 | |
| 3251 | async function pumpRunQueue() { |
| 3252 | if ( |
| 3253 | state.run.status === 'running' || |
| 3254 | persistentHost?.activeTurn || |
| 3255 | (clawChild && clawChild.exitCode === null) || |
| 3256 | pendingApprovalRequest |
| 3257 | ) { |
| 3258 | syncQueuedState() |
| 3259 | updateState(draft => { |
| 3260 | draft.run.queue = state.run.queue |
| 3261 | draft.run.pendingApproval = state.run.pendingApproval |
| 3262 | }) |
| 3263 | return |
| 3264 | } |
| 3265 | |
| 3266 | const next = runQueue.shift() |
| 3267 | syncQueuedState() |
| 3268 | persistRuntimeQueueStateSoon() |
| 3269 | updateState(draft => { |
| 3270 | draft.run.queue = state.run.queue |
| 3271 | draft.run.pendingApproval = state.run.pendingApproval |
| 3272 | }) |
| 3273 | |
| 3274 | if (!next) { |
| 3275 | return |
| 3276 | } |
| 3277 | |
| 3278 | if (next.approval) { |
| 3279 | await markPendingApproval(next) |
| 3280 | return |
| 3281 | } |
| 3282 | |
| 3283 | await executeRunRequest(next) |
| 3284 | } |
| 3285 | |
| 3286 | async function approvePendingRun() { |
| 3287 | if (!pendingApprovalRequest) { |
no test coverage detected