Skip to content

fix(agent-tools): honor falsey custom output extractors - #4088

Merged
seratch merged 1 commit into
openai:mainfrom
n33levo:nsarkar/honor-falsey-output-extractor
Aug 1, 2026
Merged

fix(agent-tools): honor falsey custom output extractors#4088
seratch merged 1 commit into
openai:mainfrom
n33levo:nsarkar/honor-falsey-output-extractor

Conversation

@n33levo

@n33levo n33levo commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Agent.as_tool(custom_output_extractor=...) currently checks the configured extractor by truthiness. A callable object whose __bool__ returns False is accepted by the public API but silently skipped, so the nested agent returns its default output instead of the custom result.

This changes the guard to an explicit is not None check. None keeps the existing fallback behavior; ordinary async functions and the public API are unchanged.

Test plan

  • env UV_DEFAULT_INDEX=https://pypi.org/simple bash .agents/skills/code-change-verification/scripts/run.sh - format, lint, typecheck, and full tests passed
  • make coverage - 6,034 passed, 8 skipped; 91% total coverage
  • make tests-asyncio-stability - 5 repetitions passed (7 + 33 tests per repetition)
  • Python 3.10 focused tests - 2 passed
  • Python 3.14 focused tests - 2 passed

E2E top-hat using the public Agent.as_tool invocation path:

  • v0.19.2 returned default-output and skipped the falsey extractor
  • This branch returned custom-output and invoked the extractor once

Issue number

N/A - searches across open and closed issues and pull requests found no duplicate.

Checks

  • I've added new tests, if relevant
  • I've run .agents/skills/code-change-verification/scripts/run.sh
  • I've confirmed all verification steps pass

@n33levo
n33levo marked this pull request as ready for review August 1, 2026 20:02
@seratch seratch added this to the 0.19.x milestone Aug 1, 2026
@seratch
seratch enabled auto-merge (squash) August 1, 2026 23:23
@seratch
seratch merged commit d5f51d3 into openai:main Aug 1, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants