Skip to content

The agent that grows with you

fix(kanban): keep the project_id alias past the unknown-argument gate

teknium19887307eec2a
diff --git a/tests/tools/test_kanban_unknown_arguments.py b/tests/tools/test_kanban_unknown_arguments.py
index 31fec981d9e..f7e5b33ad3a 100644
--- a/tests/tools/test_kanban_unknown_arguments.py
+++ b/tests/tools/test_kanban_unknown_arguments.py
@@ -50,3 +50,17 @@ def test_registered_kanban_tools_reject_unknown_keys():
result = json.loads(registry.dispatch(name, {'misspelled_argument': True}))
assert 'unknown parameter' in result.get('error', ''), (name, result)
assert 'misspelled_argument' in result['error']
+
+
+def test_undeclared_internal_keys_survive_the_strict_check():
+ """``project_id`` (legacy alias of ``project``) and ``session_id`` (internal
+ provenance) are read by ``_handle_create`` without being in the LLM-facing
+ schema; the unknown-key gate must not reject them (#115641 follow-up)."""
+ from tools import kanban_tools
+ from tools.registry import registry
+ # No board in this test: an accepted key set reaches the handler proper and
+ # fails on the *next* validation, never on "unknown parameter".
+ result = json.loads(registry.dispatch(
+ 'kanban_create', {'title': 'x', 'project_id': '', 'session_id': 's'}))
+ assert 'unknown parameter' not in result.get('error', ''), result
+ assert 'project_id' in kanban_tools._UNDECLARED_ARGS['kanban_create']
diff --git a/tools/kanban_tools.py b/tools/kanban_tools.py
index 19d72f2d537..5c009afba66 100644
--- a/tools/kanban_tools.py
+++ b/tools/kanban_tools.py
@@ -126,6 +126,14 @@ def _check(cond: Any, message: str) -> None:
raise _Reject(message)
+# Keys a handler reads that its LLM-facing schema deliberately does not declare:
+# ``session_id`` is provenance stamped by internal callers (31fe2290393), ``project_id``
+# the pre-``project`` alias still honoured by ``_handle_create`` (e7811345c17).
+_UNDECLARED_ARGS: dict[str, frozenset[str]] = {
+ "kanban_create": frozenset({"session_id", "project_id"}),
+}
+
+
def _kanban_handler(tool_name: str) -> Callable:
"""Wrap a handler so every failure is a structured tool error. ``ValueError``
(invalid board slug, DB validation such as cycle/self-link, ``AttachmentTooLarge``)
@@ -136,10 +144,7 @@ def _kanban_handler(tool_name: str) -> Callable:
try:
# Reject typos before a handoff can succeed without its artifacts.
properties = registry.get_schema(tool_name)["parameters"]["properties"]
- allowed = set(properties)
- # Creation also accepts a durable-session override from internal callers.
- if tool_name == "kanban_create":
- allowed.add("session_id")
+ allowed = set(properties) | _UNDECLARED_ARGS.get(tool_name, frozenset())
unknown = sorted(set(args) - allowed)
_check(not unknown,
f"{tool_name}: unknown parameter(s): {', '.join(unknown)}. "