fix(rate-limit): mark retry status updates non-interactive to avoid ask race

This commit is contained in:
daniel-lxs 2025-11-03 16:18:18 -05:00
parent 0b42d73dff
commit 7b46d60901
No known key found for this signature in database
GPG key ID: 21C74479048B3AA6

View file

@ -2679,6 +2679,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
const sendRateLimitUpdate = async (payload: RateLimitRetryPayload, isPartial: boolean): Promise<void> => {
await this.say("api_req_retry_delayed", undefined, undefined, isPartial, undefined, undefined, {
isNonInteractive: true,
metadata: { rateLimitRetry: payload },
})
}
@ -2988,7 +2989,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
`[Task#attemptApiRequest] task ${this.taskId}.${this.instanceId} aborted during retry`,
)
}
// Delegate generator output from the recursive call with
// incremented retry count.
yield* this.attemptApiRequest(retryAttempt + 1)
@ -3086,11 +3087,9 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
})()
// Helper to send rate limit updates with structured metadata
const sendRateLimitUpdate = async (
payload: RateLimitRetryPayload,
isPartial: boolean,
): Promise<void> => {
const sendRateLimitUpdate = async (payload: RateLimitRetryPayload, isPartial: boolean): Promise<void> => {
await this.say("api_req_retry_delayed", undefined, undefined, isPartial, undefined, undefined, {
isNonInteractive: true,
metadata: { rateLimitRetry: payload },
})
}