Skip to content

(bug) A paused turn never records an end time, so it looks like it never finished #6512

Description

@mmabrouk

When a turn pauses to ask me something, the runner records that the turn started but
never records that it ended. The row keeps a NULL end_time for good, so anything that
reads session_turns treats that turn as still running.

Steps to reproduce

  1. Start a session that pauses to ask a question. The connect-prompt case reproduces it.
  2. Answer the prompt and let the session run to completion.
  3. Query the turn ledger.
SELECT turn_index, turn_id, start_time, end_time
FROM session_turns
WHERE session_id = 'f62a6c2d-c789-4c68-ae87-d3c1a1c9ba17'
ORDER BY turn_index;

What happened

 turn_index | turn_id                              | start_time                 | end_time
          0 | b1575a89-0763-4567-a69c-83b1cc55cea1 | 2026-09-03 10:30:01.959+00 |
          1 | 3a289e60-a48f-4fdd-a62d-78fc80b7fd50 | 2026-09-03 10:33:16.858+00 | 2026-09-03 10:40:14.344+00
          2 | d499bd5b-3852-440c-832c-63dda5f334c9 | 2026-09-03 10:42:36.226+00 | 2026-09-03 10:43:23.076+00
          3 | 0d4ec471-da7e-4791-8ee5-528b18dd7807 | 2026-09-03 10:43:42.743+00 | 2026-09-03 10:44:35.300+00

Turn 0 paused, was answered 68 seconds later, and the session then ran three more turns
to completion. Turn 0 still has no end time. Turns 1 to 3 ended with end_turn and each
recorded one.

The same pattern appears in session 4983cc19-d230-45e1-8f78-c57160b9a79f, where the
turns that paused have no end time and the turns that ended normally do.

Across the stack:

SELECT count(*) FROM session_turns
WHERE end_time IS NULL AND start_time < now() - interval '1 hour';
-- 977, out of 3507 rows total

I did not classify all 977 rows, so some of them are cancelled turns or turns lost to a
restart rather than paused turns. The paused case reproduced in both sessions I checked.

Expected

A turn that paused and was then answered should record when it ended, so turn duration
and "is this turn still running" can be answered from the ledger.

Where

Local docker-compose stack agenta-oss-team, images v0.114.5.

Related: #6511 (the same pause also destroys the warm sandbox).

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions