fix(editor): block rename applies to correct block when selection changes (#3129)

This commit is contained in:
Waleed
2026-02-03 20:06:03 -08:00
committed by GitHub
parent 5b0c2156e0
commit 7977ac88ca
7 changed files with 95 additions and 45 deletions

View File

@@ -130,6 +130,7 @@ export class ExecutionEngine {
this.context.metadata.duration = endTime - startTime
if (this.cancelledFlag) {
this.finalizeIncompleteLogs()
return {
success: false,
output: this.finalOutput,
@@ -151,6 +152,7 @@ export class ExecutionEngine {
this.context.metadata.duration = endTime - startTime
if (this.cancelledFlag) {
this.finalizeIncompleteLogs()
return {
success: false,
output: this.finalOutput,
@@ -474,4 +476,20 @@ export class ExecutionEngine {
pauseCount: responses.length,
}
}
/**
* Finalizes any block logs that were still running when execution was cancelled.
* Sets their endedAt to now and calculates the actual elapsed duration.
*/
private finalizeIncompleteLogs(): void {
const now = new Date()
const nowIso = now.toISOString()
for (const log of this.context.blockLogs) {
if (!log.endedAt) {
log.endedAt = nowIso
log.durationMs = now.getTime() - new Date(log.startedAt).getTime()
}
}
}
}