Skip to content

Commit 987c73e

Browse files
coolmannsobviyus
andauthored
fix(auto-reply): surface empty message-tool-only completions (#105765)
Ensure empty message-tool-only completions receive one marked fallback while preserving explicit silence and completed deliveries. Co-authored-by: Sascha Kuhlmann <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
1 parent 4f68eee commit 987c73e

6 files changed

Lines changed: 42 additions & 7 deletions

‎src/auto-reply/reply/agent-runner-failure-reply.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const EMPTY_INTERACTIVE_REPLY_TEXT =
88
describe("buildEmptyInteractiveReplyPayload", () => {
99
const baseParams = {
1010
isInteractive: true,
11-
isMessageToolOnly: false,
1211
hasPendingContinuation: false,
1312
hasExplicitSilentReply: false,
1413
hasCommittedDelivery: false,

‎src/auto-reply/reply/agent-runner-failure-reply.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ export function buildEmptyInteractiveReplyPayload(params: {
327327
isHeartbeat?: boolean;
328328
silentExpected?: boolean;
329329
allowEmptyAssistantReplyAsSilent?: boolean;
330-
isMessageToolOnly: boolean;
331330
hasPendingContinuation: boolean;
332331
hasExplicitSilentReply: boolean;
333332
hasCommittedDelivery: boolean;
@@ -339,7 +338,6 @@ export function buildEmptyInteractiveReplyPayload(params: {
339338
params.isHeartbeat === true ||
340339
params.silentExpected === true ||
341340
params.allowEmptyAssistantReplyAsSilent === true ||
342-
params.isMessageToolOnly ||
343341
params.hasPendingContinuation ||
344342
params.hasExplicitSilentReply ||
345343
params.hasCommittedDelivery

‎src/auto-reply/reply/agent-runner-result-payloads.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,6 @@ export async function prepareReplyAgentPayloads(state: {
144144
isHeartbeat,
145145
silentExpected: followupRun.run.silentExpected,
146146
allowEmptyAssistantReplyAsSilent: followupRun.run.allowEmptyAssistantReplyAsSilent,
147-
isMessageToolOnly:
148-
(opts?.sourceReplyDeliveryMode ?? followupRun.run.sourceReplyDeliveryMode) ===
149-
"message_tool_only",
150147
hasPendingContinuation: pendingContinuation,
151148
hasExplicitSilentReply: deliberateSilentTerminalReply,
152149
hasCommittedDelivery: successfulTerminalDelivery,

‎src/auto-reply/reply/agent-runner.runreplyagent.e2e.test.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3773,6 +3773,22 @@ describe("runReplyAgent typing (heartbeat)", () => {
37733773
);
37743774
});
37753775

3776+
it("surfaces a marked fallback for an empty message-tool-only completion", async () => {
3777+
state.runEmbeddedAgentMock.mockResolvedValueOnce({ payloads: [], meta: {} });
3778+
const { run } = createMinimalRun({
3779+
opts: { sourceReplyDeliveryMode: "message_tool_only" },
3780+
});
3781+
3782+
const result = await run();
3783+
const payload = Array.isArray(result) ? result[0] : result;
3784+
3785+
expect(payload).toMatchObject({
3786+
text: expect.stringContaining("did not produce a visible reply"),
3787+
isError: true,
3788+
});
3789+
expect(getReplyPayloadMetadata(payload ?? {})?.deliverDespiteSourceReplySuppression).toBe(true);
3790+
});
3791+
37763792
it.each([
37773793
{ lane: "reasoning", payload: { text: "internal", isReasoning: true } },
37783794
{ lane: "commentary", payload: { text: "internal", isCommentary: true } },

‎src/auto-reply/reply/followup-delivery.test.ts‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,32 @@ describe("resolveFollowupDeliveryDecision", () => {
715715
});
716716
});
717717

718+
it("delivers a sanitized fallback for an empty message-tool-only completion", () => {
719+
const turn = createTurn();
720+
turn.queued.run.sourceReplyDeliveryMode = "message_tool_only";
721+
722+
const decision = resolveFollowupDeliveryDecision({
723+
turn,
724+
execution: createSettledExecution(),
725+
accounting: createAccounting(),
726+
});
727+
728+
expect(decision).toMatchObject({
729+
kind: "deliver",
730+
payloads: [
731+
{
732+
text: expect.stringContaining("did not produce a visible reply"),
733+
isError: true,
734+
},
735+
],
736+
});
737+
if (decision.kind === "deliver") {
738+
expect(
739+
getReplyPayloadMetadata(decision.payloads[0] ?? {})?.deliverDespiteSourceReplySuppression,
740+
).toBe(true);
741+
}
742+
});
743+
718744
it("keeps a terminal failure when suppressed partial output is present", () => {
719745
const turn = createTurn();
720746
turn.queued.run.sourceReplyDeliveryMode = "message_tool_only";

‎src/auto-reply/reply/followup-delivery.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ export function resolveFollowupDeliveryDecision(params: {
212212
isHeartbeat: opts?.isHeartbeat,
213213
silentExpected: turn.queued.run.silentExpected,
214214
allowEmptyAssistantReplyAsSilent: turn.queued.run.allowEmptyAssistantReplyAsSilent,
215-
isMessageToolOnly: sourcePolicy.sourceReplyDeliveryMode === "message_tool_only",
216215
hasPendingContinuation:
217216
result.meta?.yielded === true || (result.meta?.pendingToolCalls?.length ?? 0) > 0,
218217
hasExplicitSilentReply: hasDeliberateSilentTerminalReply(result),

0 commit comments

Comments
 (0)