fix: trigger compaction before continue after session error recovery (fixes #390)
This commit is contained in:
@@ -148,6 +148,8 @@ export function createEventHandler(args: {
|
||||
body: { parts: Array<{ type: "text"; text: string }> };
|
||||
query: { directory: string };
|
||||
}) => Promise<unknown>;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
summarize: (...args: any[]) => Promise<unknown>;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -502,6 +504,17 @@ export function createEventHandler(args: {
|
||||
sessionID === getMainSessionID() &&
|
||||
!hooks.stopContinuationGuard?.isStopped(sessionID)
|
||||
) {
|
||||
// Trigger compaction before sending "continue" to avoid double-sending continuation
|
||||
await pluginContext.client.session
|
||||
.summarize({
|
||||
path: { id: sessionID },
|
||||
body: { auto: true },
|
||||
query: { directory: pluginContext.directory },
|
||||
})
|
||||
.catch((err: unknown) => {
|
||||
log("[event] compaction before recovery continue failed:", { sessionID, error: err });
|
||||
});
|
||||
|
||||
await pluginContext.client.session
|
||||
.prompt({
|
||||
path: { id: sessionID },
|
||||
|
||||
Reference in New Issue
Block a user