test(code-runtime-python): pin the directory-skip in pythonBin resolution; cover the ack gate defenses

The resolvePythonBin directory branch now has a regression: a PATH whose first
entry is an executable DIRECTORY named python3 is skipped for a later real
interpreter (fail-before: without the isFile guard the directory would be
chosen and spawn would fail). The boot-ack gate's forged-second-ack re-entry
guard and its write-failure branch are covered by v8 ignore comments (the
honest child sends exactly one ack; the write failure needs the child to exit
between ack and write).
This commit is contained in:
Chinesezjc
2026-08-31 15:00:32 +08:00
committed by Tianyi Cui
parent 2b3b7f87dc
commit cb26dd3804
2 changed files with 26 additions and 0 deletions
@@ -1995,11 +1995,13 @@ export class PythonCodeRuntime extends CodeRuntime {
}
// Register the ack gate with the frame handler before any data arrives.
bootAckGate.run = (): void => {
/* v8 ignore next -- a forged second boot-ack would re-enter; the honest child sends exactly one. */
if (runSent) return
runSent = true
try {
proto.write(`${JSON.stringify({ type: 'run', program: request.program })}\n`)
} catch (error: unknown) {
/* v8 ignore next -- the child exited between its ack and this write; the run settles as worker-exit. */
finish({ error: { kind: 'worker-exit', message: `failed to boot python subprocess: ${messageOf(error)}` } })
}
}