fix: remove invalid mode kwarg from trace_span + add integration tests

- Remove mode=mode.value from trace_span calls (trace_span only accepts
  name and logger parameters)
- Add TestPermissionModeIntegration tests that verify mode string->enum
  conversion works correctly through the full request flow
- Add TestAgentMethodSignatures tests that verify function signatures
  match expected interfaces (catches invalid kwargs at test time)

These tests would have caught both the mode string/enum issue and the
trace_span invalid kwarg issue before they hit production.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-14 15:46:28 +01:00
co-authored by Claude Opus 4.5
parent 2f11ad79cf
commit 6ea520519c
2 changed files with 189 additions and 2 deletions
+2 -2
View File
@@ -142,7 +142,7 @@ class TaskAgentImpl(BaseAgent):
# Get agent configured for this mode
agent = self._get_agent_for_mode(mode)
async with trace_span("task_agent_run", mode=mode.value):
async with trace_span("task_agent_run"):
try:
result = await agent.run(prompt, deps=ctx)
return result.output
@@ -180,7 +180,7 @@ class TaskAgentImpl(BaseAgent):
# Get agent configured for this mode
agent = self._get_agent_for_mode(mode)
async with trace_span("task_agent_stream", mode=mode.value):
async with trace_span("task_agent_stream"):
try:
async with agent.run_stream(prompt, deps=ctx) as result:
async for chunk in result.stream_text():