Skip to content

[Bug]: run() cannot get a stuck conversation moving; the detector sets STUCK again before any LLM call #6648

Closed

Description

@enyst

I'm an AI agent (Claude Code) helping Engel Nyst (@enyst) with project maintenance.

The verify-sdk feature map (#5750) found this bug while driving the SDK through its public API. The map records it as a known failure, and the command under Steps to Reproduce shows it on main.

Is there an existing issue for the same bug?

  • I have searched existing issues and this is not a duplicate.

Bug Description

After stuck detection stops a conversation, calling run() again resets STUCK to RUNNING, but the detector checks the same repeated action/observation pairs since the last user message before any LLM call and sets STUCK again at once. Only a new user message gets a detected-stuck conversation moving. The unit test test_run_recovers_from_stuck sets STUCK by hand with no repeating events, so it never meets this.

Expected Behavior

run() on a stuck conversation makes at least one more LLM call (the scripted model has 2 replies left; script_left drops below 2).

Actual Behavior

script_left stays 2 and the status is stuck again.

Steps to Reproduce

From a checkout of main (uv sync), with the verify-sdk tools on the path:

export PATH="$PWD/.agents/skills/verify-sdk/scripts:$PATH"
sdk-map run --file S01 --only S01.stuck-recover

That runs this recipe from the map (control-sdk conversation drives a conversation in its own HOME, persistence and workspace with a scripted model that repeats ls):

export SDK_VERIFY_RUN=$(control-sdk new --field run)
CID=$(control-sdk conversation new --script S01/repeat_ls.json --field id)
control-sdk conversation send "$CID" --text "List files" --run --check execution_status eq stuck
control-sdk conversation run "$CID" --check script_left lt 2

Acceptance Criteria

  • run() after a detected stuck state gives the agent another step, or the API documents that a new message is required and run() says so instead of silently re-sticking.
  • A test covers resuming a conversation stuck through real repeated events.
  • The S01.stuck-recover bullet in .agents/skills/verify-sdk/references/feature-map/ passes and its known-failure note is removed.

Installation Method

uv sync in a checkout of main


OpenHands AI triage

The following comments and acceptance criteria were added by the OpenHands AI agent.

Triage

Confirmed against main: LocalConversation._run() and arun() reset STUCK to RUNNING on entry, then the loop calls _check_stuck_or_nudge() before the first agent.step(); StuckDetector.is_stuck() scans the unchanged events since the last user message, so the conversation re-sticks with zero LLM calls. The repository's verify-sdk feature map (.agents/skills/verify-sdk/references/feature-map/S01-agent-loop.md) records this as a known failure reproduced 2026-10-13 through the public API, which supports priority:medium.

Resolved the either/or in the original first criterion in favor of the documented contract: run() on a STUCK conversation gives the agent another step, matching the S01.stuck-recover map entry and the premise of test_run_recovers_from_stuck (a persisted STUCK state must not permanently kill a session). No implementation is prescribed; the fix shape is left to the PR.

Non-goals: RemoteConversation.run() keeps raising ConversationRunError on stuck status; stuck-detection thresholds and the action-error nudge (S01.stuck-nudge, #4331) are unchanged; send_message's STUCK-to-IDLE reset is unchanged; related defects #6085 (empty LLM responses end runs as STUCK) and #4380 (goal loop halting on STUCK) are out of scope. The criteria below tighten the original list in the body.

Acceptance Criteria

  • With stuck detection enabled and a conversation that went STUCK through real repeated action/observation events, calling run() issues at least one further LLM call: with a scripted model holding 2 unused replies, the remaining reply count drops below 2, and the run loop continues.
  • If the agent repeats the same pattern during the resumed run, the conversation ends STUCK again (state.execution_status == STUCK), showing the detector still guards the resumed run.
  • Both run() and arun() behave this way; a regression test covers resuming a conversation that became STUCK via the real detector path (not hand-seeded execution_status), and that test fails on unpatched main.
  • A conversation resumed from persisted STUCK state (persistence reload path) takes the step the same way as an in-memory stuck conversation; test_run_recovers_from_stuck and test_send_message_resets_stuck_to_idle still pass.
  • The user-facing stuck-detector guide or the run() docstring states what run() does on a STUCK conversation (the agent gets another step and the detector still applies).
  • The S01.stuck-recover recipe that calls run() with no new message passes and its known-failure note is removed from .agents/skills/verify-sdk/references/feature-map/S01-agent-loop.md.

Activity

  1. added
    bug
    priority:medium
    ready-for-dev
    on Nov 9, 2026
  2. added a commit that references this issue on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority:mediumready-for-dev

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions