Skip to content

Fix silent crash on Python 3.14.0-3.14.3, and --update resuming (2.1.2) - #31

Merged
dandydarshan merged 2 commits into
mainfrom
release-2.1.2
Nov 8, 2026
Merged

dandydarshan merged 2 commits into
mainfrom
release-2.1.2

Conversation

@dandydarshan

Copy link
Copy Markdown
Owner

Why

codewiki generate exited with no message on a Windows machine as soon as the first agent checked a Mermaid diagram, and the following --update then refused to run at all.

Crash: PythonMonkey on Python 3.14.0–3.14.3

PythonMonkey finds the running asyncio loop by reading CPython's private thread state at a fixed offset. Its wheels are built against 3.14.4+ headers, and 3.14.4 added a pointer to PyThreadState (python/cpython@19cbcc0f85). So on 3.14.0–3.14.3 it reads the running Task as the loop and crashes on the first awaited promise: a segfault on Linux/macOS, 0xC0000005 on Windows. A native crash raises nothing, so the existing Node fallback never ran.

Fix: before the first diagram, the real parse runs once in a child process. If the child crashes, the run switches to Node.js with a warning to upgrade Python. If it succeeds, PythonMonkey is used in-process as before. A plain Python error in the child, such as PythonMonkey not being installed, isn't treated as a crash. Cost: one child process per run.

--update after an unfinished full rebuild

The full rebuild had moved metadata.json aside and saved the new graph, then stopped before writing pages. The next --update diffed the code against that same graph, got no_change, and failed on ~400 missing pages on every rerun. Now no_change with missing pages returns a resume outcome: generation continues from the cached module tree, keeps existing pages, and doesn't write metadata.json before the pages exist.

Testing

  • New tests: a crashing probe (signal 11 and 0xC0000005) falls back to Node without parsing in-process and probes only once; a Python error isn't a crash; a real probe passes where PythonMonkey works; no_change with missing pages returns resume without writing metadata.
  • Full suite: 883 passed. Ruff check and format are clean.
  • Not run: the crash path on a real Python 3.14.3; those tests fake the child's exit code.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CXRqenV27WmHS3PtveCubG

Darshan M U and others added 2 commits November 8, 2026 08:43
PythonMonkey's wheels read CPython's thread state at an offset from 3.14.4+
headers (3.14.4 added a PyThreadState field). On 3.14.0-3.14.3 they read the
running Task as the event loop and crash on the first awaited promise, so
generate died with no message when the first agent checked a diagram. A
native crash raises nothing, so the existing Node fallback never ran. Now
the real parse is tried once in a child process; a crash there switches the
run to Node with a warning to upgrade Python. PythonMonkey stays in use
wherever it works. Reported upstream as PythonMonkey #515, with a 45-job
OS/CPU/Python matrix showing only 3.14.3 crashes.

After a full rebuild stopped before writing pages (no metadata.json, new
graph already saved), --update diffed to no_change and failed on the
missing pages on every rerun. It now resumes generation instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CXRqenV27WmHS3PtveCubG
The probe's warning already names the cause and says Node.js is used; the
generic "trying system Node.js" line after it said the same thing again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CXRqenV27WmHS3PtveCubG
@dandydarshan
dandydarshan merged commit 723cd1e into main Nov 8, 2026
15 checks passed
@dandydarshan
dandydarshan deleted the release-2.1.2 branch November 8, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant