fix(plugin): ignore compaction session agent updates

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-03-07 15:39:25 +09:00
parent 92da22412c
commit 4f3dcb043c
2 changed files with 89 additions and 1 deletions
+6 -1
View File
@@ -97,6 +97,11 @@ function extractProviderModelFromErrorMessage(message: string): { providerID?: s
return {};
}
function isCompactionAgent(agent: string): boolean {
return agent.toLowerCase() === "compaction";
}
type EventInput = Parameters<NonNullable<NonNullable<CreatedHooks["writeExistingFileGuard"]>["event"]>>[0];
export function createEventHandler(args: {
ctx: PluginContext;
@@ -261,7 +266,7 @@ export function createEventHandler(args: {
const agent = info?.agent as string | undefined;
const role = info?.role as string | undefined;
if (sessionID && role === "user") {
if (agent) {
if (agent && !isCompactionAgent(agent)) {
updateSessionAgent(sessionID, agent);
}
const providerID = info?.providerID as string | undefined;