fix(coding): bound missing Pi settlement
This commit is contained in:
@@ -1474,19 +1474,20 @@ export class PiConversationRuntime implements CodingConversationRuntime {
|
||||
const current = snapshot?.run;
|
||||
if (!snapshot
|
||||
|| snapshot.cursor.workerGeneration !== event.generation
|
||||
|| current?.runId !== event.runId
|
||||
|| runIsTerminal(current.status)) return;
|
||||
this.emit(event.conversationId, {
|
||||
op: 'run.state',
|
||||
run: {
|
||||
status: 'idle',
|
||||
runId: event.runId,
|
||||
...(current.mode ? { mode: current.mode } : {}),
|
||||
...(current.startedAt !== undefined ? { startedAt: current.startedAt } : {}),
|
||||
settledAt: this.now(),
|
||||
terminalReason: 'completed',
|
||||
},
|
||||
}, event.runId);
|
||||
|| current?.runId !== event.runId) return;
|
||||
if (!runIsTerminal(current.status)) {
|
||||
this.emit(event.conversationId, {
|
||||
op: 'run.state',
|
||||
run: {
|
||||
status: 'idle',
|
||||
runId: event.runId,
|
||||
...(current.mode ? { mode: current.mode } : {}),
|
||||
...(current.startedAt !== undefined ? { startedAt: current.startedAt } : {}),
|
||||
settledAt: this.now(),
|
||||
terminalReason: current.status === 'aborting' ? 'aborted' : 'completed',
|
||||
},
|
||||
}, event.runId);
|
||||
}
|
||||
this.extensionUi.endRun(event.conversationId, event.runId);
|
||||
try {
|
||||
await Promise.allSettled([
|
||||
@@ -1500,6 +1501,12 @@ export class PiConversationRuntime implements CodingConversationRuntime {
|
||||
} finally {
|
||||
this.releaseRunBackgroundLease(event.conversationId, event.runId);
|
||||
}
|
||||
if (event.source === 'state_probe') {
|
||||
const worker = this.pool.getState(event.conversationId);
|
||||
if (worker?.generation === event.generation && worker.state !== 'crashed') {
|
||||
await this.hydrateGenerationNow(event.conversationId, worker, false);
|
||||
}
|
||||
}
|
||||
}).catch((error) => {
|
||||
this.recordProjectionFailure(event.conversationId, event.generation, error);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user