Improves debugging capabilities for the metadata endpoint by logging
at info level with full URL, timing, request body, and response status.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When an agent completes a turn with a final response (no tool calls), we now
correctly set isComplete=true in the metadata. Previously, isComplete was only
set when Exit, ReportFailure, or Status tools were called, or when the server
shut down. This caused agents that gave final responses to remain in 'running'
state indefinitely.
The fix checks the last message in history after each turn - if it's from the
assistant and has no tool_calls, the agent is marked as complete.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fixes issue where agent sessions stay stuck in "running" state forever
because the isComplete metadata field is never set.
Changes:
- Status tool now calls updateAgentMetadata({ isComplete: true }) when
status is "DONE" or "FAILED"
- reportFailure tool now marks agent as complete before reporting failure
- exit tool now marks agent as complete before exiting
- Added debug logging to track inactivity timeout progress and lastActivity
updates
This ensures the UI can properly detect when an agent has finished and
display the correct state instead of showing "running" indefinitely.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
MCP tools now have context-aware permissions:
- In headless mode: automatically allowed (no user to ask)
- In TUI mode: require user confirmation (ask permission)
Previously, MCP tools fell under the wildcard '*' policy which defaults to
'ask' permission. In headless mode, tools with 'ask' permission are filtered
out to prevent the AI from seeing tools it cannot call. This caused MCP tools
to be unavailable in headless mode unless explicitly allowed via command-line
flags or agent file configuration.
Implementation:
- Added generateHeadlessPolicies() method to ToolPermissionService
- Headless policies inject 'mcp__*' allow policy before other policies
- Default policies keep MCP tools as 'ask' (appropriate for TUI mode)
- Headless policy only applies when isHeadless flag is true
Benefits:
- ✅ MCP tools work in headless mode without explicit --allow flags
- ✅ MCP tools still require confirmation in TUI mode for safety
- ✅ Consistent with agent file behavior
- ✅ Maintains security for other unmatched tools
Changes:
- Added generateHeadlessPolicies() in ToolPermissionService
- Updated initializeSync to include headless policies
- Added comprehensive tests for headless mode behavior
- Updated documentation to reflect context-aware permissions
Co-authored-by: dallin <dallin@continue.dev>
Generated with [Continue](https://continue.dev)
Co-Authored-By: Continue <noreply@continue.dev>