Skip to content

Conversation

@sestinj
Copy link
Contributor

@sestinj sestinj commented Jan 19, 2026

Description

[ What changed? Feel free to be brief. ]

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • [] I've read the contributing guide
  • [] The relevant docs, if any, have been updated or created
  • [] The relevant tests, if any, have been updated or created

Screen recording or screenshot

[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See this PR as a good example. ]

Tests

[ What tests were added or updated to ensure the changes work as expected? ]


Continue Tasks

Status Task Actions
▶️ Queued Update docs on PR View

Powered by Continue


Summary by cubic

Correctly mark agent sessions as complete by setting isComplete in metadata after final assistant responses and when tools finish or fail. This prevents sessions from staying stuck in “running”.

  • Bug Fixes
    • In serve.ts, set isComplete only when the last assistant message has no tool_calls; in exit, status (DONE/FAILED), and reportFailure tools, call updateAgentMetadata({ isComplete: true }) before completing.

Written for commit 3106a8c. Summary will update on new commits.

@sestinj sestinj requested a review from a team as a code owner January 19, 2026 21:41
@sestinj sestinj requested review from Patrick-Erichsen and removed request for a team January 19, 2026 21:41
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jan 19, 2026
@github-actions
Copy link

github-actions bot commented Jan 19, 2026

✅ Review Complete

Code Review Summary

⚠️ Continue API authentication failed. Please check your CONTINUE_API_KEY.


Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

sestinj and others added 5 commits January 25, 2026 15:47
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>
Addresses code review feedback to use shared logger instead of console.debug
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>
Instead of always setting isComplete=true after every turn, now check if the
last message has tool calls. Only mark as complete if there are no pending
tool calls.

This prevents marking agents as complete when they still have work to do,
while ensuring they are marked complete when giving final responses.
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants