Repository navigation
A missing Codex login ends the run; a host failure keeps its spend - #129
Open
iamziyuzhao wants to merge 6 commits into
Open
iamziyuzhao wants to merge 6 commits into
iamziyuzhao wants to merge 6 commits into
Conversation
…lure's spend, an unrecorded first step - Codex.outcome reads a lost sign-in from Codex's stream for a login session outside a task's container too (it did only inside one): the chat endpoint answers 401 hermit_login_failed and the run ends, instead of a 502 its client retried while the run went on. - login.prepare names a missing ChatGPT login with Hermit's lost-sign-in mark: a rollout's LoginFailed, the endpoint's 401 (ChatEndpoint.answer reads it). - environment_rollout keeps what an agent said it spent on a host failure (an OSError), as its other failure paths do. - Trainer._prepare resets the checkout to the start when nothing is resumed: a first step (or the Evolver's bootstrap) stopped between its commit and its steps.jsonl line left the restart on that unrecorded commit. Found while patching #118. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n's own unrecorded first step - A Codex session on this machine whose copy of the ChatGPT login another session's refresh replaced meanwhile is retryable, not a lost sign-in; so is a turn the provider could not serve (an MCP server's 401 before it). - The endpoint answers a lost sign-in 401 also when the session ran out its clock. - A missing login met inside the Evolver's own call ends the run (Trainer._raise_login_failed reads the mark). - The checkout is reset only when it is this run folder's own and steps.jsonl records no step (an empty journal included), to the start its config.yaml saved, and the stopped step's learner state goes with it; a branch of that name with no checkout here is left as it is. - Troubleshooting: a row for Codex's login; codex_stream's docstring. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two audits found that the other two fixes need more design than a bug fix: reading a lost sign-in from a local Codex session's stream (an earlier notice, an MCP server's 401 or a stale login copy can reverse its terminal outcome), and resetting the checkout after a first step stopped before its record (another branch, an adopted tip, learner state). Both are taken out and left open in the PR description. Kept: login.prepare marks a missing ChatGPT login as a lost sign-in, the chat endpoint answers it 401 (hermit_login_failed), and the Trainer ends the run when the Evolver's own call raises it; a rollout that failed on this machine (OSError) keeps what its agent said it spent. The endpoint test goes through the real request path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The third audit: a Codex login file that exists but could not be read (being written, say) was marked as a lost sign-in and ended the run; now only an absent one is, and an unreadable one stays that session's failure, as before. The troubleshooting row gives the file-based login the Codex plan tutorial documents, the changelog says the start-up check covers only the start, and the Trainer's test runs through train(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fourth audit: on Python 3.14 Path.is_file says False for a file in a folder this process cannot pass, so such a login was marked lost; the mark now needs both files' stat to say they are absent. A container worker runs in a folder of its own: ContainerAgent hands it a relative login_root made absolute, as it already did the plan's folder. The Claude troubleshooting row names its login; the changelog says both files must be gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fifth audit: the container worker expanded `~` in its login_root where preflight and a session do not, so a shared copy preflight found was looked for elsewhere; the root is now made absolute only. The troubleshooting row says what to check when the login file is there; a cut comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
11 tasks done
This branch has not been deployed
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.
Change
Two failure paths lost what a run must know. They were found while patching #118 (its simulated user runs on a Codex chat endpoint on the ChatGPT login).
No ChatGPT login to copy.
login.prepareraised a plainRuntimeErrorwhen there was neither the user's login file nor the run's copy (10000 codex loginnever run, or its file gone). A rollout took it for a task failure and the run went on to the next task, each failing the same way; a chat endpoint answered 502, which its client retried; the Trainer recorded a failed step when the Evolver's own call met it. Its error now carries Hermit's lost-sign-in mark ([hermit_login_failed]) when both the user's login file and the run's shared copy are known to be absent (a file that could not be read, being written or in a folder this process cannot pass, stays that session's failure, as before): a rollout already reads the mark asLoginFailedand ends the run, the chat endpoint answers it 401 with the codehermit_login_failed(ChatEndpoint.answer), and the Trainer ends the run when the Evolver's call raised it (_raise_login_failed).hermit trainchecks the login only at its start, so this is a login file gone during a run (or never made, for a chat endpoint started otherwise). Restore it (codex -c 'cli_auth_credentials_store="file"' login, as the Codex plan tutorial says) andhermit trainresumes after the last finished step; the troubleshooting guide gains that row.A host failure's spend. A rollout that failed on this machine (an
OSError:host_failed, never run again) dropped what its agent said it spent (exc.spent), which every other failure path ofenvironment_rolloutkeeps.A container worker (
environment.image) runs in a folder of its own:ContainerAgentnow hands it a relativelogin_rootmade absolute where preflight and a session name it (as it already did the plan's folder), so the worker looks for the shared copy where preflight found it.Core changes:
hermit/agent/base/login.py(prepare,_absent),hermit/agent/base/endpoint.py(ChatEndpoint.answer),hermit/trainer/trainer.py(_raise_login_failed),hermit/trainer/rollout.py,hermit/isolate.py(ContainerAgent);docs/guides/troubleshooting.md. No interface changes; a changelog entry under Unreleased, Fixed.Not in this PR: two core issues, open for the maintainers
Both were in an earlier head of this PR (05906f6, ede8963). Two independent audits showed that a safe fix for each needs more design than a bug fix, so both were taken out (this head changes neither path).
Codex.outcomereads one from the stream only forisolation == "remote". A chat endpoint's or sandbox's session whose login was refused is a plain failure: the endpoint answers 502 and its client retries. Reading the same notices there (as the earlier head did) can stop a run that would recover: a refresh refused because another session rotated the shared login meanwhile (its copy stale, possibly in a task worker's private login root), a usage-limit refusal after an MCP server's 401, an outage notice before the terminal error. A fix needs the stream's terminal error, not every earlier notice; a stale-copy check against the login's owner, with a bounded wait for an in-flight refresh; and a retry from the newer login.steps.jsonlruns that commit as the start. With nothing recorded,_preparereuses the checkout as it is. Resetting it (as the earlier head did) runsgit reset --hardandgit clean -fdx. Before that is safe, the fix has to verify the worktree is the run's own branch (a worktree switched to another branch was reset), keep an adopted branch's tip (a later launch rewound it to the root), clear the learner state whether or not the head moved, and read a torn first journal line as no record.Validation
mainand passing here:tests/core/test_cli_agent.py::test_a_login_session_with_no_login_to_copy_is_a_lost_sign_in(the marked error; the endpoint's answer through its real path: 401,hermit_login_failed; a login file there but unreadable, or in a folder this process cannot pass: unmarked)tests/core/test_training.py::test_a_missing_login_met_in_the_evolvers_own_call_ends_the_run(throughtrain(): the run ends, the step unrecorded)tests/core/test_harbor_environment.py::test_a_failure_of_this_machine_keeps_what_the_run_spenttests/core/test_isolate.py::test_a_container_worker_takes_a_relative_login_root_as_preflight_didpython -m pytest --changed --base origin/main(every group:hermit/agent/base/is shared): 3 failed, 1781 passed, 172 skipped (every group selected). The 3 failures fail onmaintoo:tests/core/test_harbor_environment.py::test_rrsi_sees_a_harbor_rollouts_failure_and_a_cli_model_is_refused_for_harborandtests/methods/harness2/test_harness2_on_pi.py::test_what_a_pi_session_spent_is_kept_when_it_times_out_or_is_stopped(timed_out,cancelled).Review
login.prepare), so nothing that could recover ends the run; the endpoint and the Trainer act on the mark alone. A method that catches the error itself before the Trainer sees it (AHE's debugger, RRSI's step handler) still handles it as it did, as a plain failure.Codex.runwith no login file raises the marked error; a request answered through the endpoint's real path (ChatEndpoint.answer,cli_answer,Codex.run) gets 401;environment_rolloutwith a pipeline that raises anOSErrorcarrying its spend.gpt-6.2-astra, high effort, read-only). The first two, on the earlier heads, found the issues above. The fifth, on d9d1182: fixed here, the container worker'slogin_rootexpanded~where preflight and a session do not (now named as they name it), the troubleshooting row now says what to check when the file is there, a cut comment; recorded, a relativeCODEX_HOMEin a container run (the worker's own folder resolves it). The fourth, on 5c53472: fixed here, a login file in a folder this process cannot pass was marked on Python 3.14 (whosePath.is_filesays False; absence is now itsstat's word), a container worker looked for a relativelogin_rootin its own folder, the Claude troubleshooting row now names its login, the changelog's wording; recorded, a host failure's record scrubs the log its spend names, as every failure path that keeps a log does, and a read-only log holding a key would fail that write. The third, on b465aac: fixed here, a login file that exists but could not be read was marked (now only an absent one is), the troubleshooting row's login command (now the file-based cache the tutorial documents), the changelog's wording, and a test throughtrain(). Recorded, not fixed (each needs an input no producer here makes): a taskpreparecallback that deletes a task worker's private Codex login (none in the repo does) would end the run, though the host's login is good; the mark's text anywhere in an exception counts (an Evolver prompt file namedhermit_login_failed.md, say); the answer agent keeps the last 1,000 characters of a refusal, so a login path over about 900 characters would hide the code.🤖 Generated with Claude Code