Merge pull request #1682 from pikasTech/fix/agentrun-invalid-session-reset
修复失效 AgentRun profile session 回填旧 thread
This commit is contained in:
@@ -392,6 +392,22 @@ export async function submitAgentRunChatTurn({ params = {}, options = {}, traceI
|
|||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
const ensuredSessionRecord = agentRunSessionRecordFromEnsure(ensuredSession);
|
||||||
|
if (attempt === 0 && agentRunSessionThreadInvalidated(ensuredSessionRecord)) {
|
||||||
|
sessionReset = true;
|
||||||
|
traceStore.append(traceId, agentRunTraceEvent({
|
||||||
|
type: "backend",
|
||||||
|
status: "running",
|
||||||
|
label: "agentrun:profile-session-reset",
|
||||||
|
message: "AgentRun profile-scoped session " + sessionId + " is terminal after a thread/resume failure; hwlab-cloud-api will create a fresh profile sessionId instead of letting AgentRun manager backfill a stale threadId.",
|
||||||
|
sessionId,
|
||||||
|
previousSessionId: baseSessionId,
|
||||||
|
backendProfile,
|
||||||
|
waitingFor: "agentrun-session-reset",
|
||||||
|
valuesPrinted: false
|
||||||
|
}, backendProfile));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const profileThreadId = agentRunSessionThreadIdFromEnsure(ensuredSession);
|
const profileThreadId = agentRunSessionThreadIdFromEnsure(ensuredSession);
|
||||||
const dispatchParams = paramsWithAgentRunSessionThread(attemptParams, profileThreadId);
|
const dispatchParams = paramsWithAgentRunSessionThread(attemptParams, profileThreadId);
|
||||||
if (safeOpaqueId(attemptParams.threadId) && !profileThreadId) {
|
if (safeOpaqueId(attemptParams.threadId) && !profileThreadId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user