fix: recover Workbench terminal outbox projection

This commit is contained in:
lyon
2026-06-20 20:06:33 +08:00
parent c4e44e1db8
commit bad5a478bd
7 changed files with 256 additions and 16 deletions
+15 -8
View File
@@ -1425,7 +1425,7 @@ function agentRunProjectionResumeCandidateFromState(state = {}, { minAgeMs = DEF
}
async function resumeAgentRunProjectionCandidate({ candidate, options = {}, traceStore = defaultCodeAgentTraceStore } = {}) {
const currentResult = await agentRunProjectionResumeResultWithCursor(candidate, options);
const { currentResult } = await agentRunProjectionResumeResultWithCursor(candidate, options);
const resumeOptions = { ...options, deferAgentRunResultSync: false };
const synced = await syncAgentRunChatResult({
traceId: candidate.traceId,
@@ -1450,12 +1450,15 @@ async function agentRunProjectionResumeResultWithCursor(candidate, options = {})
pageLimit: options.env?.HWLAB_CODE_AGENT_AGENTRUN_EVENTS_PAGE_LIMIT
});
return {
...candidate.result,
traceSummary: null,
agentRun: {
...candidate.result.agentRun,
lastSeq: plan.afterSeq,
valuesPrinted: false
projectionState,
currentResult: {
...candidate.result,
traceSummary: null,
agentRun: {
...candidate.result.agentRun,
lastSeq: plan.afterSeq,
valuesPrinted: false
}
}
};
}
@@ -2283,7 +2286,11 @@ export async function handleCodeAgentCancelHttp(request, response, options) {
}
const payload = await cancelAgentRunChatTurn({ traceId, currentResult, options, traceStore });
if (payload) {
await recordCodeAgentSessionOwner({ payload, params: { ...params, traceId, ownerUserId: options.actor?.id, ownerRole: options.actor?.role }, options, status: "canceled" });
if (payload.alreadyTerminal === true || isTraceCommandTerminalStatus(payload.status)) {
await recordCodeAgentTerminalTurnStatusEffects({ payload, params: { ...params, traceId, ownerUserId: options.actor?.id, ownerRole: options.actor?.role }, options, preserveLastTraceId: true });
} else {
await recordCodeAgentSessionOwner({ payload, params: { ...params, traceId, ownerUserId: options.actor?.id, ownerRole: options.actor?.role }, options, status: "canceled" });
}
sendJson(response, 200, payload);
return;
}