fix(workbench): pass projection context to message writer (#2012)
This commit is contained in:
@@ -45,7 +45,7 @@ test("code agent trace store dedupes repeated AgentRun source events", () => {
|
||||
assert.deepEqual(snapshot.events.map((item) => item.label), ["agentrun:backend:resource-bundle-materialized", "agentrun:assistant:message"]);
|
||||
});
|
||||
|
||||
test("durable code agent trace store projects appended events without counting assistant deltas", () => {
|
||||
test("durable code agent trace store projects appended events without counting assistant deltas", async () => {
|
||||
const writes = [];
|
||||
const workbenchWrites = [];
|
||||
const baseStore = createCodeAgentTraceStore({ maxEvents: 20 });
|
||||
@@ -66,6 +66,8 @@ test("durable code agent trace store projects appended events without counting a
|
||||
|
||||
traceStore.append(traceId, { type: "request", status: "accepted", label: "request:accepted", sessionId: "ses_trace_store_durable" });
|
||||
traceStore.appendAssistantDelta(traceId, { itemId: "assistant", chunk: "hello" });
|
||||
await Promise.resolve();
|
||||
await Promise.resolve();
|
||||
|
||||
const snapshot = traceStore.snapshot(traceId);
|
||||
assert.equal(snapshot.eventCount, 1);
|
||||
@@ -76,7 +78,8 @@ test("durable code agent trace store projects appended events without counting a
|
||||
assert.equal(writes[0].requestMeta.agentSessionId, "ses_trace_store_durable");
|
||||
assert.equal(workbenchWrites.length, 1);
|
||||
assert.equal(workbenchWrites[0].event.traceId, traceId);
|
||||
assert.equal(workbenchWrites[0].requestMeta.sessionId, undefined);
|
||||
assert.equal(workbenchWrites[0].requestMeta.sessionId, "ses_trace_store_durable");
|
||||
assert.equal(workbenchWrites[0].requestMeta.agentSessionId, "ses_trace_store_durable");
|
||||
});
|
||||
|
||||
test("code agent trace store retains six thousand regular events", () => {
|
||||
|
||||
@@ -265,7 +265,7 @@ async function persistTraceEventAsync(traceEventStore, event, meta = {}, workben
|
||||
}
|
||||
if (typeof workbenchEventWriter === "function") {
|
||||
try {
|
||||
await workbenchEventWriter(event, meta);
|
||||
await workbenchEventWriter(event, projectionContext);
|
||||
} catch (error) {
|
||||
console.error(`[workbench-projection] workbench event writer failed: traceId=${event.traceId} error=${error?.message ?? error}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user