mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 17:40:44 +00:00
refactor: reuse model-id prefix helper for Gemini guard
This commit is contained in:
committed by
Peter Steinberger
parent
0ce93c9f1a
commit
0ec3b79c07
@@ -14,7 +14,7 @@ import { resolveAgentExecutionContract, resolveSessionAgentIds } from "./agent-s
|
||||
* bare names. The adversarial review in #64227 flagged this as a quality
|
||||
* gap on completion-gate criterion 1.
|
||||
*/
|
||||
function stripProviderPrefix(modelId: string): string {
|
||||
export function stripProviderPrefix(modelId: string): string {
|
||||
const normalizedModelId = modelId.trim();
|
||||
const match = /^([^/:]+)[/:](.+)$/.exec(normalizedModelId);
|
||||
return (match?.[2] ?? normalizedModelId).toLowerCase();
|
||||
|
||||
@@ -2,7 +2,10 @@ import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
||||
import { isSilentReplyPayloadText, SILENT_REPLY_TOKEN } from "../../../auto-reply/tokens.js";
|
||||
import type { EmbeddedPiExecutionContract } from "../../../config/types.agent-defaults.js";
|
||||
import { normalizeLowercaseStringOrEmpty } from "../../../shared/string-coerce.js";
|
||||
import { isStrictAgenticSupportedProviderModel } from "../../execution-contract.js";
|
||||
import {
|
||||
isStrictAgenticSupportedProviderModel,
|
||||
stripProviderPrefix,
|
||||
} from "../../execution-contract.js";
|
||||
import { isLikelyMutatingToolName } from "../../tool-mutation.js";
|
||||
import { assessLastAssistantMessage } from "../thinking.js";
|
||||
import type { EmbeddedRunLivenessState } from "../types.js";
|
||||
@@ -83,7 +86,7 @@ const GEMINI_INCOMPLETE_TURN_PROVIDER_IDS = new Set([
|
||||
"google-antigravity",
|
||||
"google-gemini-cli",
|
||||
]);
|
||||
const GEMINI_INCOMPLETE_TURN_MODEL_ID_PATTERN = /^gemini(?:[.-]|$)/i;
|
||||
const GEMINI_INCOMPLETE_TURN_MODEL_ID_PATTERN = /^gemini(?:[.-]|$)/;
|
||||
const DEFAULT_PLANNING_ONLY_RETRY_LIMIT = 1;
|
||||
const STRICT_AGENTIC_PLANNING_ONLY_RETRY_LIMIT = 2;
|
||||
// Allow one immediate continuation plus one follow-up continuation before
|
||||
@@ -407,12 +410,6 @@ function shouldApplyPlanningOnlyRetryGuard(params: {
|
||||
});
|
||||
}
|
||||
|
||||
function stripProviderPrefix(modelId: string): string {
|
||||
const normalizedModelId = modelId.trim();
|
||||
const match = /^([^/:]+)[/:](.+)$/.exec(normalizedModelId);
|
||||
return (match?.[2] ?? normalizedModelId).toLowerCase();
|
||||
}
|
||||
|
||||
function isIncompleteTurnRecoverySupportedProviderModel(params: {
|
||||
provider?: string;
|
||||
modelId?: string;
|
||||
|
||||
Reference in New Issue
Block a user