fix(tasks): resume the session on transient retry #36

Merged
codetether-bot merged 1 commit from fix/retry-resumes-session into main 2026-07-31 15:48:36 +00:00
Collaborator

A transient fault can land many minutes into a long task. Requeuing without a resume pointer discarded that work and restarted from the original prompt, so a stream that broke near the end simply burned the retry budget for no progress.

The worker already supports this: resume_session_id in task metadata is the equivalent of codetether run --session <id>, and task_session_load continues that session when present instead of resolving a fresh one. The requeue path just never set it.

next_metadata now carries the session forward, preferring an explicit resume_session_id, then the worker-reported worker_session_id, then session_id. Derived task-<id> sessions are excluded because they hold streamed narration rather than agent state — resuming one would restore no reasoning context.

Temporal stage boundaries are deliberately left alone: review should not inherit the build session, and each stage already receives its own context.

Validation: 46 tests pass, covering carry-forward, explicit-pointer precedence, derived-session exclusion, blank values, and resume surviving repeated attempts.

A transient fault can land many minutes into a long task. Requeuing without a resume pointer discarded that work and restarted from the original prompt, so a stream that broke near the end simply burned the retry budget for no progress. The worker already supports this: `resume_session_id` in task metadata is the equivalent of `codetether run --session <id>`, and `task_session_load` continues that session when present instead of resolving a fresh one. The requeue path just never set it. `next_metadata` now carries the session forward, preferring an explicit `resume_session_id`, then the worker-reported `worker_session_id`, then `session_id`. Derived `task-<id>` sessions are excluded because they hold streamed narration rather than agent state — resuming one would restore no reasoning context. Temporal stage boundaries are deliberately left alone: `review` should not inherit the `build` session, and each stage already receives its own context. Validation: 46 tests pass, covering carry-forward, explicit-pointer precedence, derived-session exclusion, blank values, and resume surviving repeated attempts.
fix(tasks): resume the session on transient retry
Some checks failed
Validate CodeTether Pull Request / validate (pull_request) Failing after 1m20s
f5ee728feb
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
riley/codetether!36
No description provided.