Description
@kernel_function's _parse_parameter() calls meta.pop("description") on dict metadata inside typing.Annotated, mutating the caller's dict. Reusing one shared metadata dict across kernel functions silently strips the parameter description from every function after the first, and leaves the user's dict empty.
Reproduction
from typing import Annotated
from semantic_kernel.functions.kernel_function_decorator import kernel_function
from semantic_kernel.functions import KernelFunctionFromMethod
shared = {"description": "the answer count"}
@kernel_function
def a(x: Annotated[int, shared]) -> int: ...
@kernel_function
def b(y: Annotated[int, shared]) -> int: ...
KernelFunctionFromMethod(a, "a").metadata.parameters[0].description # 'the answer count'
KernelFunctionFromMethod(b, "b").metadata.parameters[0].description # None <-- lost
shared # {} <-- caller's dict mutated
Expected behavior
Decoration never mutates caller-owned metadata; both functions see the description.
Environment
semantic-kernel python main (ca40aa72), Python 3.12
Description
@kernel_function's_parse_parameter()callsmeta.pop("description")on dict metadata insidetyping.Annotated, mutating the caller's dict. Reusing one shared metadata dict across kernel functions silently strips the parameter description from every function after the first, and leaves the user's dict empty.Reproduction
Expected behavior
Decoration never mutates caller-owned metadata; both functions see the description.
Environment
semantic-kernel python main (
ca40aa72), Python 3.12