You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 621dfb8
Browse filesBrowse the repository at this point in the historyBrowse files
- Durable rebase marker (tasks.rebase_in_progress) with CAS set and clear.
- Complete the v5 backfill; the budget starts at the first move to running,
and a null deadline means not started.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/implementation/runner-lifecycle.md
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -227,7 +227,7 @@ The server computes `retryable` and sends it to the UI. The UI never works it ou
227
227
| Holder | Owner | Rule |
228
228
|---|---|---|
229
229
| Partial output of a stopped writable attempt | F, using a new D export | The task filesystems are Docker volumes behind a keeper container. F allocates them with `prepareTaskFilesystems` and removes them with `removeTaskFilesystems`; D's supervisor does not remove them at settlement. But F cannot read a volume from the host. So the order is: `settled` → a **D-provided bounded export** (a new D operation, for example `exportTaskDiff(filesystems, maxBytes)`, which runs `git diff` against the last codeboost commit in a read-only container and returns at most 1 MiB) → F saves it → the terminal write stores `diagnostic_ref` → `removeTaskFilesystems` → the slot is freed. F saves the export to a runner-owned diagnostics directory, with a total byte cap and oldest-first deletion. The attempt row references it as `diagnostic_ref`. If the capture fails, the row records that it failed. The task filesystem is never reused. |
230
-
| Interrupted rebase | F3 | F3 records `rebase in progress` durably before starting a rebase and clears it after. Startup recovery aborts every recorded rebase through the runner before it hands the task to I3. |
230
+
| Interrupted rebase | F3 | F3 records `rebase in progress` durably before starting a rebase and clears it after. It is stored as `tasks.rebase_in_progress`: null, or JSON `{ attemptId, oldHead, onto, startedAt }`. F3 sets it by compare-and-swap from null, and clears it by compare-and-swap on the same `attemptId`. Startup recovery aborts every recorded rebase through the runner before it hands the task to I3. |
231
231
| Workspace rebuild | I3 | I3 never rebuilds before both rows above are resolved for the task. |
232
232
233
233
**Process shutdown is a hard stop.** When the process stops, the running task does not finish. Its attempt ends `cancelled` with the reason "Stopped by shutdown". Restart recovery (lane I3) puts the task back in the queue. This is different from "Stop the queue" (lane I), which lets the running task finish.
@@ -363,12 +363,17 @@ This is the smallest schema that holds the contract. The F1 implementation PR se
363
363
|`assignment_id`|`unassigned`, the value F uses until F2 assigns work |
364
364
|`referenced_code_hash`| the head SHA of the plan's current snapshot, or `none` if it has no snapshot |
365
365
|`current_attempt_id`| null (v5 has no attempt rows) |
366
+
|`requeue_pending`| false |
367
+
|`cancel_requested`| null |
368
+
|`rebase_in_progress`| null |
369
+
|`budget_deadline`| null. The budget has not started; it starts on the task's first move to `running`. Every deadline check treats null as "not started", never as expired. |
370
+
|`created_at`, `updated_at`| the migration time |
366
371
367
-
A merged v5 task also gets its `task-closed` event, keyed by the merge attempt ID. A test migrates a v5 fixture with an open and a merged plan and checks both rows.
372
+
A merged v5 task also gets its `task-closed` event, keyed by the merge attempt ID. A test migrates a v5 fixture with an open and a merged plan, checks every column of both rows, and then checks that retry, recovery and the time-limit check treat the migrated open task as not expired and not requeue-pending.
368
373
369
374
| Table | Key columns |
370
375
|---|---|
371
-
|`tasks`|`plan_key` (primary key, references `plans(key)`), `status`, `requeue_pending` (boolean), `budget_deadline` (absolute time the task budget ends), `cancel_requested` (action ID or null), `state_version`, `context_generation`, `assignment_id`, `referenced_code_hash`, `current_attempt_id` (nullable; the composite foreign key `(plan_key, current_attempt_id)` references `attempts(plan_key, id)`, so a task can only point at its own attempt), `created_at`, `updated_at`|
376
+
|`tasks`|`plan_key` (primary key, references `plans(key)`), `status`, `requeue_pending` (boolean), `rebase_in_progress` (JSON or null; see "Partial output and interrupted rebases"), `budget_deadline` (absolute time the task budget ends; null until the budget starts, which is the task's first move to `running`, when it is set to that time plus the configured budget), `cancel_requested` (action ID or null), `state_version`, `context_generation`, `assignment_id`, `referenced_code_hash`, `current_attempt_id` (nullable; the composite foreign key `(plan_key, current_attempt_id)` references `attempts(plan_key, id)`, so a task can only point at its own attempt), `created_at`, `updated_at`|
372
377
|`attempts`|`id` (**primary key**; never reused), `deadline` (the attempt's absolute deadline, saved at admission), `plan_key` (references `tasks(plan_key)`; `(plan_key, id)` is also unique, for the composite key), `kind`, `phase`, `item`, `state`, `context` (JSON), `first_reason`, `stop_reason`, `exit_code`, `signal`, `result` (JSON, only for `completed`, 1 MiB or less), `diagnostic` (bounded), `diagnostic_ref` (partial-output file, or null), `preparation_pgid` and `preparation_started_at` (or null), `allocation_id` (task storage, or null), `created_at`, `started_at`, `settled_at`|
|`feedback_events`| the fields listed above, with `id` as primary key, with a unique index on `(plan_key, kind, action_id)`|
@@ -482,6 +487,7 @@ Each case needs a test that fails before the fix and passes after it. Each test
482
487
| Invalid action ID (review round 23) | A 10 KB `actionId`, and one that is not a UUID → HTTP 400; no `user_actions` row |
483
488
| Two starters after a crash (review round 23) | Runner killed (the OS releases its lock) → two processes start at once → exactly one gets the exclusive lock and the other exits; the lock file is never deleted |
484
489
| Retry versus recovery requeue (review round 24) | Restart lists the task and sets `requeue_pending` → user retry → refused → "Resume" and I3 requeue race → exactly one admits an attempt |
490
+
| Crash during a rebase (review round 25) | F3 sets `rebase_in_progress` → runner killed → restart → step 4 aborts that rebase and clears the field by compare-and-swap on its `attemptId` → only then is the task listed for I3 |
485
491
| Old attempt settles after a retry (D/F contract) | Attempt A cancelled and settled → retry B admitted → a late publish from A is refused → B's row and the visible status are unchanged |
0 commit comments