Repository navigation
fix(codex): a snapshot leaves out links that leave the workspace, and names why an archive fails - #895
Open
andrewpark-scaleai wants to merge 2 commits into
Open
fix(codex): a snapshot leaves out links that leave the workspace, and names why an archive fails#895andrewpark-scaleai wants to merge 2 commits into
andrewpark-scaleai wants to merge 2 commits into
Conversation
… names why an archive fails A save failed with a bare HTTP 500 whenever the workspace held a symlink that is absolute or resolves outside it, such as an agent linking a tool from elsewhere in the container into the workspace. The worker logged only the status, so the cause was invisible. The archive now skips such a link and logs a warning naming it; a restore refuses those links anyway. Links inside the workspace are kept. Every other archive failure (an unsupported entry, too many entries, a size limit) answers 422 with the code workspace_unarchivable, which the worker reports as "snapshot save failed with HTTP 422: workspace_unarchivable".
A save decided whether to keep a relative link by resolving it in the live workspace, which still holds the links the save leaves out. A link that climbs out of another link, such as `kept -> alias/../../target` beside an absolute `alias`, was kept, and the restore then refused the whole archive. The save now walks each link's target lexically from the link's folder. It keeps the link only when the walk never leaves the workspace and never takes `..` after passing another link, so no other link, kept or left out, extracted yet or not, can move the restore's resolve outside. A link in a loop is left out too, since the restore's resolve raises on it. Links that only descend through another link, as package managers' bin links do, are still kept.
andrewpark-scaleai
force-pushed
the
andrew-park/codex-snapshot-outside-links
branch
from
November 23, 2026 20:11
be41551 to
87138ba
Compare
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.
Problem. The Codex agent's snapshot save failed with a bare HTTP 500 whenever its workspace held a symlink that is absolute or resolves outside the workspace. An agent that symlinks a tool from elsewhere in the container into the workspace (
ln -s /usr/local/lib/.../bin/tool /app/work/tool) hits this every time, so the run loses its workspace snapshot. The archive step raised aValueErrorthat no handler mapped, and the worker keeps only an SDK error code from an error body, so its log read justsnapshot save failed with HTTP 500.Change.
workspace_unarchivable, raised as anAgentEnvError. The message carries the reason, and the agent logs it too. The worker reportssnapshot save failed with HTTP 422: workspace_unarchivable.No other agent has this check; the Claude Code and Gemini saves are unchanged.
Validation. Codex unit tests pass (
tst/unit/agents/codex, 255 tests), as dotst/unit/agentsandtst/unit/a2a_agent(1631 tests), andruff check. New tests drive/ext/snapshotagainst a fake object store:workspace_unarchivable, uploads nothing, andraise_for_extension_statusturns it intosnapshot save failed with HTTP 422: workspace_unarchivable.Both new tests fail on
mainwith a 500. The archive-level test that expected an absolute link to raise now expects the link to be left out.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; the previous restore failure is fixed and no new actionable issues were found.Summary
Codex snapshots skip links that restore cannot safely keep and return
workspace_unarchivablewhen archive limits or unsupported entries prevent saving.Reviews (2) · Last reviewed commit: "fix(codex): a snapshot keeps only links ..." · Reviewed by Greptile