feat: make Kafka projector the Workbench realtime authority
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "bun:test";
|
||||
|
||||
import { cancelAgentRunChatTurn, syncAgentRunChatResult } from "./code-agent-agentrun-adapter.ts";
|
||||
import { cancelAgentRunChatTurn } from "./code-agent-agentrun-adapter.ts";
|
||||
import { createCodeAgentTraceStore } from "./code-agent-trace-store.ts";
|
||||
|
||||
test("AgentRun cancel downstream failure returns visible blocked disposition instead of throwing", async () => {
|
||||
@@ -54,44 +54,3 @@ test("AgentRun cancel downstream failure returns visible blocked disposition ins
|
||||
assert.equal(codeAgentChatResults.get(traceId)?.cancelDisposition?.code, "command_not_cancelable");
|
||||
assert.ok(traceStore.snapshot(traceId).events.some((event) => event.label === "agentrun:cancel:blocked" && event.status === "blocked"));
|
||||
});
|
||||
|
||||
test("AgentRun result sync preserves a user-canceled payload instead of accepting late completed result", async () => {
|
||||
const traceId = "trc_cancel_sealed_result";
|
||||
const traceStore = createCodeAgentTraceStore();
|
||||
const currentResult = {
|
||||
traceId,
|
||||
status: "canceled",
|
||||
canceled: true,
|
||||
cancelStatus: "canceled",
|
||||
cancelDisposition: { status: "canceled", forwarded: true, terminal: true, traceId, valuesPrinted: false },
|
||||
finalResponse: { text: "hwlab-user-cancel", status: "canceled", traceId, valuesPrinted: false },
|
||||
agentRun: {
|
||||
runId: "run_cancel_sealed_result",
|
||||
commandId: "cmd_cancel_sealed_result",
|
||||
managerUrl: "http://127.0.0.1:65535",
|
||||
status: "cancelled",
|
||||
commandState: "cancelled",
|
||||
terminalStatus: "cancelled",
|
||||
traceId,
|
||||
valuesPrinted: false
|
||||
},
|
||||
valuesPrinted: false
|
||||
};
|
||||
|
||||
const synced = await syncAgentRunChatResult({
|
||||
traceId,
|
||||
currentResult,
|
||||
traceStore,
|
||||
options: {
|
||||
env: { HWLAB_CODE_AGENT_AGENTRUN_ALLOW_NON_K3S_URL: "1" },
|
||||
fetchImpl() {
|
||||
throw new Error("late AgentRun result must not be fetched after HWLAB user cancel is sealed");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
assert.equal(synced.localCancelSealed, true);
|
||||
assert.equal(synced.resultSynced, false);
|
||||
assert.equal(synced.result.status, "canceled");
|
||||
assert.equal(synced.result.finalResponse.text, "hwlab-user-cancel");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user