Skip to content

Control listener thread dies on an unexpected handler exception #236

Closed

Description

@lbacik

Problem

ControlServer._serve (simple_coding_agent/control_server.py:155-161) wraps each connection only in try/finally. Every _reply_* handler catches a fixed list of exception types (rejection classes, ControlStoreError, RuntimeError, OSError), so any other exception raised while handling a request (for example a KeyError or TypeError from a malformed checkpoint or a bug in a snapshot builder) propagates out of the accept loop and ends the agentctl-listener daemon thread.

The agent process keeps running, but from then on every agentctl command (including stop and handoff) fails with "Cannot connect to the agent process" until the container is restarted, and nothing in the event log says why.

Related: send_request (control_server.py:496-497) catches only OSError, so a reply over the 1 MiB _BUFFER_LIMIT surfaces as a ValueError traceback in agentctl instead of a clean exit 2.

Expected

  • One failing request never stops the listener: an unexpected exception is logged as an event and answered with {"ok": false, "error": ...} where the connection is still writable; the loop accepts the next connection.
  • agentctl reports an oversized or unparsable reply as a control error, not a traceback.

Context

Surfaced while deciding "Decide the agentctl telemetry command" (#225, map #222): the planned telemetry operation is polled every few seconds by a dashboard, which makes a latent listener crash far more likely to be hit.

Activity

  1. added
    ready-for-agentFully specified implementation issue ready for an unattended agent
    and removed on Oct 14, 2026
  2. self-assigned this
    on Oct 14, 2026
  3. lbacik commented on Oct 14, 2026

    @lbacik
    OwnerAuthor

    Agent Attempt Result: complete

    Branch: agent/issue-236
    PR: #247

    Evidence

    • Check command: UV_PROJECT_ENVIRONMENT=/home/agent/venv-py311 uv run --python 3.11 --extra dev ruff check && UV_PROJECT_ENVIRONMENT=/home/agent/venv-py311 uv run --python 3.11 --extra dev pytest && UV_PROJECT_ENVIRONMENT=/home/agent/venv-py313 uv run --python 3.13 --extra dev pytest → exit code 0
    • Reviews performed: 1
    • Review repair cycles: 0/2
    • Review findings: not collected

    Details

    Claude SDK completed the implementation workflow.

  4. removed
    ready-for-agentFully specified implementation issue ready for an unattended agent
    on Oct 14, 2026
  5. removed their assignment
    on Oct 14, 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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions