correct_trial_status
Correct a terminal trial's recorded status when executor output contradicts the recorded outcome, appending an audited correction with a mandatory reason.
Instructions
Correct a terminal trial's status — the recorded repair act.
For mislabeled records: e.g. the executor's outer wrapper
exited 0 while the recorded output documents a crash
("status": "error" / nonzero inner exit code in the payload).
Source must be completed|failed|retryable (all terminal —
a retryable source is a correction made in error or evidence
re-read after the fact); target must be
completed|failed|retryable. reason is mandatory.
Correcting TO completed requires the record to evidence a
completed run — a cancellation receipt, reaper note, or
failure output does not qualify, so that direction is refused
unless the executor record documents an actual completion.
The correction is appended to the trial's executor_output_json under 'corrections' — the record shows both what was claimed and what it was corrected to. Never hand-edit the database: a direct sqlite3 UPDATE bypasses this audit trail.
Enforcement: commitment 1 — the loop is the unit (orphan check).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| reason | Yes | Why the correction is recorded — mandatory, appended to the trial's audit trail. | |
| trial_id | Yes | ID of the target trial. | |
| to_status | Yes | Target status: completed | failed | retryable. | |
| programme_id | Yes | ID of the target research programme. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | ||
| from | No | ||
| trial_id | No | ||
| corrected_at | No |