fix: don't repurpose tokenCount as budget, normalize workspaceDir in hook ctx

- Remove tokenCount from before_compaction in engine-owned path since we
  don't have actual transcript token counts (was incorrectly set to
  budget). tokenCount is optional in the hook type.
- Resolve workspaceDir via resolveUserPath() to match the normalized
  path used in compactEmbeddedPiSessionDirect.
This commit is contained in:
David Rudduck
2026-03-10 02:35:21 +10:00
committed by Josh Lehman
parent d105436c60
commit 054ded7b02

View File

@@ -952,7 +952,7 @@ export async function compactEmbeddedPiSession(
sessionId: params.sessionId,
agentId: sessionAgentId,
sessionKey: hookSessionKey,
workspaceDir: params.workspaceDir,
workspaceDir: resolveUserPath(params.workspaceDir),
messageProvider: resolvedMessageProvider,
};
// Engine-owned compaction doesn't load the transcript at this level, so
@@ -963,7 +963,6 @@ export async function compactEmbeddedPiSession(
await hookRunner.runBeforeCompaction(
{
messageCount: -1,
tokenCount: ceCtxInfo.tokens,
sessionFile: params.sessionFile,
},
hookCtx,