You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make tool workers spawn-safe: ToolWorkerEntry replaces the make_tool_worker closure
Group A of the idea-5 spawn-safety design. Previously make_tool_worker
returned a nested tool_worker closure with a spoofed identity
(__name__/__qualname__ reassigned, __module__ left as _dispatch), which
could not be pickled at Process.start() under the default 'spawn' start
method — the direct cause of the agent-e2e pickle failures
("attribute lookup <tool> on ..._dispatch failed").
- make_tool_worker now returns a picklable ToolWorkerEntry (module-level
class instance): tool function travels as FunctionRef (module-level fns,
incl. the @tool wrapper's __wrapped__ hop) or by value (picklable
callable instances); guardrails, credential names and the framework-
callable marker are carried as instance state because parent-populated
_dispatch registries are empty in spawn children.
- The tool execution body moves to module-level run_tool_task(); the
identity spoof is deleted. Credential-name priority is resolved at
registration; the workflow-level fallback stays a runtime lookup.
- Skill workers: the make_script_func / make_read_func closures become
picklable ScriptRunner / SkillFileReader classes (plain-data attrs).
- All three registration paths (native @tool via ToolRegistry, skill
workers, framework-extracted) now run probe_spawn_safety, failing fast
at registration with a named offender instead of an opaque
PicklingError at worker start. Probe group "tools" enabled.
- test fixture: the langchain integration fixture's tool impl moves to
module level (extracted <locals> functions are legitimately rejected
by the probe under spawn).
New test proves a full ToolWorkerEntry pickles, crosses a REAL spawn
boundary, and executes a Task with zero parent registry state.
tests/unit: 2510 passed, 1 skipped (default and explicit
CONDUCTOR_MP_START_METHOD=spawn).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments