Repository navigation
Description
Summary
Every canvas panel tool call made during a voice session fails with a TypeError. The voice WebSocket handler calls platform_audit_service.log() with actor_type=, actor_id=, and actor_email= keyword arguments that do not exist in the method's signature. The audit call raises immediately, aborting the tool execution. Canvas panel operations (file edits, code generation, etc.) are completely non-functional in voice mode.
Component
Backend / Voice Chat (VOICE-001) / Platform Audit Service (SEC-001)
Priority
P1
Error
ERROR services.gemini_voice: Voice tool call error: PlatformAuditService.log() got an unexpected keyword argument 'actor_type'
Appears on every canvas tool invocation during a voice session.
Location
- File:
src/backend/routers/voice.py - Lines: ~311–320 —
await platform_audit_service.log(...)inon_tool_callcallback
Root Cause
The voice router was written against a non-existent platform_audit_service.log() API. The actual signature accepts actor_user (a Pydantic User model), actor_agent_name, or actor_ip to identify the actor — it derives AuditActorType internally. The voice code instead passes actor_type=AuditActorType.USER, actor_id=, and actor_email= which are all invalid keyword arguments.
Actual log() signature (src/backend/services/platform_audit_service.py:70):
async def log(
self,
event_type: AuditEventType,
event_action: str,
source: str,
*,
actor_user: Optional[Any] = None, # Pydantic User model
actor_agent_name: Optional[str] = None,
actor_ip: Optional[str] = None,
...
)Voice router call (src/backend/routers/voice.py:~311):
await platform_audit_service.log(
event_type=AuditEventType.EXECUTION,
event_action="voice_tool_call",
actor_type=AuditActorType.USER, # ← does not exist
actor_id=str(session.user_id), # ← does not exist
actor_email=session.user_email, # ← does not exist
target_type="agent",
target_id=session.agent_name,
details={"tool": tool_name, "prompt_preview": ...},
source="api",
)Reproduction Steps
- Deploy
f7450ca - Successfully open a voice session WebSocket (may require retries due to bug: voice WebSocket 403 — in-memory session lost across Uvicorn workers #704)
- Ask the agent to perform any canvas panel action (write a file, edit code, etc.)
- Observe
TypeErrorin backend logs; tool result is never delivered
Suggested Fix
Replace the non-existent kwargs with the correct actor_user pattern. The user object is already resolved earlier in the WebSocket handler:
# In on_tool_call callback in voice_websocket(), replace:
await platform_audit_service.log(
event_type=AuditEventType.EXECUTION,
event_action="voice_tool_call",
actor_type=AuditActorType.USER,
actor_id=str(session.user_id),
actor_email=session.user_email,
target_type="agent",
target_id=session.agent_name,
details={"tool": tool_name, "prompt_preview": str(args.get("prompt", ""))[:100]},
source="api",
)
# With:
await platform_audit_service.log(
event_type=AuditEventType.EXECUTION,
event_action="voice_tool_call",
source="api",
actor_user=user, # 'user' dict already fetched during WS auth
target_type="agent",
target_id=session.agent_name,
details={"tool": tool_name, "prompt_preview": str(args.get("prompt", ""))[:100]},
)Note: actor_user expects the user dict/model returned by db.get_user_by_username().
Environment
- Trinity version:
f7450ca(feat(voice): agent workspace + canvas panel)
Related
src/backend/routers/voice.py—on_tool_callcallback invoice_websocket()src/backend/services/platform_audit_service.py:70— actuallog()signaturesrc/backend/services/gemini_voice.py—_execute_panel_tool()where tool calls originate- Related: bug: voice WebSocket 403 — in-memory session lost across Uvicorn workers #704 (voice WebSocket 403 multi-worker issue)
Activity
vybe commentedon May 7, 2026
/claim
github-actions commentedon May 7, 2026
Claimed by @vybe. Label
status-in-progressadded.Next steps:
feature/705-<short-slug>Fixes #705fix(voice): cross-worker session 403 + audit kwargs TypeError (#704 #705
vybe commentedon May 10, 2026
Fixed in PR #706 (e17ac8f on dev). Wrong kwargs to PlatformAuditService.log() corrected alongside the #704 fix.
vybe commentedon Jun 1, 2026
Shipped in v0.6.0 (released via #998).
Release: v0.6.1 (#1171)