Skip to content

fix(agent): mark session done and prompt user after max iteration limit #46

Description

@nyepppp

Agent Type

  • OS Agent (osagent-*)
  • SDE Agent (sdeagent-*)
  • Custom Agent
  • Gateway Agent
  • CLI Agent — specify:

Exec Mode

Plan mode

Description

When the agent reaches the maximum iteration limit in incognito mode, the assistant outputs a message saying the turn may not be complete, but the UI remains in a running state and does not guide the user to continue.

Steps to Reproduce

  1. Enable incognito mode.

  2. Start an SDE Agent session in plan mode.

  3. Let the agent reach the maximum iteration limit.

  4. Observe the final assistant message:

    I reached the maximum number of iterations (30) for this turn. The task may not be fully complete — you can send a follow-up message to continue.
    

Expected Behavior

After the agent reaches the maximum iteration limit:

  • The UI should switch to the done state.
  • The user should be guided to send a follow-up message to continue the task.

Actual Behavior

  • No follow-up guidance is shown in the UI.
  • The UI remains in the running state even though the assistant message has displayStatus: "completed".

Session Details

{
  "id": "assistant-4fe6e8ad73aa46138f14684b70649430",
  "chunk_id": "assistant-4fe6e8ad73aa46138f14684b70649430",
  "sessionId": "sdeagent-bb1504ee-b51d-4305-8055-f0be26b7e357",
  "createdAt": "2026-06-20T01:18:27.977191100+00:00",
  "functionName": "assistant",
  "uiCanonical": "agent_message",
  "actionType": "assistant",
  "args": {},
  "result": {
    "content": "I reached the maximum number of iterations (30) for this turn. The task may not be fully complete — you can send a follow-up message to continue.",
    "is_delta": false,
    "observation": "I reached the maximum number of iterations (30) for this turn. The task may not be fully complete — you can send a follow-up message to continue.",
    "role": "assistant"
  },
  "source": "assistant",
  "displayText": "I reached the maximum number of iterations (30) for this turn. The task may not be fully complete — you can send a follow-up message to continue.",
  "displayStatus": "completed",
  "displayVariant": "message",
  "activityStatus": "agent",
  "isDelta": false,
  "extracted": {
    "kind": "message",
    "content": "I reached the maximum number of iterations (30) for this turn. The task may not be fully complete — you can send a follow-up message to continue.",
    "isUser": false
  }
}

Relevant Logs / Output

I reached the maximum number of iterations (30) for this turn. The task may not be fully complete — you can send a follow-up message to continue.

Additional Context

This appears to be a UI state handling issue. The backend/message event is marked as completed, but the visible session state still appears as running.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions