termination_reason; Trajectory does not infer it from model replies.
Log a valid native grade, including zero, before calling
client.trajectories.complete(tid, termination_reason=...). It returns status
completed or finalizing; both mean the ending was accepted. A finalizing trajectory’s
capture is still being built: poll client.trajectories.retrieve(tid) until its status
is completed before reading its steps.
The platform can also record
LIMIT_REACHED for token or context limits, MAX_STEPS for
its turn limit, and STALE, CANCELLED, or SANDBOX_* for execution failures. It preserves
a platform ending even if the harness later calls complete(). The
completion API reference lists all
reasons. A CANCELLED status on trajectory.rollout does not establish the recorded
termination reason; retrieve the trajectory to check it.
Check response.choices[0].finish_reason before dispatching tool calls. A value of
"length" or "max_tokens" means the reply was cut off; do not execute tool calls from
that reply. If the source evaluator grades the partial answer, log its native grade and
complete with TRUNCATION. A clean harness process exit alone does not mean ENV_DONE.
Training admits graded ENV_DONE trajectories by default. train_on_truncation
opts into truncated trajectories, including token and turn limits and missing submissions;
train_on_timeout opts into timeouts; train_on_error opts into execution errors, grading
errors, and missing grades. All three default to false, except that density_aware_training
sets train_on_truncation to true. Included trajectories use training
reward 0 while recorded rewards remain unchanged. Other training filters can still reject a
trajectory or group.
LIMIT_REACHED and MAX_STEPS count as TRUNCATION, and SANDBOX_* counts as ERROR. In
evaluation, truncations use zero if ungraded and cap positive rewards at zero. ERROR counts
as failed in evaluation even when training admits it, and counts toward the training failure
limit unless train_on_error is enabled.
After a platform turn, token, or context limit, model requests may return an empty
reply with metadata.trajectory_termination_reason: "trajectory_cancelled". Stop
calling the model and inspect the trajectory’s recorded reason. Leave room between
max_output_tokens_per_turn and max_output_tokens_per_trajectory if the harness must
grade a reply that fills its per-turn allowance.