trw_adopt_run
Transfer a run's pin to your session to resume or reclaim it. Handles abandoned runs and terminal status with optional force override.
Instructions
Transfer an existing run's pin to the caller's session.
Use when:
Resuming a run started by another session (fresh context, same task).
Reclaiming a run whose previous owner went away without delivering.
Guards:
Out-of-project run_path raises StateError (no force override).
Terminal status (delivered/complete/failed) requires force=True.
Live owner (heartbeat within pin_ttl_hours) requires force=True and emits
run_adopted_potential_writer_conflictWARN when displaced.
Input:
run_path: absolute path to the run directory to adopt (required).
force: override terminal-status and live-owner guards.
Output: TrwAdoptRunResultDict with fields {adopted_run_id, previous_pin_key, from_pin_key, to_pin_key, adopted_ts, from_owner_was_live, force_used}.
Example: trw_adopt_run(run_path="/repo/.trw/runs//") → {"adopted_run_id": "", "from_pin_key": "sess-a", "to_pin_key": "sess-b", "force_used": false, ...}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | ||
| run_path | No |