From 5498eb0460dcf550c17fa1aa615cf5e9f13d58b5 Mon Sep 17 00:00:00 2001 From: mehdikarimi55 <9496476+mehdikarimi55@users.noreply.github.com> Date: Tue, 10 Nov 2026 14:14:56 +0330 Subject: [PATCH 1/2] test: make the verifier's fake curl robust to whitespace in sys.executable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On macOS the kernel splits a shebang line on whitespace, so the fixture's "#!{sys.executable}" shebang fails with ENOENT whenever the checkout lives under a path containing a space (e.g. "GitHub Contribution/"), producing 4 test failures. Route the fake curl through /bin/sh with a shlex.quote'd interpreter, matching the existing pattern in tests/extensions/test_extension_agent_context.py; with -c, sys.argv[1:] stays exactly the curl argument list, so the assertions are unchanged. Fixes #5360 AI disclosure: agent-authored commit — OpenCode running GLM 5.3 Flash (Z.ai), agent mode under human supervision by mehdikarimi55; root-cause analysis, code change, and test execution performed by the agent. --- tests/test_workflow_step_submission.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/test_workflow_step_submission.py b/tests/test_workflow_step_submission.py index 850f2f54e1..e8311637e9 100644 --- a/tests/test_workflow_step_submission.py +++ b/tests/test_workflow_step_submission.py @@ -6,6 +6,7 @@ import builtins import copy import re +import shlex import shutil import subprocess import sys @@ -411,14 +412,24 @@ def test_fetch_keeps_malicious_text_in_one_argument_even_if_validation_is_bypass ): curl = tmp_path / "curl" arguments = tmp_path / "arguments.json" - curl.write_text( - f"#!{sys.executable}\n" + python_code = ( "import json, sys\n" "from pathlib import Path\n" f"Path({str(arguments)!r}).write_text(json.dumps(sys.argv[1:]))\n" "Path(sys.argv[sys.argv.index('--output') + 1]).write_bytes(b'fixture bytes')\n" "print('200', end='')\n" ) + # A `#!` shebang breaks when the interpreter path contains + # whitespace: the macOS kernel splits the shebang line on spaces, so a + # checkout living in e.g. "GitHub Contribution/" makes every lookup of + # `curl` fail with ENOENT. Route through /bin/sh, which quotes the + # interpreter path properly; with `-c`, sys.argv[1:] is exactly the + # argument list `curl` was invoked with. + curl.write_text( + "#!/bin/sh\n" + f"exec {shlex.quote(str(sys.executable))} -c {shlex.quote(python_code)} \"$@\"\n", + encoding="utf-8", + ) curl.chmod(0o755) monkeypatch.setenv("PATH", str(tmp_path)) monkeypatch.chdir(tmp_path) From f4b30138fbc859e7c13f174897494dddfa7f2eda Mon Sep 17 00:00:00 2001 From: mehdikarimi55 <9496476+mehdikarimi55@users.noreply.github.com> Date: Wed, 11 Nov 2026 08:28:39 +0330 Subject: [PATCH 2/2] test: pin the shebang regression to a whitespace interpreter path Copilot review noted the regression test still ran with the ambient sys.executable, whose path has no whitespace on CI, so restoring the old direct shebang would not fail there. Reach the interpreter through a symlink inside a directory whose name contains a space, making the direct-shebang fixture fail with ENOENT on every machine and locking in the /bin/sh fix. Assisted-by: GLM (model: GLM 5.3 Flash, supervised by mehdikarimi55) AI disclosure: agent-authored commit - GLM 5.3 Flash, supervised by mehdikarimi55; test change and red/green verification performed by the agent. --- tests/test_workflow_step_submission.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/test_workflow_step_submission.py b/tests/test_workflow_step_submission.py index e8311637e9..e257fb346b 100644 --- a/tests/test_workflow_step_submission.py +++ b/tests/test_workflow_step_submission.py @@ -425,9 +425,20 @@ def test_fetch_keeps_malicious_text_in_one_argument_even_if_validation_is_bypass # `curl` fail with ENOENT. Route through /bin/sh, which quotes the # interpreter path properly; with `-c`, sys.argv[1:] is exactly the # argument list `curl` was invoked with. + # + # The interpreter is reached through a path that itself contains a space, + # so restoring the direct `#!{interpreter}` shebang makes this test fail + # regardless of where the checkout lives. + try: + spaced_dir = tmp_path / "py dir" + spaced_dir.mkdir() + interpreter = spaced_dir / "python3" + interpreter.symlink_to(sys.executable) + except OSError: + pytest.skip("symlinks to the interpreter are unavailable here") curl.write_text( "#!/bin/sh\n" - f"exec {shlex.quote(str(sys.executable))} -c {shlex.quote(python_code)} \"$@\"\n", + f"exec {shlex.quote(str(interpreter))} -c {shlex.quote(python_code)} \"$@\"\n", encoding="utf-8", ) curl.chmod(0o755)