perf: skip parent-only workflow extensions in child sessions - #224
Conversation
agnitum2009
left a comment
There was a problem hiding this comment.
Verified locally on the PR head (0f0f8db) — this is a clean, well-scoped fix for #183. Approving.
Design
- Deriving the parent-only extension set from the existing single source of truth (
OPENPI_TOOL_SURFACE+CHILD_EXCLUDED_TOOL_NAMES) is the right move: a future owner whose entire surface is child-excluded is filtered automatically, and a mixed owner (any child-safe tool) is never filtered, so the existing denylist drift guard stays the fail-closed backstop. - Path matching degrades safely: if an owner source path can't be canonicalized, the extension still loads and its tools are still stripped by
childToolPolicy— fail-open on the perf win, fail-closed on correctness. realpathSyncon both sides handles symlinked installs;extensionsOverrideis a realLoadExtensionOptionshook in the pinned SDK, and filtering before child lifecycle binding is the correct seam.
Verified by running it
bun run typecheck(only the two pre-existing file-search Effect warnings, unrelated) andbun run lintpass.- Full suite: 875/875 Node tests + 30/30 Vitest, matching the PR's claim.
bun run benchmark:workflow-child-startup: all 9 scenarios report 0 reads / 0 bytes / 0 parses; 8-child startup is flat across 0/100/1000 foreign runs (~545ms vs ~515ms), confirming the perf goal.- New tests cover the important edges: third-party extensions survive tool-name collisions, child-safe extensions (fd, git_show) stay loaded, and dynamically registered
structured_outputtools survive binding.
Notes (non-blocking)
- The regression test monkeypatches global
fs.readFileSync/JSON.parsewithsyncBuiltinESMExports; it restores state infinallycorrectly, but any future parallel test runner would need care. Acceptable for a targeted regression test. - The benchmark script is opt-in via a separate npm script and does not run in CI; the deterministic fs/JSON instrumentation in the unit test is what guards the invariant over time. Good split.
0f0f8db to
85accb9
Compare
|
Hi maintainers — this PR is ready for another review. It addresses #183 by skipping verified parent-only workflow extensions during child-session binding while preserving child-safe OpenPI tools, third-party extensions, and dynamically registered tools. The full validation suite and runtime smoke tests pass, and the benchmark confirms that child startup no longer reads or parses unrelated workflow history. When you have time, I’d appreciate a maintainer review, particularly of the extension classification and child-session authority boundary. Thank you! |
f7fc1e5 to
89ad500
Compare
tt-a1i
left a comment
There was a problem hiding this comment.
Re-reviewed exact head 053265a after updating onto main ba26d32. The optimization derives parent-only extension owners from the existing tool-surface classification, preserves child-safe and third-party extensions, and fails closed when package/path identity is unverifiable. Local validation passed: focused 25/25, bun run check, 1060 Node tests passed with 1 platform skip, and 30/30 Vitest tests. The startup benchmark reported zero Workflow artifact reads, bytes, and JSON parses for all 1/4/8-child scenarios at 0/100/1000 foreign retained runs, so the performance win does not depend on weakening child tool policy. Fresh required CI passed on Node 22.19.0, Node 24, and Windows. No blocking findings.
Summary
Validation
Closes #183