(run: AgentRun, backend: AgentBackend)
| 3042 | } |
| 3043 | |
| 3044 | private assertRunCanDispatch(run: AgentRun, backend: AgentBackend): void { |
| 3045 | const active = [...this.backendGenerations.values()].find( |
| 3046 | (candidate) => candidate.backend === backend, |
| 3047 | ); |
| 3048 | if ( |
| 3049 | run.isStopped() || |
| 3050 | !active || |
| 3051 | active.phase !== 'active' || |
| 3052 | !this.isCurrentGeneration(active) || |
| 3053 | active.activeRuns.get(run.runId) !== run || |
| 3054 | active.turnToRunId.get(run.turnId) !== run.runId |
| 3055 | ) { |
| 3056 | throw new Error(`Run ${run.runId} no longer owns an active backend generation`); |
| 3057 | } |
| 3058 | } |
| 3059 | |
| 3060 | private isCurrentGeneration(active: BackendGeneration): boolean { |
| 3061 | return active.route.kind === 'parent' |
no test coverage detected