mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 12:21:35 +00:00
fix(agents): honor explicit rate-limit cooldown probes in fallback runs
This commit is contained in:
@@ -186,7 +186,7 @@ export async function runAgentTurnWithFallback(params: {
|
||||
const onToolResult = params.opts?.onToolResult;
|
||||
const fallbackResult = await runWithModelFallback({
|
||||
...resolveModelFallbackOptions(params.followupRun.run),
|
||||
run: (provider, model) => {
|
||||
run: (provider, model, runOptions) => {
|
||||
// Notify that model selection is complete (including after fallback).
|
||||
// This allows responsePrefix template interpolation with the actual model.
|
||||
params.opts?.onModelSelected?.({
|
||||
@@ -304,6 +304,7 @@ export async function runAgentTurnWithFallback(params: {
|
||||
model,
|
||||
runId,
|
||||
authProfile,
|
||||
allowRateLimitCooldownProbe: runOptions?.allowRateLimitCooldownProbe,
|
||||
});
|
||||
return (async () => {
|
||||
const result = await runEmbeddedPiAgent({
|
||||
|
||||
@@ -474,7 +474,7 @@ export async function runMemoryFlushIfNeeded(params: {
|
||||
try {
|
||||
await runWithModelFallback({
|
||||
...resolveModelFallbackOptions(params.followupRun.run),
|
||||
run: async (provider, model) => {
|
||||
run: async (provider, model, runOptions) => {
|
||||
const { authProfile, embeddedContext, senderContext } = buildEmbeddedRunContexts({
|
||||
run: params.followupRun.run,
|
||||
sessionCtx: params.sessionCtx,
|
||||
@@ -487,6 +487,7 @@ export async function runMemoryFlushIfNeeded(params: {
|
||||
model,
|
||||
runId: flushRunId,
|
||||
authProfile,
|
||||
allowRateLimitCooldownProbe: runOptions?.allowRateLimitCooldownProbe,
|
||||
});
|
||||
const result = await runEmbeddedPiAgent({
|
||||
...embeddedContext,
|
||||
|
||||
@@ -166,6 +166,7 @@ export function buildEmbeddedRunBaseParams(params: {
|
||||
model: string;
|
||||
runId: string;
|
||||
authProfile: ReturnType<typeof resolveProviderScopedAuthProfile>;
|
||||
allowRateLimitCooldownProbe?: boolean;
|
||||
}) {
|
||||
return {
|
||||
sessionFile: params.run.sessionFile,
|
||||
@@ -186,6 +187,7 @@ export function buildEmbeddedRunBaseParams(params: {
|
||||
bashElevated: params.run.bashElevated,
|
||||
timeoutMs: params.run.timeoutMs,
|
||||
runId: params.runId,
|
||||
allowRateLimitCooldownProbe: params.allowRateLimitCooldownProbe,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ export function createFollowupRunner(params: {
|
||||
agentId: queued.run.agentId,
|
||||
sessionKey: queued.run.sessionKey,
|
||||
}),
|
||||
run: async (provider, model) => {
|
||||
run: async (provider, model, runOptions) => {
|
||||
const authProfile = resolveRunAuthProfile(queued.run, provider);
|
||||
const result = await runEmbeddedPiAgent({
|
||||
sessionId: queued.run.sessionId,
|
||||
@@ -200,6 +200,7 @@ export function createFollowupRunner(params: {
|
||||
bashElevated: queued.run.bashElevated,
|
||||
timeoutMs: queued.run.timeoutMs,
|
||||
runId,
|
||||
allowRateLimitCooldownProbe: runOptions?.allowRateLimitCooldownProbe,
|
||||
blockReplyBreak: queued.run.blockReplyBreak,
|
||||
bootstrapPromptWarningSignaturesSeen,
|
||||
bootstrapPromptWarningSignature:
|
||||
|
||||
Reference in New Issue
Block a user