fix(core): Resolve context initialization mismatch in built-in tools

- Update ShellTool, WebFetchTool, and WebSearchTool to handle both Config and AgentLoopContext.
- Add safety checks for config in ToolConfirmationMessage UI.
- Add safety checks for context.config in policy update logic.
- Fixes #23174
This commit is contained in:
mkorwel
2026-03-19 16:32:46 -07:00
parent 8615315711
commit 68d00feb62
6 changed files with 170 additions and 51 deletions
@@ -88,13 +88,14 @@ export const ToolConfirmationMessage: React.FC<
const settings = useSettings();
const allowPermanentApproval =
settings.merged.security.enablePermanentToolApproval &&
!config.getDisableAlwaysAllow();
(config?.getDisableAlwaysAllow ? !config.getDisableAlwaysAllow() : true);
const handlesOwnUI =
confirmationDetails.type === 'ask_user' ||
confirmationDetails.type === 'exit_plan_mode';
const isTrustedFolder =
config.isTrustedFolder() && !config.getDisableAlwaysAllow();
config?.isTrustedFolder?.() &&
(config?.getDisableAlwaysAllow ? !config.getDisableAlwaysAllow() : true);
const handleConfirm = useCallback(
(outcome: ToolConfirmationOutcome, payload?: ToolConfirmationPayload) => {