fix: preserve inter-session input provenance (thanks @anbecker)

This commit is contained in:
Peter Steinberger
2026-02-13 02:01:53 +01:00
parent 7081dee1af
commit 85409e401b
25 changed files with 415 additions and 12 deletions

View File

@@ -24,6 +24,9 @@ export async function runAgentStep(params: {
timeoutMs: number;
channel?: string;
lane?: string;
sourceSessionKey?: string;
sourceChannel?: string;
sourceTool?: string;
}): Promise<string | undefined> {
const stepIdem = crypto.randomUUID();
const response = await callGateway<{ runId?: string }>({
@@ -36,6 +39,12 @@ export async function runAgentStep(params: {
channel: params.channel ?? INTERNAL_MESSAGE_CHANNEL,
lane: params.lane ?? AGENT_LANE_NESTED,
extraSystemPrompt: params.extraSystemPrompt,
inputProvenance: {
kind: "inter_session",
sourceSessionKey: params.sourceSessionKey,
sourceChannel: params.sourceChannel,
sourceTool: params.sourceTool ?? "sessions_send",
},
},
timeoutMs: 10_000,
});

View File

@@ -83,6 +83,10 @@ export async function runSessionsSendA2AFlow(params: {
extraSystemPrompt: replyPrompt,
timeoutMs: params.announceTimeoutMs,
lane: AGENT_LANE_NESTED,
sourceSessionKey: nextSessionKey,
sourceChannel:
nextSessionKey === params.requesterSessionKey ? params.requesterChannel : targetChannel,
sourceTool: "sessions_send",
});
if (!replyText || isReplySkip(replyText)) {
break;
@@ -110,6 +114,9 @@ export async function runSessionsSendA2AFlow(params: {
extraSystemPrompt: announcePrompt,
timeoutMs: params.announceTimeoutMs,
lane: AGENT_LANE_NESTED,
sourceSessionKey: params.requesterSessionKey,
sourceChannel: params.requesterChannel,
sourceTool: "sessions_send",
});
if (announceTarget && announceReply && announceReply.trim() && !isAnnounceSkip(announceReply)) {
try {

View File

@@ -260,6 +260,12 @@ export function createSessionsSendTool(opts?: {
channel: INTERNAL_MESSAGE_CHANNEL,
lane: AGENT_LANE_NESTED,
extraSystemPrompt: agentMessageContext,
inputProvenance: {
kind: "inter_session",
sourceSessionKey: opts?.agentSessionKey,
sourceChannel: opts?.agentChannel,
sourceTool: "sessions_send",
},
};
const requesterSessionKey = opts?.agentSessionKey;
const requesterChannel = opts?.agentChannel;