Repository navigation
fix(openenv): a reset or end_turn past its deadline ends the episode, and CI runs TRL - #379
Merged
earakely-scale merged 4 commits intoOct 28, 2026
Conversation
… and CI runs TRL The server ended a tool call that missed its deadline, but waited on a reset's deploy and on end_turn with none, so a client that had gone away left its session open and its sandboxes up. reset_async now takes timeout_s and end_turn honors timeout_s metadata; the TRL helper sends reset_timeout with both. The new tst/trl tier, run by .github/workflows/trl.yml against TRL 1.15 and the latest, trains one GRPOTrainer step on CPU through the helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TRL 1.15's log-prob path is a Triton GPU kernel, which a CPU-only runner can't run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e tears down after Waiting for the teardown could outlast the client's grace, so the client dropped the session before it heard why. The teardown stays tracked: the next reset, a close and the server's shutdown wait for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
earakely-scale
deleted the
edgararakelyan/fd-4556-trl-contract-end-turn-deadline
branch
October 28, 2026 23:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two changes to the TRL training path.
1. No call holds a session past its client's deadline
AgentEnvEnvironmentalready ended a tool call that missed thetimeout_sdeadline in its action's metadata. The other two calls on a session had no deadline on the server:reset_asyncwaited on the deploy and the opening of the first turn.end_turnwaited on the next turn or the verifiers' score.The client gave up on both after
reset_timeout. A client that had gone away therefore left the server's handler waiting: the session stayed open, its sandboxes stayed up, and the server's graceful shutdown waited on the handler until it was killed.reset_asynctakestimeout_s, andend_turnhonorstimeout_smetadata as tool calls do. Past either deadline, the server ends the episode with an error and the session goes on. Without a deadline, nothing changes.agent_env.training.trlnow sendsreset_timeoutas the deadline of each reset and eachend_turn, the left-open turns it ends included. Each message waitsGRACE_SECONDSlonger than its deadline, so the server answers first.2. A CI job that runs TRL
TRL marks
environment_factoryexperimental, and until now CI never ran TRL. The newtst/trltier, run by.github/workflows/trl.yml, has one test:GRPOTrainertrains a step on CPU through the helper, against the OpenEnv serverbuild_appmakes over the Episode API's fake steps.generateis stood in for: in each group, one rollout adds a crate and ends its turn, and the other answers without a tool.get_reward. Every rollout is scored (1, 0, 1, 0), parameters change, and every episode is torn down.When it runs:
agent_env/training,agent_env/openenvor the tier;It allows no skips, and it isn't a required check.
AsyncGRPO needs a vLLM server, so the tier doesn't cover it. Its pickling contract is covered by the unit test that plays a rollout in a spawned process.
Supporting changes:
trl_installedcapability: trl and torch aren't in thedevextra, somake testskips the tier with a declared reason.make trl-test.Tests
end_turnpast their deadlines: a new test intst/unit/openenv/environment_test.pyholds a reset before its first turn, and anend_turnbefore the score, past 0.5 s deadlines. Teardown is held while they're called. Both answer with an error observation before their episodes are torn down, and both episodes are torn down once teardown is released. Without the server change, or with replies that wait for teardown, it hangs.test_a_reset_and_an_end_turn_carry_the_resets_deadline_so_end_turn_waits_for_the_score_past_a_tools(the slow-verifier test, extended) checks that the helper sendsreset_timeoutwith both resets and theend_turn.tst/trl/grpo_test.pyruns in the new workflow on this pull request.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; the earlier timeout-reply issue is fixed.Summary
The PR adds server deadlines for reset and
end_turn, sends those deadlines from the TRL helper, and adds a CPU TRL training check.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Call misses deadline] --> B[Track episode cleanup] B --> C[Return error without waiting] B --> D[Cleanup continues] D --> E[Next reset, close, or shutdown waits]Reviews (3) · Last reviewed commit: "fix(openenv): a call past its deadline a..." · Reviewed by Greptile