fix(attempt): pass resolved workspace path into recordTokenUsage

runEmbeddedAttempt calls process.chdir(effectiveWorkspace) early in the
run, then later invokes recordTokenUsage with the raw params.workspaceDir
string.  If workspaceDir is a relative path (e.g. ./ws) recordTokenUsage
resolves it from the already-changed cwd, producing a nested path
(`./ws/ws/memory/token-usage.json`) or an outright failure.

Fix: pass effectiveWorkspace (the fully-resolved, sandbox-aware absolute
path that was used for every other workspace operation in the run) into
recordTokenUsage so usage logs always land in the correct directory.
This commit is contained in:
jiarung 2026-03-16 01:59:17 +00:00
parent 3e2cf1bd8d
commit 01a13e6ab4

View File

@ -2822,7 +2822,7 @@ export async function runEmbeddedAttempt(
}
recordTokenUsage({
workspaceDir: params.workspaceDir,
workspaceDir: effectiveWorkspace,
runId: params.runId,
sessionId: params.sessionId,
sessionKey: params.sessionKey,