[Windows] The Python SDK's process layer is never exercised on Windows: 25 test cases are skipped, and a cancelled run is reported as an internal failure instead of a cancellation
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Start with the prepared branch test/python-sdk-windows-coverage and review packages/code-sdk-python/tests/fake_mcode.mjs, tests/conftest.py, tests/test_sdk.py, .github/workflows/python-sdk.yml, and release/public-source.json. Run the Python SDK test suite on Windows and check that process tests run while only the documented POSIX signal and opt-in tests skip. The reported cancellation error is a separate production change that this branch does not include.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Labels requested: bug, needs-triage, cli
Product or interface
Source build or repository tooling — the Python SDK minimax-code-sdk (0.1.1 on PyPI) that starts, cancels and reaps the mcode CLI on the host.
Version
- Source:
main@3c21163(repository version0.7.2), tagv0.7.2=c6c7f28 - SDK package:
minimax-code-sdk0.1.1 (PyPI, published 2026-11-17), source tagcode-sdk-python-v0.1.1 - Python 3.12.10 (Windows) / 3.11.2 (Linux), Node.js v24.18.0 (Windows) / v20.20.2 (Linux), pnpm 9.15.0
Platform
Windows
OS version and architecture
Windows 11 x64 (build 26200)
Issue area
Build / CI / source distribution
What happens
The Windows leg of the Python SDK workflow is green, but it never starts a CLI process. The whole fake-CLI test suite is skipped on Windows, so the process layer of the SDK — spawn, stream, cancel, timeout, reap — has never run on the platform where it behaves differently. Two consequences:
1. The Windows CI line proves nothing about the SDK's process handling.
packages/code-sdk-python/tests/conftest.py:14 skips every test that uses the fake_env fixture:
if sys.platform == "win32":
pytest.skip("the fake CLI is a POSIX script; Windows runs the resolver and option tests")
That is 25 test cases in packages/code-sdk-python/tests/test_sdk.py (22 of its 27 test functions). The whole suite reports 34 passed, 30 skipped on Windows, and the 3 remaining skips are the opt-in end-to-end tests. The other Windows coverage is the launcher resolution (tests/test_cli.py) and the release checks (tests/test_release_check.py); neither starts a process. The workflow comment says the same ( .github/workflows/python-sdk.yml:28: "fake-CLI process tests are POSIX-only").
2. A cancelled Turn is reported as a failed run on Windows, and as a cancellation on Linux and macOS.
This is the part the skipped suite hides. packages/code-sdk-python/src/minimax_code/thread.py:244 stops the CLI with a hard kill on Windows, because Windows has no signals between processes:
if sys.platform == "win32":
self.proc.terminate() # TerminateProcess -> exit code 1
else:
self.proc.send_signal(signal.SIGTERM) # exit code -15
packages/code-sdk-python/src/minimax_code/errors.py:129 maps that exit code to an error, and the mapping only knows the cancellation exit codes 130 and "negative means killed by a signal" (errors.py:155). On Windows the exit code is 1, so the run is reported as an internal failure:
| Linux / macOS | Windows | |
|---|---|---|
| CLI stopped with | SIGTERM (exit -15) |
TerminateProcess (exit 1) |
| SDK raises | MCodeAbortError: The MCode run was cancelled. |
MCodeRunError: The MCode run ended without a result: exit code 1 (status="failed", category="internal") |
The TypeScript SDK, which the Python SDK states it mirrors (packages/code-sdk-python/src/minimax_code/thread.py:1), handles this case explicitly — packages/code-sdk/src/exec-process.ts:323:
if (this.abortRequested && code !== 2) {
this.fail(new MCodeAbortError('The MCode run was cancelled.', details));
return;
}
The Python SDK has no equivalent of abortRequested, so on Windows the cancellation is indistinguishable from a CLI crash. MCodeAbortError is a documented error type of the package (packages/code-sdk-python/README.md:127) and is what a user gets for the same action on Linux and macOS.
Steps to reproduce
-
Run the Python SDK test suite on a Windows host and read the skip reasons:
python -m pytest packages/code-sdk-python/tests -q -rsSKIPPED [1] tests/test_sdk.py:39: the fake CLI is a POSIX script; Windows runs the resolver and option tests ... (25 test cases) 34 passed, 30 skipped -
Reproduce the divergence. Save this as
repro_cancel.pyin the repository root and runpython repro_cancel.py(needs Node.js, themcodeCLI is a Node program anyway):import asyncio import os import pathlib import sys sys.path.insert(0, "packages/code-sdk-python/src") from minimax_code import MCode, MCodeError, MCodeOptions FAKE = pathlib.Path("fake-mcode.js") FAKE.write_text( "if (process.argv[2] === '--version') { console.log('0.7.2'); process.exit(0); }\n" "process.stdout.write(JSON.stringify({schemaVersion: 1, type: 'exec.started'," " sequence: 1, timestampMs: 0, runId: 'r', sessionId: 's', turnId: 't'}) + '\\n');\n" "setInterval(() => {}, 1000);\n", encoding="utf-8", ) async def main() -> None: client = MCode(MCodeOptions(bin=str(FAKE.resolve()), env=dict(os.environ))) streamed = await client.start_thread().run_streamed("hi") try: async for event in streamed: if event["type"] == "exec.started": streamed.cancel() except MCodeError as error: print(f"{type(error).__name__}: {error}") print(f" status={getattr(error, 'status', None)!r} exit_code={error.exit_code!r}") finally: FAKE.unlink() asyncio.run(main())The same script and the same SDK code on Linux and on Windows:
# Linux (Debian 12, Python 3.11.2, Node v20.20.2) MCodeAbortError: The MCode run was cancelled. status=None exit_code=-15 # Windows 11 x64 (build 26200), Python 3.12.10, Node v24.18.0 MCodeRunError: The MCode run ended without a result: exit code 1 status='failed' exit_code=1
Expected and actual behavior
- Expected: a cancelled Turn raises
MCodeAbortErroron every platform, as the TypeScript SDK does and as the README documents. The Windows CI leg exercises the SDK's process layer. - Actual: on Windows the cancellation raises
MCodeRunErrorwithstatus="failed"andcategory="internal", and no CI job ever starts a CLI process on Windows, so the difference was never observed.
Two more details of the same root cause, both inside the skipped suite:
-
os.kill(pid, signal.SIGINT)terminates the process on Windows with exit code2instead of raisingSIGINTin it, andos.kill(pid, signal.SIGTERM)terminates it with exit code15. Neither runs the child's signal handler. Measured on Windows 11:call exit code handler ran os.kill(pid, SIGINT)2no os.kill(pid, SIGTERM)15no proc.terminate()1no proc.kill()1no tests/test_sdk.py:303relies on the SIGINT delivery, so it cannot hold on Windows; the same is true for thepkill -INThelper attests/test_sdk.py:167. -
The timeout backstop kills the CLI with a signal number on POSIX and with exit code
1on Windows, so the assertionexit_code < 0attests/test_sdk.py:214cannot hold there either.
Redacted error summary
MCodeRunError: The MCode run ended without a result: exit code 1
status='failed' exit_code=1
What I prepared
A branch that runs the fake-CLI suite on Windows. It is pushed on my fork as test/python-sdk-windows-coverage (commit 65f2ff3, one commit on top of 3c21163). I cannot open a pull request myself — the API refuses cross-repository pull requests for my account — so the branch is the handover.
- new:
packages/code-sdk-python/tests/fake_mcode.mjs— a Node port oftests/fake_mcode.py, scenario by scenario. Windows cannot execute a shebang script (CreateProcessrejects it with WinError 193), and the SDK only starts.exe,.comand.jsentries there (packages/code-sdk-python/src/minimax_code/_cli.py:82), so the fake CLI needs an entry the SDK can launch. A.mjsentry is started asnode <entry>. packages/code-sdk-python/tests/conftest.py— thefake_envfixture picks the platform's fake CLI instead of skipping the suite.packages/code-sdk-python/tests/test_sdk.py— the three POSIX-specific expectations become platform aware; the two tests that need a signal delivered to another process stay POSIX-only, with a reason..github/workflows/python-sdk.yml— the Windows leg gets Node.js, and the comment about POSIX-only tests is corrected.release/public-source.json— regenerated for the new file.
Result on Windows 11 x64, CPython 3.12.10, pytest -W error with PYTHONWARNDEFAULTENCODING=1:
59 passed, 5 skipped in 8.02s # was: 34 passed, 30 skipped
ruff check, ruff format --check and mypy are clean. The 5 remaining skips are the 3 opt-in end-to-end tests and the 2 tests that need POSIX signal delivery.
The branch contains no production-code change: it only measures and pins the current Windows behaviour. The error-class divergence above is a separate question — mirroring packages/code-sdk/src/exec-process.ts:323 in _Exec/error_for_exit would make a cancelled Turn raise MCodeAbortError on Windows as well. I did not include that in the branch because it changes the semantics of a published package.
Before submitting
- I have searched existing issues.
- I have included my version and removed sensitive information.
- Lenguaje dominante
- TypeScript
- Estrellas
- 2.3k
- Forks
- 315
- Merge medio
- 3 h 54 min
- PR fusionados (30 d)
- 9
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de MiniMax-AI/minimax-code
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
MiniMax-AI/minimax-code#639 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
MiniMax-AI/minimax-code#636 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
MiniMax-AI/minimax-code#615 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
MiniMax-AI/minimax-code#556 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
MiniMax-AI/minimax-code#507 ·
Los mantenedores suelen responder en 1 día
Todos los issues de MiniMax-AI/minimax-code
Issues similares
-
area:api bug good first issue priority:high
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Doezer/Questarr#1486 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
area:import difficulty:good-first good first issue help wanted priority:P1 roadmap size:S type:test
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Sergey-Bar/Penny#245 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
mihazs/lazysh#3377 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Approve the Cloudflare agent plugin for harness sessionsPosiblemente ocupada @joshtsch la tomó hoy. Abiertoenhancement ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día