Skip to content

Fix non-bool approval policy results failing open - #4847

Open
mikemikimike wants to merge 1 commit into
openai:mainfrom
mikemikimike:fix/approval-predicate-fail-closed
Open

Fix non-bool approval policy results failing open#4847
mikemikimike wants to merge 1 commit into
openai:mainfrom
mikemikimike:fix/approval-predicate-fail-closed

Conversation

@mikemikimike

Copy link
Copy Markdown

Summary

Callable needs_approval policies are declared to return bool, but a non-boolean result such as None was coerced with bool() and treated as approval not required. This pull request makes every non-boolean callable result fail closed by requiring approval, and routes MCP callable policies through the same evaluator so they cannot bypass the fix.

Fixes #4845

Test plan

  • Added ordinary Runner regression coverage for None and truthy non-boolean results from async approval predicates; both cases interrupt before the tool runs.
  • Added MCP end-to-end coverage for sync and async policies returning None; both cases interrupt and record zero MCP calls.
  • Focused tests: 5 passed in tests/test_run_step_execution.py, 4 passed in tests/mcp/test_mcp_approval.py, and 3 passed in tests/mcp/test_mcp_util.py.
  • make format and make lint passed; targeted Ruff, format, mypy, and Pyright checks passed.
  • The full repository checks were attempted. Full mypy reported 46 pre-existing errors in 8 files, and full Pyright reported 27 pre-existing errors in sandbox/optional-dependency files. The full non-serial test run reached 6616 passed and 98 skipped, with 38 failures and 40 collection errors caused by missing optional dependencies and existing Windows/sandbox/runloop environment issues. The serial test entry point passed.

Issue number

Fixes #4845

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
  • If using Codex, I've run /review before submitting this PR

AI disclosure

This pull request was prepared with AI assistance. The implementation, tests, and verification results were reviewed before submission.

@mikemikimike

Copy link
Copy Markdown
Author

Local focused verification is green (ordinary Runner, MCP approval, Ruff, mypy/Pyright on touched modules). The repository's fork-triggered Tests workflows are currently completed with �ction_required; I cannot approve them from the contributor account. The PR body records the full local-suite optional-dependency and Windows limitations.

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.

Callable needs_approval fails open when the predicate returns a non-bool (e.g. an unhandled branch returning None)

1 participant