Skip to content

fix(examples): fix 9 broken examples + worker-tool registry lookup (companion to #438)#439

Merged
ling-senpeng13 merged 1 commit into
mainfrom
examples/verification-fixes
Jul 20, 2026
Merged

fix(examples): fix 9 broken examples + worker-tool registry lookup (companion to #438)#439
ling-senpeng13 merged 1 commit into
mainfrom
examples/verification-fixes

Conversation

@ling-senpeng13

@ling-senpeng13 ling-senpeng13 commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Pending decision on whether to take these fixes.** Companion to #438 (verification report, docs only); together they replace #437 (closed). Every fix below reproduces on main and was verified end-to-end against a live conductor-oss 3.32.0-rc.8 server. Agents suite: 91 PASS / 12 ERROR / 3 HUNG before → 96 PASS / 2 ERROR / 2 HUNG after; tests/unit/ai: 1744 passed.

Counts at a glance

22 examples failed or misbehaved during verification (15 agents suite, 7 core suite). Disposition after this PR:

Outcome Agents Core Total
✅ Newly passing — fixed by code changes here 4 5 9
⏱ Passes with a longer suite timeout (no code change needed) 1 0 1
➖ Reclassified — env-dependent → SKIP, or daemon/interactive by design 6 2 8
❌ Still failing — not fixed here (table at the bottom) 4 0 4
Total 15 7 22

(kitchen_sink.py is counted in "still failing": this PR fixes its TypeError but it then fails server-side.)

Example fixes

File Bug Fix
helloworld/greetings_worker.py duplicate def greet shadowed the registered worker → spawn-pickling failure on macOS/Windows (broke workers_e2e, helloworld, task_listener_example) rename second function greet_sync
worker_example.py hardcoded /Users/viren/ metrics dir → PermissionError everywhere else tempfile.gettempdir()
user_example/user_workers.py imported examples.user_example.models while loaded as user_example.user_workers — spawn children crashed consistent package-relative import
agents/kitchen_sink.py @agent classifiers declared a required prompt arg; decorator invokes them with zero args → TypeError zero-arg signatures
agents/16i, agents/16j tools defined inside factory functions → SpawnSafetyError (<locals> not importable by spawn workers) hoisted to module level
agents/94_openai_runner_tools.py @function_tool rebinds the module global to an unpicklable FunctionTool plain function at module level, function_tool() applied at Agent(...) construction
agentic_workflows/llm_chat.py (a) two LLM tasks sent system-only messages — server fails the workflow before the first task; (b) example printed "Conversation complete." and exited 0 over a FAILED workflow added user messages; exit non-zero on non-COMPLETED terminal state
agents/run_all_examples.py 6 env-dependent examples counted as ERROR classified SKIP with reasons (dg skill repo; workflow messages API absent in rc.8)

SDK fix

_try_worker_task in conductor/ai/agents/tool.py: once ToolRegistry.register_tool_workers re-registers a @worker_task tool's task name with a spawn-safe ToolWorkerEntry wrapper, the raw identity check failed and a second get_tool_def() on the same tool raised TypeError (broke 14_existing_workers.py). The lookup now walks __wrapped__/fn_direct/fn_ref carriers. Two regression tests added.

Not fixed here — 4 examples (see the report in #438)

Of the 22 failures this verification surfaced, 9 examples are fixed by code changes in this PR, 9 are resolved without code fixes (reclassified or timeout), and 4 remain unfixed — the agents suite still shows 2 ERROR + 2 HUNG after these fixes:

# Example Status after this PR Why it is not fixed here
1 agents/kitchen_sink.py ERROR This PR fixes its classifier TypeError, but it then fails server-side: HTTP 500 — Task translation_swarm defined as a sub-workflow has no workflow definition available. Sub-workflow (SWARM strategy) registration on conductor-oss rc.8 needs SDK/server investigation.
2 agents/74_cli_error_output.py FLAKY (ERROR in suite run) LLM-behavior assertion — the agent paraphrases stderr instead of quoting it verbatim, so it passes or fails depending on model output. Needs a looser assertion or stricter prompt, which changes the example's intent.
3 agents/86_coding_agent.py HUNG Does not finish within 420s even running solo. Root cause unknown; needs investigation (or reclassification as long-running).
4 agents/68_context_condensation.py HUNG in suite / PASS solo Passes solo in ~346s but exceeds the 360s suite timeout under 8-way contention. A code fix is arguably wrong — the suite timeout or example size is the issue.

…ix worker-tool registry lookup after re-registration

Companion to the verification-report PR (#438) — every fix verified
end-to-end against a live conductor-oss 3.32.0-rc.8 server. Agents suite:
91 PASS / 12 ERROR / 3 HUNG before, 96 PASS / 2 ERROR / 2 HUNG after.

Example fixes:
- greetings_worker.py: duplicate `def greet` shadowed the registered
  worker and broke spawn pickling on macOS/Windows (workers_e2e,
  helloworld, task_listener_example)
- worker_example.py: hardcoded /Users/viren metrics dir -> tempfile
- user_workers.py: import via examples.* package identity crashed spawn
  children that load the module as user_example.*
- kitchen_sink.py: @agent classifier functions must take zero args
- 16i/16j: tools defined inside factory functions are not importable by
  spawn workers (SpawnSafetyError) — hoisted to module level
- 94_openai_runner_tools.py: keep the plain function at module level and
  apply function_tool() at Agent construction so the module global is
  not rebound to an unpicklable FunctionTool
- llm_chat.py: server requires a non-empty user message (two tasks sent
  system-only lists); also exit non-zero when the workflow ends FAILED
  instead of reporting success on any terminal state
- run_all_examples.py: classify 6 env-dependent examples as SKIP with
  reasons (dg skill repo; workflow messages API absent in rc.8)

SDK fix:
- tool.py _try_worker_task: registry identity check failed once
  ToolRegistry.register_tool_workers re-registered the task name with a
  spawn-safe ToolWorkerEntry wrapper; lookup now walks __wrapped__ /
  fn_direct / fn_ref carriers (broke 14_existing_workers.py; 2
  regression tests added, tests/unit/ai: 1744 passed)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/conductor/ai/agents/tool.py 87.50% 2 Missing ⚠️
Files with missing lines Coverage Δ
src/conductor/ai/agents/tool.py 91.54% <87.50%> (-0.40%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ling-senpeng13 ling-senpeng13 self-assigned this Jul 18, 2026
@ling-senpeng13
ling-senpeng13 marked this pull request as ready for review July 20, 2026 16:18
@ling-senpeng13
ling-senpeng13 requested a review from v1r3n July 20, 2026 16:20
@ling-senpeng13
ling-senpeng13 merged commit c44e7fa into main Jul 20, 2026
3 checks passed
@v1r3n
v1r3n deleted the examples/verification-fixes branch July 20, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants