Repository navigation
test: keep the both-arms-dry walkthrough off real kernel subprocesses on either route - #1622
Merged
Merged
Conversation
… on either route KERNEL entry runs out of band and holds the phase until the hook returns. The previous fix only covered the GEAK route, but the route is read from KERNEL_OPT_BACKEND_ORDER, and an earlier test on the same xdist worker leaves it at "forge" (test_atom_kernel_backend_default deletes an unset key, which monkeypatch does not record, and the code under test then writes it). On the forge route the hook launched `kernelforge.cli kernel-rewrite-controller`, so reaching CLOSE within eleven ticks again depended on how fast a subprocess exited on the CI host. The test now sets the backend order itself and runs once per route, with both process boundaries replaced: the GEAK runner path is unresolvable and the Controller run returns no_opportunity. Each route pins the terminal result it reached, so a new subprocess step on either route fails the test instead of racing it. Co-authored-by: Cursor <cursoragent@cursor.com>
…on KERNEL entry Both process boundaries now live in the session_dir fixture, as #1623 does for the Controller, so no test in the file can reach a real GEAK runner or Controller process. Only geak_runner.py is refused; every other kernel-agent tool path still resolves. The walkthrough also waits on the out-of-band KERNEL entry hook after each tick. With the subprocesses stubbed the hook returns within a tick, so the wait is immediate; it removes the remaining dependency on the hook finishing inside the fixed tick count. Co-authored-by: Cursor <cursoragent@cursor.com>
BaoYunkai
added a commit
that referenced
this pull request
Sep 23, 2026
BaoYunkai
added a commit
that referenced
this pull request
Sep 23, 2026
zengleixin-amd
pushed a commit
that referenced
this pull request
Sep 23, 2026
Bring in #1622 without changing coverage thresholds or runtime phase behavior. Co-Authored-By: Claude <noreply@anthropic.com>
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.
test_optimize_loop_walkthrough.py::test_both_arms_dry_walks_the_rest_of_the_chainfailed twice on the #1619 CI (py3.10 shard 1):assert 'KERNEL_AGENT' == 'CLOSE', and teardown logged_on_phase_entered hook was cancelled.Since #1605, KERNEL entry runs out of band, and
_advance_phase_if_neededholds the phase while_kernel_entry_in_flight(). The test ticks eleven times without waiting on that hook, and the hook launched a real subprocess. So whether the run reached CLOSE depended on how fast that process exited on the CI host.The fix in #1619 only covered the GEAK route (
geak_runner.py). The failing CI log showskernel-entry reprofile produced no new snapshot(kernel.py:362), which appears only on the forge route. The route comes fromKERNEL_OPT_BACKEND_ORDER, and on a shared xdist worker that variable can already beforge. The cause istest_atom_kernel_backend_default.py::test_unset_backend_defaults_to_forgeandtest_the_default_lands_before_the_session_records_it: each callsmonkeypatch.delenvon an unset key, which monkeypatch does not record, and_apply_atom_auto_tightenthen writesos.environ["KERNEL_OPT_BACKEND_ORDER"] = "forge", which nothing restores. On the forge route the hook ranpython -m kernelforge.cli kernel-rewrite-controllerthroughcontroller_submit.run_controller_subprocess.The test now covers both routes and is hermetic on each. It also takes #1623's placement: the stubs live in the
session_dirfixture, so no test in the file can reach either subprocess.It is parametrized over the backend order (
geak,forge) and setsKERNEL_OPT_BACKEND_ORDERitself, so a leaked value no longer picks the route.Both process boundaries are replaced in the fixture.
request_handlers._kernel_agent_tool_pathrefuses onlybackends/geak_runner.py, so GEAK takes its existingrunner_not_foundbranch while every other tool path still resolves.controller_submit.run_controller_subprocessreturnsno_opportunity, following the stub already used intest_controller_patch_integration.py.After each tick the walkthrough awaits the out-of-band KERNEL entry hook (
coord._await_kernel_entry_task()). With the subprocesses stubbed, the hook has returned by the next tick, so the wait is immediate. It removes the last dependency on the hook finishing within the fixed tick count.Each route pins the terminal result it reached (
geak_result.error_class == "runner_not_found"andkernel_rewrite_controller_result.status == "no_opportunity"). A new subprocess step on either route then fails the assertion instead of racing it.Linked issue(s): close/fix refs
Follow-up to #1619. Supersedes #1623: this PR also stubs the Controller in the fixture, and adds the GEAK route, route pinning and the entry-hook wait.
Each scenario was run on
mainbefore the change and on this branch after it:maintest_unset_backend_defaults_to_forgethen the walkthrough, same process (the CI leak)'KERNEL_AGENT' == 'CLOSE')KERNEL_OPT_BACKEND_ORDER=forge'KERNEL_AGENT' == 'CLOSE')geak_runner.pyorkernel-rewrite-controllerexecutors/baseline.py, outside KERNEL801e28d6b, before the wait)'KERNEL_AGENT' == 'CLOSE')pytest src/hyperloom/inference_optimizer/tests/test_optimize_loop_walkthrough.pygives 3 passed; the two walkthrough params take 7.1s and 6.6s.ruff checkandruff format --checkare clean.One test file, two commits.
N/A.
None. This is test-only; CI stops failing this test depending on host speed and worker ordering.
No.
Yes. The env leak in
test_atom_kernel_backend_default.pyis left for a separate change; this test no longer depends on it.No.
Made with Cursor