Auto-reply: fix non-default agent session transcript path resolution (#15154)

* Auto-reply: fix non-default agent transcript path resolution

* Auto-reply: harden non-default agent transcript lookups

* Auto-reply: harden session path resolution across agent stores
This commit is contained in:
Gustavo Madeira Santana
2026-02-12 23:23:12 -05:00
committed by GitHub
parent 79a38858ae
commit ac41176532
13 changed files with 321 additions and 16 deletions

View File

@@ -6,7 +6,7 @@ import {
isEmbeddedPiRunActive,
waitForEmbeddedPiRunEnd,
} from "../../agents/pi-embedded.js";
import { resolveSessionFilePath } from "../../config/sessions.js";
import { resolveSessionFilePath, resolveSessionFilePathOptions } from "../../config/sessions.js";
import { logVerbose } from "../../globals.js";
import { enqueueSystemEvent } from "../../infra/system-events.js";
import { formatContextUsageShort, formatTokenCount } from "../status.js";
@@ -79,7 +79,14 @@ export const handleCompactCommand: CommandHandler = async (params) => {
groupChannel: params.sessionEntry.groupChannel,
groupSpace: params.sessionEntry.space,
spawnedBy: params.sessionEntry.spawnedBy,
sessionFile: resolveSessionFilePath(sessionId, params.sessionEntry),
sessionFile: resolveSessionFilePath(
sessionId,
params.sessionEntry,
resolveSessionFilePathOptions({
agentId: params.agentId,
storePath: params.storePath,
}),
),
workspaceDir: params.workspaceDir,
config: params.cfg,
skillsSnapshot: params.sessionEntry.skillsSnapshot,

View File

@@ -106,6 +106,7 @@ export async function buildStatusReply(params: {
sessionEntry?: SessionEntry;
sessionKey: string;
sessionScope?: SessionScope;
storePath?: string;
provider: string;
model: string;
contextTokens: number;
@@ -124,6 +125,7 @@ export async function buildStatusReply(params: {
sessionEntry,
sessionKey,
sessionScope,
storePath,
provider,
model,
contextTokens,
@@ -225,6 +227,7 @@ export async function buildStatusReply(params: {
sessionEntry,
sessionKey,
sessionScope,
sessionStorePath: storePath,
groupActivation,
resolvedThink: resolvedThinkLevel ?? (await resolveDefaultThinkingLevel()),
resolvedVerbose: resolvedVerboseLevel,

View File

@@ -17,6 +17,7 @@ import {
import {
resolveGroupSessionKey,
resolveSessionFilePath,
resolveSessionFilePathOptions,
type SessionEntry,
updateSessionStore,
} from "../../config/sessions.js";
@@ -316,7 +317,11 @@ export async function runPreparedReply(
}
}
const sessionIdFinal = sessionId ?? crypto.randomUUID();
const sessionFile = resolveSessionFilePath(sessionIdFinal, sessionEntry);
const sessionFile = resolveSessionFilePath(
sessionIdFinal,
sessionEntry,
resolveSessionFilePathOptions({ agentId, storePath }),
);
const queueBodyBase = baseBodyForPrompt;
const queuedBody = mediaNote
? [mediaNote, mediaReplyHint, queueBodyBase].filter(Boolean).join("\n").trim()