Commit Graph
150 Commits
Author SHA1 Message Date
pku-xht e9f1b6c53e Merge remote-tracking branch 'origin/master' into codex/subprocess-native-containment
# Conflicts:
#	.agents/notes/implemented/architecture/2026-07-16-explicit-turn-cancellation.i18n.yaml
#	.agents/notes/implemented/architecture/2026-07-16-explicit-turn-cancellation.md
#	.agents/notes/implemented/architecture/2026-07-16-explicit-turn-cancellation.zh.md
#	.agents/notes/implemented/architecture/2026-09-05-canonical-feedback-log.i18n.yaml
#	.agents/notes/implemented/architecture/2026-09-05-nonofficial-feedback-otel.i18n.yaml
#	.agents/notes/implemented/architecture/2026-09-06-embedded-stream-record-readers.i18n.yaml
#	.agents/notes/implemented/bug-fix/2026-09-03-normalized-unread-fs-tool-diagnostic.i18n.yaml
#	.agents/notes/implemented/bug-fix/2026-09-06-windows-python-console-spawn-wait.i18n.yaml
#	.agents/notes/implemented/feature/2026-08-26-generic-file-upload.i18n.yaml
#	.agents/notes/implemented/feature/2026-09-07-model-switch-notice.i18n.yaml
#	.agents/notes/implemented/process/2026-09-03-semantic-issue-templates-and-policy.i18n.yaml
#	packages/shell/bash-local/tests/executor.spec.ts
#	packages/subprocess/subprocess-local/README.i18n.yaml
#	packages/subprocess/subprocess-local/README.md
#	packages/subprocess/subprocess-local/README.zh.md
#	packages/subprocess/subprocess-local/src/spawn.ts
#	packages/subprocess/subprocess-local/tests/spawn.spec.ts
#	packages/subprocess/win32-process/package.json
2026-09-07 17:43:45 +08:00
Chinesezjc 1f0a87eb06 Merge remote-tracking branch 'origin/master' into fix/test-tmp-teardown-self-clean
# Conflicts:
#	packages/subprocess/subprocess-local/tests/spawn.spec.ts
2026-09-04 11:58:16 +08:00
pku-xht e82e5ffd7a fix(subprocess): normalize PTY scope launcher environment 2026-09-04 02:58:09 +08:00
pku-xht d82fd86c5c fix(subprocess): isolate native runner bootstrap 2026-09-04 00:24:52 +08:00
pku-xht 423412b7bf fix(runtime): simplify executable entry dispatch 2026-09-03 21:18:27 +08:00
Turtle a05b5fbe79 fix(subprocess): hide Windows cleanup helpers 2026-09-03 19:01:30 +08:00
Chinesezjc c8fc38541f test: own the default spill dir in subprocess specs; correct retention wording
Second review round (ds-review-bot v4p/v5/v6): the exit cleanup claim that
collectors unlink their spill files on dispose was wrong — completed spill
files are retained (seal() only closes, discardSpill() is the only unlink),
so the exit removal only ever applies to directories that never spilled.
Reword the JSDoc, README, and Agent Note accordingly, drop the redundant
readdirSync precheck (rmdirSync ENOTEMPTY is caught anyway), and recount the
v8-ignore window. The spawn.spec default-spill test now records the default
per-process directory it created and removes it in afterAll, so a completed
spill file is never left behind by the unit suite.
2026-09-03 17:29:21 +08:00
Chinesezjc 1bc330ce01 docs: cross-link the spill retention decision from the teardown note
The Agent Note now links the 2026-07-17 local-spill-startup-cleanup note it
builds on, and the privateSpillDir JSDoc documents the empty-dir exit
removal alongside the directory's creation contract.
2026-09-03 17:07:43 +08:00
Chinesezjc 29e6669e3c test: narrow process-exit spill cleanup to empty dirs; drop spill-store deletion
Review (ds-review-bot) found the exit-time deletion of per-process spill
roots conflicts with the documented retention decision: spill artifacts are
model-visible locators that resumed or forked sessions may still reference
(2026-07-17-local-spill-startup-cleanup), and an exception thrown from an
'exit' listener can change the process exit code.

- dsh-spill-local: revert the exit handler entirely; its default root is
  already owned by the package's 30-day startup sweep.
- dsh-subprocess-local/spawn: remove the per-process spill dir at a
  JavaScript-observable exit only while it is EMPTY (collectors unlink
  their spill files on dispose), best-effort with a named swallow so a
  Windows-held handle never changes the exit code; dirs holding spill
  files keep them for external cleanup.
- Document the empty-dir exit removal in the package README and the Agent
  Note, and re-record both bilingual pairs.
2026-09-03 17:06:48 +08:00
Turtle cc8099dc5f fix(subprocess): hide Windows child windows 2026-09-03 17:05:18 +08:00
Chinesezjc 6d9776a3b0 test: exempt process-exit spill cleanup from the per-file coverage gate
The exit listener runs after the coverage dump, so its body can never be
measured by the unit coverage lane; mark it v8-ignore with the reason, as
with other process-exit-only code paths.
2026-09-03 16:35:45 +08:00
Chinesezjc 0364343a7e test: remove dsh-* temp dirs created by unit tests at teardown
Spec files that create /tmp/dsh-* directories via mkdtemp now track and
delete them in afterEach/afterAll; module-scope fixture dirs (executor
spill dirs) are removed in afterAll. The file list came from the
observed-residue inventory on the self-hosted CI host: only specs whose
dirs actually accumulated were leak sources (issue #3134), superseding
the kept-but-unmerged CI sweep branch per the #3233 review decision.

Product per-process spill roots (dsh-subprocess-local spawn,
dsh-spill-local store) register a process-exit handler that removes the
memoized dir, so processes that used the spawn/spill path clean up on
normal exit. A SIGKILLed process cannot run in-process teardown; the
machine-side timer remains the backstop for that path.

Agent Note: .agents/notes/implemented/process/2026-08-28-test-temp-dir-self-cleanup.md
2026-09-03 16:19:18 +08:00
pku-xht 0652b7b4d7 fix(subprocess): close containment review gaps 2026-09-03 06:18:21 +08:00
pku-xht 14c16012fb fix(subprocess): preserve post-commit runner errors 2026-09-03 04:07:57 +08:00
pku-xht ff6a49660f fix(subprocess): tighten native containment settlement 2026-09-03 03:26:42 +08:00
pku-xht bc681d7a54 fix(subprocess): harden cancellation settlement 2026-09-03 01:18:40 +08:00
pku-xht 05b6789425 fix(subprocess): preserve clean range after start errors 2026-09-03 00:59:07 +08:00
pku-xht fe873955b4 Merge master@313ac567 into subprocess native containment 2026-09-02 23:00:02 +08:00
pku-xht ac1a5891c2 fix(subprocess): close remaining native containment findings 2026-09-02 22:49:46 +08:00
pku-xht fc19a0a3fa fix(subprocess): clarify provider failures and scope polling 2026-08-31 19:26:08 +08:00
pku-xht 6d49ac2ef6 fix(subprocess): align runner bindings with current types 2026-08-31 15:37:14 +08:00
pku-xht 5e3eaea742 refactor(subprocess): keep runner error bindings one-shot 2026-08-31 15:22:12 +08:00
pku-xht 8bb19f8f7f fix(subprocess): close containment review findings 2026-08-31 14:36:13 +08:00
pku-xht 93c11689e7 fix(subprocess): address containment review findings 2026-08-29 15:44:13 +08:00
pku-xht aaa5117ebd fix(subprocess): preserve literal spawn error stacks 2026-08-29 13:08:43 +08:00
pku-xht 13f3b2c172 fix(subprocess): match native spawn error semantics 2026-08-29 12:13:30 +08:00
pku-xht 60dd357a02 fix(subprocess): preserve native spawn error shape 2026-08-29 11:36:27 +08:00
pku-xht 1760649ba7 refactor(subprocess): derive native owner state 2026-08-29 11:28:33 +08:00
pku-xht a416b13eb5 fix(subprocess): preserve Windows search miss errors 2026-08-29 10:28:44 +08:00
pku-xht 5aab793045 fix(subprocess): preserve clean Windows range settlement 2026-08-29 09:08:34 +08:00
pku-xht 6e7b152de7 fix(subprocess): preserve native runner contracts 2026-08-29 07:57:59 +08:00
pku-xht 23af4410f6 fix(subprocess): resolve source runner loader absolutely 2026-08-29 06:14:15 +08:00
pku-xht a825b8d042 fix(subprocess): close native containment contract gaps 2026-08-29 05:56:29 +08:00
pku-xht 40279aea17 fix(subprocess): preserve native runner stdio 2026-08-29 00:03:12 +08:00
pku-xht a0bc2ea803 fix(subprocess): preserve native runner launch semantics 2026-08-28 22:34:09 +08:00
pku-xht aca5c0cb2b fix(subprocess): release Windows runner stdio owners 2026-08-28 21:29:09 +08:00
pku-xht 8ef28f76c0 fix(subprocess): preserve Windows runner spawn semantics 2026-08-28 19:55:16 +08:00
pku-xht 9aecbad9dd fix(subprocess): keep runner worker-loadable 2026-08-28 19:16:34 +08:00
pku-xht b65575442d Merge origin/master into codex/subprocess-native-containment 2026-08-28 18:34:22 +08:00
pku-xht a95f0b368f fix(subprocess): contain escaped descendants with native owners 2026-08-28 18:15:49 +08:00
Turtle 15f2997bcb cleanup: omit unneeded invariant companions 2026-08-28 13:12:52 +08:00
Yichen Jiang 9757224349 fix(subprocess): fence each signal against current process state
Review found the shared observation defeated the very fence it fed:
it carries the original PID-to-start-time pairing forward, so a
recycled PID still matches it and takes a signal meant for the process
that exited. Capturing it outside the per-member try also let one
failed read abort a whole teardown round, breaking the synchronous
host-exit contract, and an empty round paid a read for no members.

signalProcess now reads ProcessInspector.isAlive immediately before
delivering, from the narrowest per-identity source each platform
offers; signalMembers and waitForMembers return before capturing when
a round has no members. snapshot() keeps serving the readiness poll,
whose per-poll table read stays at one.

Windows enumerates Toolhelp32 lazily on the first tree question, so a
snapshot asked only for liveness — the 25 ms teardown poll — performs
no table walk at all.
2026-08-27 15:19:43 +08:00
Yichen Jiang 32ddfcd89c fix(subprocess): read the process table once per terminal poll
MacProcessInspector answered the descendant tree and every member's
liveness with its own `/bin/ps` fork, so one readiness poll cost N+1
full table reads for N tracked descendants. With execFileSync on that
path and a 50 ms poll interval, any command spawning two or more
children saturated the host event loop until it exited.

ProcessInspector.snapshot() now returns one ProcessSnapshot that
answers tree, session, and alive from a single observation, and
signalProcess takes the caller's observation so its PID-reuse fence
does not re-read the table per member.
2026-08-27 13:06:12 +08:00
pku-xht ef0815db7f chore(subprocess): document disconnect recheck 2026-08-27 01:33:06 +08:00
pku-xht 1250b41054 docs(subprocess): clarify Windows runner disconnect 2026-08-27 00:57:21 +08:00
pku-xht 81257defd2 fix(subprocess): preserve clean Windows runner close 2026-08-27 00:41:59 +08:00
pku-xht 07408ff0f1 fix(subprocess): preserve failed teardown state 2026-08-26 23:43:15 +08:00
pku-xht 3caa9e4f5a fix(subprocess): retain failed cleanup ownership 2026-08-26 22:16:20 +08:00
pku-xht 166004a6a8 fix(subprocess): preserve Windows startup errors 2026-08-26 20:01:10 +08:00
pku-xht 6a34a0dd4b fix(subprocess): isolate Linux native target group 2026-08-26 19:00:40 +08:00