feat(code-runtime-python): add the CPython subprocess backend

Land the PythonCodeRuntime implementation on top of the fd-3 protocol
seam: python3 -I per run, binding namespace over fd 3, RLIMIT_CPU/AS,
wall-clock timer, and SIGTERM->grace->SIGKILL process-group teardown,
with the real-subprocess integration suite.

Fixes three defects surfaced on the source PR's review before they ship:
- boot-write failure resolved a worker-exit through finish()/settle()
  that read wallTimer/onAbort/live in their TDZ, rejecting run() instead;
  the boot write now runs after those bindings and the v8-ignore that hid
  the branch is removed.
- log capture serialized against settlement with no lock while model
  daemon threads keep writing; LogBuffer now owns one shared re-entrant
  lock taken by write/flush_line/push.
- the fd-3 line residual was a subarray view pinning the whole joined
  frame; it is copied into a right-sized Buffer via detachResidual so
  pendingBytes measures what is retained.
This commit is contained in:
Chinesezjc
2026-08-31 14:14:32 +08:00
committed by Tianyi Cui
parent 817c67d799
commit c388169cff
18 changed files with 6475 additions and 9 deletions
@@ -14,8 +14,20 @@
{
"path": "../../../vendor/cordis"
},
{
"path": "../../../vendor/schemastery"
},
{
"path": "../code-runtime"
},
{
"path": "../../core/session"
},
{
"path": "../../runtime-diagnostics/invariants"
},
{
"path": "../../util/timeout"
}
]
}