Skip to content

Commit d10dacd

Browse files
committed
fix(reply): restore queued admission counts
1 parent dd2bfa6 commit d10dacd

3 files changed

Lines changed: 4 additions & 7 deletions

File tree

‎src/auto-reply/reply/reply-dispatcher.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -612,10 +612,7 @@ export function createReplyDispatcher(options: ReplyDispatcherOptions): ReplyDis
612612
await waitForIdle();
613613
return buildReceipt();
614614
},
615-
getQueuedCounts: () =>
616-
mapReplyDispatchCounts(settledCounts, (counts) =>
617-
Object.values(counts).reduce((total, count) => total + count, 0),
618-
),
615+
getQueuedCounts: () => ({ ...queuedCounts }),
619616
getCancelledCounts: () => mapReplyDispatchCounts(settledCounts, (counts) => counts.cancelled),
620617
getFailedCounts: () =>
621618
mapReplyDispatchCounts(

‎src/auto-reply/reply/reply-dispatcher.types.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export type ReplyDispatcher = {
6060
) => void;
6161
supportsSettledReceipt?: true;
6262
waitForIdle: () => Promise<void | ReplyDispatchReceipt>;
63-
/** @deprecated Remove in the next Plugin SDK major; derived from settled receipts. */
63+
/** @deprecated Remove in the next Plugin SDK major; retains admission-time counts. */
6464
getQueuedCounts: () => Record<ReplyDispatchKind, number>;
6565
/** @deprecated Remove in the next Plugin SDK major; derived from settled receipts. */
6666
getCancelledCounts?: () => Record<ReplyDispatchKind, number>;

‎src/plugin-sdk/reply-runtime.contract.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe("reply runtime public progress contracts", () => {
4848
});
4949

5050
describe("reply runtime public dispatcher compatibility", () => {
51-
it("projects deprecated counters from settled receipt outcomes", async () => {
51+
it("preserves deprecated admission counters beside settled receipt outcomes", async () => {
5252
let releaseFirstDelivery!: () => void;
5353
const firstDelivery = new Promise<void>((resolve) => {
5454
releaseFirstDelivery = resolve;
@@ -71,7 +71,7 @@ describe("reply runtime public dispatcher compatibility", () => {
7171
dispatcher.sendBlockReply({ text: "cancel" });
7272
dispatcher.sendFinalReply({ text: "fail" });
7373

74-
expect(dispatcher.getQueuedCounts()).toEqual({ tool: 0, block: 0, final: 0 });
74+
expect(dispatcher.getQueuedCounts()).toEqual({ tool: 1, block: 1, final: 1 });
7575
expect(dispatcher.getCancelledCounts?.()).toEqual({ tool: 0, block: 0, final: 0 });
7676
expect(dispatcher.getFailedCounts()).toEqual({ tool: 0, block: 0, final: 0 });
7777

0 commit comments

Comments
 (0)