fix(core,tui): resolve stuck compacting status with terminal compaction events
This commit is contained in:
parent
674d08f9be
commit
4f4cb8cb36
10 changed files with 297 additions and 6 deletions
|
|
@ -535,7 +535,14 @@ export const { use: useData, provider: DataProvider } = createSimpleContext({
|
|||
break
|
||||
case "session.next.compaction.delta":
|
||||
break
|
||||
case "session.next.compaction.failed":
|
||||
// Started marked the session running; without this a failed compaction
|
||||
// leaves the session spinning forever. Mid-run auto compaction is
|
||||
// followed by step events that set the status again.
|
||||
setStore("session", "status", event.data.sessionID, "idle")
|
||||
break
|
||||
case "session.next.compaction.ended":
|
||||
setStore("session", "status", event.data.sessionID, "idle")
|
||||
message.update(event.data.sessionID, (draft, index) => {
|
||||
message.append(draft, index, {
|
||||
id: event.data.messageID,
|
||||
|
|
|
|||
|
|
@ -248,6 +248,41 @@ test("tracks session status from active sessions and execution events", async ()
|
|||
},
|
||||
})
|
||||
await wait(() => data.session.status("session-failed") === "idle")
|
||||
|
||||
emitEvent(events, {
|
||||
id: "evt_compaction_started",
|
||||
type: "session.next.compaction.started",
|
||||
data: { sessionID: "session-compacting", messageID: "message-compaction", timestamp: 5, reason: "manual" },
|
||||
})
|
||||
await wait(() => data.session.status("session-compacting") === "running")
|
||||
|
||||
emitEvent(events, {
|
||||
id: "evt_compaction_ended",
|
||||
type: "session.next.compaction.ended",
|
||||
data: {
|
||||
sessionID: "session-compacting",
|
||||
messageID: "message-compaction",
|
||||
timestamp: 6,
|
||||
reason: "manual",
|
||||
text: "summary",
|
||||
recent: "",
|
||||
},
|
||||
})
|
||||
await wait(() => data.session.status("session-compacting") === "idle")
|
||||
|
||||
emitEvent(events, {
|
||||
id: "evt_compaction_started_again",
|
||||
type: "session.next.compaction.started",
|
||||
data: { sessionID: "session-compacting", messageID: "message-compaction-2", timestamp: 7, reason: "manual" },
|
||||
})
|
||||
await wait(() => data.session.status("session-compacting") === "running")
|
||||
|
||||
emitEvent(events, {
|
||||
id: "evt_compaction_failed",
|
||||
type: "session.next.compaction.failed",
|
||||
data: { sessionID: "session-compacting", messageID: "message-compaction-2", timestamp: 8, reason: "manual" },
|
||||
})
|
||||
await wait(() => data.session.status("session-compacting") === "idle")
|
||||
} finally {
|
||||
app.renderer.destroy()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue