Fix agent examples: top-level await, broken assertion, silent failures#141
Open
NicholasDCole wants to merge 1 commit into
Open
Fix agent examples: top-level await, broken assertion, silent failures#141NicholasDCole wants to merge 1 commit into
NicholasDCole wants to merge 1 commit into
Conversation
Found by a full smoke sweep of all 116 agent examples against a local Conductor OSS 3.32.0-rc.8 server (Anthropic Haiku 4.5). Three groups of fixes: 1. Top-level await (7 files: 12, 57, 63, 63b, 63c, 63d, 63e): upstream agentspan was ESM; this repo's CJS module flavor makes tsx reject top-level await, so these examples did not compile at all. Wrapped in the house-style async main(). 63-deploy and 63d get a require.main === module guard because 63c/63e import their agent definitions - without it, importing would execute the sibling example. 2. 74-cli-error-output: the assertion did String(result.output) on an object, always producing "[object Object]" and false-failing even though the agent surfaced stderr correctly. Stringify properly. Same latent bug fixed in 10-guardrails' PII leak check. 3. Silent failures (10-guardrails, 54-software-bug-assistant): both printed [FAIL] results and exited 0, so any harness built on exit codes passes vacuously. They now set exit code 1 when the run ends non-COMPLETED (and 10-guardrails also when PII leaks); main().catch sets the exit code instead of swallowing errors. Verified: all 7 TLA examples + 74 run green end-to-end against the local stack; 10 and 54 now exit 1 with the real upstream diagnostics (a server ChatMessage deserialization bug and an MCP Authorization-header issue, tracked separately). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
NicholasDCole
marked this pull request as ready for review
July 21, 2026 16:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A full smoke sweep of all 116
examples/agents/files against a local Conductor OSS 3.32.0-rc.8 server surfaced three groups of broken examples. This PR fixes the ones that are unambiguously example bugs (SDK/server-level findings are tracked separately).1. Top-level await — examples didn't compile (7 files)
12-long-running,57-plan-dry-run,63-deploy,63b-serve,63c-run-by-name,63d-serve-from-package,63e-run-monitoringUpstream agentspan was ESM; under this repo's CJS module flavor, tsx rejects top-level await, so these examples failed with a
TransformErrorbefore running anything. All are now wrapped in the house-styleasync main().63-deployand63dadditionally get arequire.main === moduleguard because63c/63eimport their agent definitions — without the guard, importing would execute the sibling example.2. Broken assertion (1 file)
74-cli-error-outputcalledString(result.output)on an object, always producing[object Object], so its self-check false-failed even though the agent surfaced the CLI stderr correctly. Fixed to stringify properly. The same latentString(result.output)bug in10-guardrails' PII-leak check is fixed too (it made the leak check vacuous).3. Silent failures — printed
[FAIL], exited 0 (2 files)10-guardrailsand54-software-bug-assistantprinted FAILED results but exited 0, so any exit-code-based harness passes vacuously. Both now set exit code 1 when the run ends non-COMPLETED, and theirmain().catchsets the exit code instead of swallowing the error.Verification (local Conductor OSS 3.32.0-rc.8 boot JAR, Anthropic Haiku 4.5)
74run green end-to-end (exit 0,74printsPASS)10and54now exit 1 with the real upstream diagnostics:10: server-sideChatMessage.messageString-vs-Array deserialization error54: MCP server rejects credential — "Authorization header is badly formatted"(both are SDK/server-level issues, not fixed here)
npx tsc --noEmit -p examples/agents/tsconfig.jsonclean (one pre-existing, unrelated error insrc/sdk/.../getUndiciHttp2FetchFn.ts)npx eslintclean on all 10 files🤖 Generated with Claude Code