fix(agents): Custom guardrail worker misreports pass as fail on retry/fix - #150
Merged
Merged
Conversation
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.
... and 3 files with indirect coverage changes 🚀 New features to boost your workflow:
|
kowser-orkes
force-pushed
the
fix/guardrail-custom-onfail-passed
branch
from
July 29, 2026 03:06
4fbba1f to
7ca22bb
Compare
v1r3n
approved these changes
Jul 29, 2026
…/fix _registerGuardrailWorker always echoed the guardrail's configured onFail value in on_fail, even when the check passed. The server-side guardrail router only treats on_fail as "pass" when it's null/"pass", so any custom guardrail(onFail: 'retry'|'fix') that genuinely passed was still routed into the retry loop, permanently, until it hit the workflow's retry ceiling and failed the whole run. Also fixes examples/agents/04-guardrails.ts's factChecker, which used onFail:'human' with the one-shot runtime.run() API -- a real hang, since nothing ever completes the pending human task in that script. Matches the onFail:'retry' pattern already used by the equivalent guardrail-type combo demo (10-guardrails.ts); onFail:'human' has its own dedicated demo in 32-human-guardrail.ts using the correct start/stream/respond pattern. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
kowser-orkes
force-pushed
the
fix/guardrail-custom-onfail-passed
branch
from
July 29, 2026 04:11
7ca22bb to
500a5e6
Compare
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.
Pull Request Title: fix(agents): custom guardrail worker misreports pass as fail on retry/fix
Pull Request type
Changes in this PR
_registerGuardrailWorkeralways echoed the guardrail's configuredon_failvalue even when the check passed, so the server-side router (which only treatson_fail: null/"pass"as passing) always routed passing custom guardrails into the retry loop until it hit the retry ceiling and failed the whole run; now setson_fail: "pass"on success, matching Java/Pythonexamples/agents/04-guardrails.tsusedonFail: 'human'with the one-shotruntime.run()API, which hangs forever since nothing completes the pending human task; changed toonFail: 'retry', matching the same combo demo in10-guardrails.tsIssue #
Alternatives considered
None.