mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-11 04:00:38 +00:00
fix(code-runtime-python): skip relative PATH entries in pythonBin resolution; pin the sealing-threshold rejection
The review's remaining code items: - resolvePythonBin now skips RELATIVE PATH segments (a bare 'bin' or '.'): the returned candidate must be absolute, because spawn() resolves a relative pythonBin against the host CWD, outside the seam contract. - A deterministic-ish regression pins the sealing-threshold corner: 64 MiB of 4 KiB (<= PIPE_BUF, atomic) newline-free writes plus 12289 more A's before the first newline make the first frame exceed FRAME_PARSE_CAP_BYTES; the newline-bearing chunk reaches the first-frame check (sealing is the ELSE half of the newline branch), so the run reports worker-exit with the protocol-frame-exceeded message.
This commit is contained in:
@@ -410,11 +410,13 @@ function resolvePythonBin(bin: string): string {
|
||||
/* v8 ignore next -- PATH is set in every environment the runtime boots in; the guard is defensive. */
|
||||
if (path === undefined) return bin
|
||||
for (const dir of path.split(delimiter)) {
|
||||
// An empty PATH segment (a `::`, implicitly CWD on POSIX) is skipped so a
|
||||
// basename never resolves against the working directory; normal PATHs
|
||||
// carry no empty segment.
|
||||
/* v8 ignore next -- normal PATHs carry no empty segment. */
|
||||
if (dir === '') continue
|
||||
// An empty PATH segment (a `::`, implicitly CWD on POSIX) and a RELATIVE
|
||||
// segment (`bin` or `.`) are skipped: a basename must never resolve against
|
||||
// the working directory, and the returned candidate must be an absolute
|
||||
// path — spawn() resolves a relative pythonBin against the host CWD, which
|
||||
// is outside the seam contract.
|
||||
/* v8 ignore next -- normal PATHs carry no empty or relative segment. */
|
||||
if (dir === '' || !isAbsolute(dir)) continue
|
||||
const candidate = join(dir, bin)
|
||||
try {
|
||||
accessSync(candidate, fsConstants.X_OK)
|
||||
|
||||
Reference in New Issue
Block a user