fix(agents): harden bash tool and reply directive handling

This commit is contained in:
Peter Steinberger
2026-02-22 11:29:10 +00:00
parent a4981efae3
commit c343132dbb
3 changed files with 75 additions and 103 deletions

View File

@@ -102,6 +102,31 @@ export async function applyInlineDirectiveOverrides(params: {
let { directives } = params;
let { provider, model } = params;
let { contextTokens } = params;
const directiveModelState = {
allowedModelKeys: modelState.allowedModelKeys,
allowedModelCatalog: modelState.allowedModelCatalog,
resetModelOverride: modelState.resetModelOverride,
};
const createDirectiveHandlingBase = () => ({
cfg,
directives,
sessionEntry,
sessionStore,
sessionKey,
storePath,
elevatedEnabled,
elevatedAllowed,
elevatedFailures,
messageProviderKey,
defaultProvider,
defaultModel,
aliasIndex,
...directiveModelState,
provider,
model,
initialModelLabel,
formatModelSwitchEvent,
});
let directiveAck: ReplyPayload | undefined;
@@ -135,26 +160,7 @@ export async function applyInlineDirectiveOverrides(params: {
});
const currentThinkLevel = resolvedDefaultThinkLevel;
const directiveReply = await handleDirectiveOnly({
cfg,
directives,
sessionEntry,
sessionStore,
sessionKey,
storePath,
elevatedEnabled,
elevatedAllowed,
elevatedFailures,
messageProviderKey,
defaultProvider,
defaultModel,
aliasIndex,
allowedModelKeys: modelState.allowedModelKeys,
allowedModelCatalog: modelState.allowedModelCatalog,
resetModelOverride: modelState.resetModelOverride,
provider,
model,
initialModelLabel,
formatModelSwitchEvent,
...createDirectiveHandlingBase(),
currentThinkLevel,
currentVerboseLevel,
currentReasoningLevel,
@@ -222,9 +228,7 @@ export async function applyInlineDirectiveOverrides(params: {
defaultProvider,
defaultModel,
aliasIndex,
allowedModelKeys: modelState.allowedModelKeys,
allowedModelCatalog: modelState.allowedModelCatalog,
resetModelOverride: modelState.resetModelOverride,
...directiveModelState,
provider,
model,
initialModelLabel,
@@ -232,9 +236,7 @@ export async function applyInlineDirectiveOverrides(params: {
agentCfg,
modelState: {
resolveDefaultThinkingLevel: modelState.resolveDefaultThinkingLevel,
allowedModelKeys: modelState.allowedModelKeys,
allowedModelCatalog: modelState.allowedModelCatalog,
resetModelOverride: modelState.resetModelOverride,
...directiveModelState,
},
});
directiveAck = fastLane.directiveAck;