From e618add87667d6eb79b850d50780828791b68494 Mon Sep 17 00:00:00 2001 From: "shuwen.wu" Date: Fri, 25 Sep 2026 16:09:52 +0800 Subject: [PATCH] fix: @kernel_function: do not mutate shared Annotated metadata dicts _parse_parameter() called meta.pop('description') on the typing.Annotated metadata dict, which mutates the caller's dict. When one shared metadata dict is reused across multiple kernel functions, the description is lost from all functions after the first decoration. Replace pop with get() so the shared dict is never modified. Fixes #14441. --- python/semantic_kernel/functions/kernel_function_decorator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/semantic_kernel/functions/kernel_function_decorator.py b/python/semantic_kernel/functions/kernel_function_decorator.py index 4d103a1a9093..79a83fc4f18f 100644 --- a/python/semantic_kernel/functions/kernel_function_decorator.py +++ b/python/semantic_kernel/functions/kernel_function_decorator.py @@ -152,7 +152,7 @@ def _parse_parameter(name: str, param: Any, default: Any) -> dict[str, Any]: ret["description"] = meta elif isinstance(meta, dict): # only override from the metadata if it is not already set - if "description" not in ret and (description := meta.pop("description", None)): + if "description" not in ret and (description := meta.get("description")): ret["description"] = description ret.update(meta) else: