codex: version check reads a stderr warning, so a pinned Codex is reinstalled in every Docker trial
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 25/100
Research direction
Read Codex.parse_version in src/harbor/agents/installed/codex.py and compare it with ClaudeCode.parse_version; the issue includes a standalone parser example with merged warning and version output. A unit test using that output should confirm the parsed version is 0.172.0. An open linked pull request (#4601) already addresses this issue.
Written by the indexing model from the issue text.
Description
Problem
Codex.install() skips installation when is_requested_version_installed() finds the requested version already in
the image. On the Docker environment this check never matches for recent Codex releases:
DockerEnvironment._run_docker_compose_commandstartsdocker compose execwithstderr=asyncio.subprocess.STDOUT
(src/harbor/environments/docker/docker.py, around line 790), soExecResult.stdoutholds stdout and stderr
merged.Codex.parse_versionreturns the first non-empty line of that output (src/harbor/agents/installed/codex.py,
parse_version).- Codex 0.172.0 writes a warning to stderr before the version, e.g.
WARNING: failed to clean up stale arg0 temp dirs: Cross-device link (os error 18)(it shows up in containers
where$TMPDIR/$CODEX_HOMEare on different filesystems, which is common with overlayfs).
Consequences:
- With
--ak version=0.172.0and Codex 0.172.0 preinstalled in the task image, the comparison fails and Harbor runs
the full nvm + Node 22 +npm install -g @openai/[email protected]path in every trial. That adds minutes per
trial and fails withAgentSetupTimeoutErrorwhen nodejs.org is slow (cf. #3450). - Without a pinned version,
is_requested_version_installedstores the warning as the agent version, so
result.jsonreports
"agent_info": {"name": "codex", "version": "WARNING: failed to clean up stale arg0 temp dirs: Cross-device link (os error 18)"}.
Repro
# Task image with Codex 0.172.0 preinstalled (npm i -g @openai/[email protected])
harbor run -p <task-dir> -a codex -m openai/<model> --ak version=0.172.0 -e docker
# agent/setup output shows nvm/Node/npm install although 0.172.0 is present;
# without --ak version, result.json agent_info.version is the WARNING line.
Standalone check of the parser:
from harbor.agents.installed.codex import Codex
Codex.parse_version(None, "WARNING: failed to clean up stale arg0 temp dirs: Cross-device link (os error 18)\ncodex-cli 0.172.0\n")
# -> 'WARNING: failed to clean up stale arg0 temp dirs: ...' (expected '0.172.0')
Proposed change
Make Codex.parse_version look for the version line instead of taking the first line, like ClaudeCode.parse_version
already does with a regex:
@override
def parse_version(self, stdout: str) -> str:
match = re.search(r"^codex-cli\s+(\S+)", stdout, re.MULTILINE)
if match:
return match.group(1)
match = re.search(r"\b\d+\.\d+\.\d+(?:[-+.\w]*)?\b", stdout)
return match.group(0) if match else stdout.strip()
Optionally also send stderr away in the version command
(... ; codex --version 2>/dev/null) so that environments which merge streams cannot affect it. A more general
alternative: BaseInstalledAgent._detect_version could run the version command with 2>/dev/null appended, or the
base parse_version could prefer the last line that contains a version-like token. That would protect every installed
agent, because any CLI can print warnings first. A unit test with the merged output above would cover it.
Version: harbor 0.27.0 (unchanged in 0.27.1.dev202612011755).
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 1.9k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 156
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from harbor-framework/harbor
-
Trial runs the agent's `populate_context_post_run` on the event loop, so trials that end together stall the orchestrator for secondsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
harbor-framework/harbor#4652 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
harbor-framework/harbor#4494 · 1 comment ·
Maintainers usually reply within 1 day
-
step workdir upload resets the work folder's owner and permissions in ModalPossibly taken @Sauvi72 claimed this 8 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
harbor-framework/harbor#4487 · 3 comments ·
Maintainers usually reply within 1 day
-
Docker: verifier log mounts are chmod 777 (no sticky), so rewardkit sandboxed graders die before writing a rewardPossibly taken @yuyz-cyber claimed this 6 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
harbor-framework/harbor#4469 · 1 comment ·
Maintainers usually reply within 1 day
-
Compare and Pareto hide total token usage when the cached token count is missingPossibly taken @Aafimalek claimed this 10 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
harbor-framework/harbor#4448 ·
Maintainers usually reply within 1 day
All issues in harbor-framework/harbor
Similar issues
-
soup prune-prompt exits 1 after writing its output on a file over 100,000 rows, and reports a capped row count otherwisePossibly taken @abdulwaarith0 claimed this today. Openneeds-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
MakazhanAlpamys/Soup#3690 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug data-types native-format
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
ClickHouse/clickhouse-connect#1320 ·
Maintainers usually reply within 1 day
-
accepted
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
future-agi/future-agi#6392 ·
Maintainers usually reply within 1 day