(bug) Turns longer than 15 minutes lose their end time: the turn-complete call gets a 401
When a turn runs longer than 15 minutes, I expect the runner to record the end of the turn. Instead the runner's turn-complete call is rejected with a 401 and the turn row keeps end_time = NULL. The turn itself finishes fine and the transcript is complete. Continuity still loads on the next turn.
Steps to reproduce
Reproduced on the self-hosted OSS stack agenta-oss-team, images v0.115.2, local sandbox, Codex harness.
- Start a turn that runs for more than 15 minutes.
- Let it finish.
- Read the turn row in
session_turns.
Session 5df56bf3-7332-40ee-9c93-271c0ef655c2, turn 10, started 11:55:46, ended 12:14:02 (18 minutes):
api log:
12:14:02 [DEBUG] [auth] unauthorized [oss.src.middlewares.auth] status_code=401 path=/sessions/turns/complete method=POST reason=expired_signature detail={'message': 'Unauthorized', 'reason': 'expired_signature'}
12:14:02 172.21.0.1:58814 - "POST /sessions/turns/complete HTTP/1.1" 401
runner log:
[sandbox-agent] complete HTTP 401 session=5df56bf3-7332-40ee-9c93-271c0ef655c2 turn=10
database, every turn of this session longer than 15 minutes has no end time:
turn_index | start_time | end_time
10 | 2026-09-06 11:55:46.684+00 | (null)
9 | 2026-09-07 09:33:18.551+00 | (null)
5 | 2026-09-06 18:57:23.824+00 | (null)
3 | 2026-09-06 15:12:16.222+00 | (null)
Turns shorter than 15 minutes in the same session all have an end time and a 200 on the same call.
@mmabrouk i would like to work on this issue if it is still available
thanks @connect-aima. this one is for the internal team because it spans the runner, api authentication, and turn state. #6659 is a smaller open issue if you'd like to take it.
Closing: fixed by PR #7350 ("use current credentials for turn completion"). completeTurn in services/runner/src/engines/sandbox_agent/run-turn.ts now sends authorization: credential() from the live lease. A turn longer than 15 minutes no longer gets a 401. b790eff9e does the same for approval rows.
Generated by Claude Code