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>