Repository navigation
Conversation
|
/ok to test 406b66a |
|
/claude review |
| "assert Version(version('pyjwt')) >= Version('2.9'); " | ||
| "assert Version(version('sqlalchemy')) >= Version('2.0.40'); " | ||
| "assert Version(version('flask')) >= Version('2.2'); " | ||
| "import datasets, wandb" |
There was a problem hiding this comment.
NOTE: the probe's version floors (jinja2>=3.1.3, pyjwt>=2.9, sqlalchemy>=2.0.40, flask>=2.2) are decoupled from what a rebuild actually installs. openhands.sh never pins these — they come from whatever OpenHands' poetry lock resolves. If the lockfile ever resolves any of them below a floor, _existing_setup_is_reusable returns False on every server startup, so the reuse fast-path is silently disabled and each process pays a full rebuild (which resolves the same sub-floor versions and would fail the probe again next time). No infinite loop (setup() doesn't re-probe after rebuild) and no data corruption — the cost is a permanent, silent loss of the reuse optimization. If these floors encode a known-bad OpenHands version, consider pinning them in openhands.sh alongside the wandb/datasets install so the rebuild actually satisfies what the probe demands.
|
SHIP — startup-only reuse gate, well-tested, off the scoring/async hot paths. This adds a runtime probe to the OpenHands harness Blast-radius check: One non-blocking NOTE inline: the probe's version floors are decoupled from what a rebuild installs — if OpenHands' lock ever resolves a probed package below a floor, the reuse fast-path silently disables itself on every startup (permanent rebuild cost, no corruption). Consider pinning those floors in |
| "assert Version(version('pyjwt')) >= Version('2.9'); " | ||
| "assert Version(version('sqlalchemy')) >= Version('2.0.40'); " | ||
| "assert Version(version('flask')) >= Version('2.2'); " | ||
| "import datasets, wandb" |
There was a problem hiding this comment.
NOTE: the probe's version floors (jinja2>=3.1.3, pyjwt>=2.9, sqlalchemy>=2.0.40, flask>=2.2) are decoupled from what a rebuild actually installs. openhands.sh never pins these — they come from whatever OpenHands' poetry lock resolves. If the lockfile ever resolves any of them below a floor, _existing_setup_is_reusable returns False on every server startup, so the reuse fast-path is silently disabled and each process pays a full rebuild (which then resolves the same sub-floor versions and would fail the probe again). No infinite loop (setup() doesn't re-probe after rebuild) and no data corruption — the cost is a permanent, silent loss of the reuse optimization. If these floors encode a known-bad OpenHands version, consider pinning them in openhands.sh alongside the wandb/datasets install so the rebuild actually satisfies what the probe demands.
406b66a to
f389df0
Compare
f389df0 to
bb6fba8
Compare
bb6fba8 to
858a7ad
Compare
858a7ad to
e5178fa
Compare
|
@sdevare-nv could you review this one? |
|
I'm not sure whether it will be an issue: the venv probe runs twice, if the first passes and the second fails, can |
|
@sdevare-nv PTAL |
|
/review |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
I found four setup/probe reliability risks, one required validation gap, and one test suggestion. I inspected all three changed files and traced startup through the container mounts. Tests and rollouts were not executed in this review.
RISK — Required representative smoke-rollout evidence is missing. The supplied PR description and discussion record no real model rollout for this behavior-changing agent work. The new tests use shell substitutes for the OpenHands interpreter, so they don't establish that the changed installation, probe, and rebuild path work together. The trusted quality bar requires representative real smoke rollouts, and the PR requirements require recording that evidence.
Add evidence from a representative OpenHands task using an installation built by the changed setup script. Then remove wandb only from a disposable cached setup, restart, and repeat the task. Record the head, config, framework commit, model, task, commands, startup logs, and inspected agent/verifier outcomes. Acceptance: the unhealthy cache rebuilds, the resulting environment passes the probe and is reused on the next startup, and the real rollouts produce trajectories and completed verification. Preserve existing task/reward semantics: the model needn't solve the task for the smoke check to succeed. These are proposed checks, not executed results.
Inline comments (escaped v1):
-
responses_api_agents/swe_agents/app.pyline 1809: RISK — A failed second probe can delete the shared pre-staged treeWith the default cache, let the pre-staged venv pass the probe in
_openhands_setup_target, then fail the second probe insetup(), while the interpreter still exists.setup_dirremainslegacy_dir, so thisrmtreedeletes the pre-staged checkout and Miniforge installation and rebuilds in place. Existing servers retain that path, and containers mount the shared installation after the setup lock is released. Read-only container mounts don't prevent host-side deletion. An unhealthy pre-staged installation should remain untouched while its replacement is built in the cache.Could you redirect a failed legacy recheck to the repository/commit cache, release the legacy lock, and acquire the cache lock before inspecting or rebuilding there? One suggested replacement for the locked block at lines 1799–1821 is:
while True: with file_lock(setup_dir, "OpenHands setup"): openhands_dir = setup_dir / "OpenHands" miniforge_dir = setup_dir / "miniforge3" if self._existing_setup_is_reusable(openhands_dir): print(f"OpenHands already set up at {setup_dir}", flush=True) self._sync_openhands_to_commit(openhands_dir, commit) return setup_dir if setup_dir == legacy_dir: setup_dir = ( self.setup_root / "swe_openhands_setup" / _repo_slug(repo) / commit ) continue print(f"Setting up OpenHands environment at {setup_dir}...", flush=True) rmtree(setup_dir, ignore_errors=True) setup_dir.mkdir(parents=True, exist_ok=True) script_fpath = self.parent_dir / "setup_scripts/openhands.sh" command = f"""SETUP_DIR={setup_dir} \ MINIFORGE_DIR={miniforge_dir} \ OPENHANDS_DIR={openhands_dir} \ AGENT_FRAMEWORK_REPO={self.config.agent_framework_repo} \ AGENT_FRAMEWORK_COMMIT={commit} \ {script_fpath}""" self._run_setup_command(command) return setup_dir
The
continueexits the old lock context; the next iteration recomputes both dependent paths under the cache lock.Proposed acceptance: call
setup()with temporary legacy/cache roots, a full commit SHA, and a legacy sentinel; make the probe succeed once, then fail. Expect the build destination and returned path to be the repository/commit cache, with the legacy sentinel unchanged. Also check that a healthy cache is reused after redirection and an unhealthy cache is rebuilt. Retain healthy legacy reuse, initially unhealthy legacy fallback, explicit-cache opt-out, and the no-remote warning-and-reuse branch. Preserve the path assertions in the resolution tests. This patch is source-reasoned, not executed; please verify it before adopting it. -
responses_api_agents/swe_agents/app.pyline 1738: RISK — Convert interpreter launch errors into failed probesAn existing
.venv/bin/pythonfile without execute permission passes the existence gate, but thissubprocess.runcall raisesPermissionErrorinstead of returning a failure description. An invalid executable has the same problem. The exception reaches server initialization, so startup aborts rather than rejecting the partial setup and recovering through the cache/build path.Could you catch
OSErroraround this call and return an actionable diagnostic? The probe must classify an unusable interpreter as unhealthy even when it cannot launch. Suggested replacement for the subprocess call below also includes the isolation and decoding corrections described in the other probe findings:try: probe = subprocess_run( [ str(venv_python), "-I", "-c", ( "from importlib.metadata import version; " "from packaging.version import Version; " "assert Version(version('jinja2')) >= Version('3.1.3'); " "assert Version(version('pyjwt')) >= Version('2.9'); " "assert Version(version('sqlalchemy')) >= Version('2.0.40'); " "assert Version(version('flask')) >= Version('2.2'); " "import datasets, wandb" ), ], capture_output=True, text=True, errors="replace", env={**os.environ, "PYTHONNOUSERSITE": "1"}, ) except OSError as exc: return f"{type(exc).__name__}: {exc}"
Proposed acceptance: create a non-executable interpreter file; expect a failure diagnostic and
_existing_setup_is_reusable(...) == False, without an exception. Repeat with an executable file containing invalid executable bytes. Retain healthy executable → reusable, missing interpreter → not reusable, nonzero exit → not reusable, and the no-remote caller's warning-and-return behavior. These checks and the suggested code haven't been executed; please verify them before adoption. -
responses_api_agents/swe_agents/app.pyline 1740: RISK — Isolate validation from the host's Python settingsThe probe inherits all host environment variables except that it overrides
PYTHONNOUSERSITE. WithPYTHONOPTIMIZE=1, all fourassertstatements are disabled: a venv below a required version floor can be declared reusable as long as the remaining imports succeed. Likewise, an otherwise empty target venv can pass when hostPYTHONPATHpoints to a healthy donor's site-packages. The actual harness is launched withapptainer exec --cleanenv, so that host search path isn't evidence that the target environment works.Could you run the target interpreter in isolated mode by inserting
-Ihere?str(venv_python), "-I",This ignores inherited Python environment controls and excludes the host search path while retaining the target venv's installed packages. The probe imports installed dependencies only; none of its inspected callers requires the current directory on the import path.
Proposed acceptance: a target containing one sub-floor package must remain rejected with
PYTHONOPTIMIZE=1. An empty target venv must remain rejected whenPYTHONPATHpoints to a healthy donor venv. A self-contained healthy target must remain reusable with or without those variables, and missingdatasetsorwandbmust still fail. These are source-reasoned checks, not executed results; please verify the suggestion. -
responses_api_agents/swe_agents/app.pyline 1753: RISK — Decode failed-probe output with replacementUnder a UTF-8 locale, an executable probe fixture containing the following produces an undecodable stderr byte:
#!/bin/sh printf '\377' >&2 exit 1
Because
text=Trueuses strict decoding here, the call raisesUnicodeDecodeErrorbefore the helper can return its failure description. Setup therefore aborts instead of rejecting the unhealthy venv. The trusted subprocess guidance explicitly requires replacement decoding.Could you add:
text=True, errors="replace",The invariant is that arbitrary probe output cannot prevent the reuse decision. Preserve the last-stderr-line diagnostic and empty-stderr exit-code fallback; only undecodable bytes should change.
Proposed acceptance: under a UTF-8 locale, the fixture above should return a nonempty diagnostic and make reuse return
False, without raising. Retain the ASCIIModuleNotFoundErrorcase in the diagnostic test, empty stderr plus exit 1 →exit code 1, and successful exit → reusable. These checks weren't executed; please verify the suggestion. -
responses_api_agents/swe_agents/tests/test_app.pyline 1249: NOTE — Suggestion: make the diagnostic test distinguish the last line from all stderrThe fixture and assertion supply one stderr line and check only a substring. Returning the entire stderr would keep this test green despite breaking its named last-line behavior. This is a diagnostic-coverage improvement, not a demonstrated runtime defect.
Replace the test body with a multiline fixture and an exact assertion:
openhands_dir = self._fake_openhands_dir( tmp_path, "#!/bin/sh\necho 'traceback detail' >&2\n" "echo 'ModuleNotFoundError: No module named wandb' >&2\nexit 1\n", ) failure = self._reuse_processor()._probe_openhands_venv(openhands_dir) assert failure == "ModuleNotFoundError: No module named wandb"
Proposed acceptance: this should pass with the current helper and fail if it returns the first line or full stderr. Retain the neighboring missing/healthy/failing reuse cases; an empty-stderr case should still expect
exit code 1, keeping that fallback distinct. I haven't executed these checks; please verify the replacement.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
|
@tdene can you please address the comments above ? Thanks |
|
@tdene still needed before review: if the second check fails on the pre-staged tree, build in the cache directory instead of deleting the shared tree. Treat a check that can't start or prints non-UTF-8 output as a failed check, and run it with |
Signed-off-by: Teodor-Dumitru Ene <[email protected]>
Signed-off-by: Teodor-Dumitru Ene <[email protected]>
|
@athitten Sorry for the delay. I've addressed all the comments.
|
6bc4eb7 to
ac4d299
Compare
|
/ok to test ac4d299 |
ac4d299 to
bce41ab
Compare
|
/ok to test bce41ab |
Signed-off-by: Teodor-Dumitru Ene <[email protected]>
bce41ab to
9a6578f
Compare
|
Rollout evidence (one golden-patch episode of
|
|
/review reset=true |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
SHIP WITH CARE
I found one cache-rebuild reliability risk and a remaining required validation gap. I inspected both changed files and traced setup, locking, container mounts and output collection. The earlier pre-staged-tree deletion, interpreter-launch, Python-isolation, UTF-8 decoding and last-line diagnostic findings are fixed.
RISK: The supplied smoke evidence still bypasses the OpenHands agent
The author's rollout report provides useful fresh-install, restart/reuse and interrupted-install recovery evidence. Those episodes use golden patches, however. process_single_datapoint takes the golden-verification branch before launching the agent; that branch writes the reference patch and starts only evaluation. It does not show that the rebuilt environment launches OpenHands, reaches a model and produces a usable trajectory.
Could you add a representative model-driven OpenHands rollout after unhealthy-cache recovery with verify_golden_patch=false? Record the reviewed SHA, config, framework commit, model, task and commands, then inspect the trajectory and completed verification. The model need not solve the task. This closes the required real-model smoke check without changing task or reward semantics. This narrows the earlier evidence finding: setup/evaluation evidence now exists, but model-driven agent evidence is still missing.
Validation
- CI for this head merged into the admitted base passed
Unit tests / Changed server tests: 256 passed, 2 warnings.Unit tests / Test,Unit tests / Server suiteandLint checkalso succeeded. The non-blocking Environment Server compliance aggregate failed, while itsresponses_api_agents/swe_agentscheck succeeded; I have not attributed that aggregate failure to this change. - I used
766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:e58425147cf1729131f8cf3f16dad5fe266944dd, the default-branch CI image because this head's container build was skipped. Existing passing suites were not rerun locally. - CPU probes under
/workspace/review-probes/exercised the exact extracted methods with disposable interpreters and controlled dependency fixtures. They confirmed dependency-floor rejection, missing-datasetsrejection, isolation, launch-error handling and replacement decoding. Lifecycle probes confirmed the pre-staged fallback fix and reproduced the live-cache/output deletion described inline. A mutation probe showed all seven diagnostic fixtures still pass with the dependency-check payload replaced bypass. A golden-route probe confirmed that mode bypasses agent execution. - These probes stubbed installation, Git synchronization and external execution. I did not run OpenHands, Apptainer or a real model rollout.
I checked the previous review's findings against the current source. Its commit 6bc4eb72f01391dcb691ec4094ae16bf01583ccf was not reachable in the admitted sources, so I could not compare revisions directly.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
| miniforge_dir = setup_dir / "miniforge3" | ||
|
|
||
| if self._openhands_tree_valid(setup_dir): | ||
| if self._existing_setup_is_reusable(openhands_dir): |
There was a problem hiding this comment.
RISK: Rebuilding an unhealthy cache can delete another driver's live installation and output.
This new predicate sends an interpreter-present repository/commit cache to rmtree(setup_dir) when its health probe fails. Another driver can already be using that directory because file_lock protects setup only. Its containers mount the shared tree and writable output directories, and its host collector keeps reading that concrete path. Read-only container mounts do not prevent host-side deletion.
The disposable base-vs-head probe at /workspace/review-probes/setup-lifecycle-1/probe.py showed active_output_survived=true on base and false on head after a second startup observed a failing probe. consumer_probe.py then exercised the actual collector and produced FileNotFoundError with partial_output_lost=true. Installation and Git sync were stubbed; deletion and collection used the real methods.
Could the rebuild use a new concrete cache generation and keep the old directory until existing consumers drain, or explicitly coordinate a drain before deleting it? Keep healthy-cache reuse, repository/commit isolation and the fixed pre-staged fallback. Acceptance: driver A's installation and output survive driver B's repair, A's collector still succeeds, concurrent repairs converge on one healthy replacement, and later startups reuse it. This is separate from the now-fixed pre-staged-tree deletion finding.
There was a problem hiding this comment.
Fixed in b0e9edc. A tree that has an interpreter is never deleted any more.
| @pytest.mark.parametrize( | ||
| ("probe_script", "mode", "failure"), | ||
| [ | ||
| ('#!/bin/sh\n[ "$1" = -I ]\n', 0o755, None), # healthy, and run in isolated mode |
There was a problem hiding this comment.
NOTE: Suggestion: test the dependency-check payload with Python too.
These shell interpreters protect useful OS-boundary behavior, but none executes the -c program containing the version checks and datasets import. In /workspace/review-probes/tests-contracts-1/probe_test_oracles.py, all seven diagnostic fixtures accepted both the actual helper and a helper whose Python payload was replaced by pass. Removing the central health checks would therefore leave these cases green.
Could you add a focused behavioral test using a real disposable Python environment with controlled distribution metadata/imports? Cover a healthy environment, each below-floor dependency and missing datasets, through the actual probe. Keep the shell cases for launch and decoding failures. Acceptance: removing any required dependency check makes its corresponding test fail, without asserting command text or duplicating the implementation.
There was a problem hiding this comment.
Added test_probe_checks_the_dependencies_of_a_real_venv in b0e9edc.
Signed-off-by: Teodor-Dumitru Ene <[email protected]>
|
/ok to test b0e9edc |
Signed-off-by: Teodor-Dumitru Ene <[email protected]>
|
/ok to test aafac3a |
ffrujeri
left a comment
There was a problem hiding this comment.
Thanks for the fixes. The pre-staged tree, launch-error, -I, decoding and live-cache points are all addressed, and the tests now run a real venv. Two questions remain. Which real case needs the four version floors (inline)? And could the rollout evidence run again on this head? The 2026-11-27 evidence comes before the <sha>.<n> path and the probe after a build, and golden-patch episodes do not start the OpenHands agent. One episode with verify_golden_patch=false, after recovery from an interrupted install, would also close the open request from the 2026-11-30 bot review.
Also, README.md line 88 gives the cache layout as swe_openhands_setup/<repo>-<hash>/<sha> and tells operators to prune old trees. Could one sentence there say that a tree that fails the probe stays on disk, and that the next tree is built at <sha>.<n>?
| ( | ||
| "from importlib.metadata import version; " | ||
| "from packaging.version import Version; " | ||
| "assert Version(version('jinja2')) >= Version('3.1.3'); " |
There was a problem hiding this comment.
The venv is mounted read-only into every container, so an episode cannot change these packages. Which real case do these four version floors catch? The rollout evidence shows only the missing datasets case. Also, with the probe after a build, an agent_framework_commit whose lock pins one of these packages below its floor now stops server startup, where main works. If no real case needs the floors, could the probe check only import datasets?
There was a problem hiding this comment.
Which real case do these four version floors catch?
None, this was some legacy check for my setup when the PR was still opened. My bad. Fixed, thank you.
Signed-off-by: Teodor-Dumitru Ene <[email protected]>
The reuse gate for a pre-existing OpenHands setup was 'the venv interpreter file exists', which conflates two very different states with a healthy environment: an interrupted build (a python binary with no packages behind it) and a venv whose packages an episode has since downgraded (episodes run pip inside the sandbox).
Attempting to use pre-existing venv's in either case causes all subsequent episodes to fail and mistakenly return 0 reward.
Nothing ever rebuilds the env on
mainbecause the gate always passes.