Skip to content

[Bug]: ACP agent re-sends a timed-out prompt until stuck detection or max iterations #6645

Open

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

ACPAgent._step handles the idle prompt timeout by emitting the timeout message and setting execution_status = ERROR without raising. LocalConversation.run() stops only on PAUSED, STUCK, FINISHED or an exception, so the loop calls step() again, which sends the same user message to the ACP server again. In the recipe the server received 3 prompts and 2-3 session/cancels in 6 s, until the stuck detector set stuck. With the default acp_prompt_timeout of 1800 s that is 90 minutes of repeated work; with stuck detection off it runs until max_iteration_per_run.

Expected Behavior

One prompt, one cancel, and the conversation ends in error with the timeout message.

Actual Behavior

prompts_sent 3, cancel_sent 3, status stuck, after 6.1 s.

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 S21 --only S21.timeouts-retry

That runs this recipe from the map (each control-sdk call runs a short program in its own HOME, persistence and workspace; the ACP server is a scripted stdio fake):

export SDK_VERIFY_RUN=$(control-sdk new --field run)
control-sdk program S21/acp_conversation --arg timeouts \
  --check cases.hang.agent_messages.0 contains "ACP prompt timed out after 2s" \
  --check cases.hang.prompts_sent eq 1 --check cases.hang.cancel_sent eq 1 --check cases.hang.status eq error \
  --check cases.hang.seconds lt 5

Acceptance Criteria

  • A timed-out ACP turn ends the run in error without re-sending the prompt.
  • A test covers the idle timeout through conversation.run(), not only step().
  • The S21.timeouts-retry 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 from repository evidence. ACPAgent._step handles the prompt idle timeout by emitting the timeout message and setting execution_status = ERROR without raising, while LocalConversation._run() breaks only on PAUSED, STUCK, FINISHED, confirmation, budget/iteration limits, or a raised exception, so the loop calls step() again and re-sends the same user prompt. The non-timeout error path in the same function already re-raises so run() stops, matching the regular agent; the timeout path is the exception. The verify-sdk feature map records the reproduced failure (2026-10-13: prompts_sent 3, cancel_sent 3, status stuck in 6.1 s), and with stuck_detection=False it loops to max_iteration_per_run — with the default acp_prompt_timeout=1800 that is about 90 minutes of repeated 30-minute hangs.

Bounded scope: after a timed-out ACP turn, the run ends in error with exactly one prompt and one session/cancel sent, covered by a regression test through conversation.run()/arun() and the existing verify-sdk recipe.

Non-goals: no change to the generic LocalConversation run-loop break conditions for other agents or statuses; no change to the cancel/drain/session-restart behavior covered by S21.cancel-pause; no change to timeout defaults or the bounded in-step retry policy for connection and retriable server errors; no TypeScript client, agent-server, or docs changes beyond the feature-map update.

Acceptance Criteria

  • Through conversation.run() with an ACP server that goes silent, a prompt exceeding acp_prompt_timeout ends the run with execution_status error, the timeout message ("ACP prompt timed out after ...") appears among the emitted messages/events, and the server received exactly one prompt and one session/cancel.
  • With stuck_detection=False, the same timed-out turn still ends the run in error after a single prompt instead of looping until max_iteration_per_run.
  • Through conversation.arun(), a timed-out prompt also terminates in error without re-sending the prompt.
  • In-flight tool calls opened during the timed-out turn are closed as failed, with no dangling tool cards after the timeout.
  • Existing retry behavior is unchanged: connection errors and retriable ACP server errors are still retried a bounded number of times within a step, and timeouts are still not retried (the existing prompt-retry unit tests pass unchanged).
  • A regression test under tests/sdk/agent/ drives the idle timeout through conversation.run(), not only step(), and fails without the fix.
  • The S21.timeouts-retry bullet in .agents/skills/verify-sdk/references/feature-map/S21-acp-agent.md passes (sdk-map run --file S21 --only S21.timeouts-retry) and its known-failure note is removed.

Activity

  1. added
    bug
    priority:medium
    ready-for-dev
    on Nov 9, 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