Skip to content

fix(approval): AutoApprovalClassifier accepts a function as fallback - #78

Draft
cryxnet wants to merge 1 commit into
mainfrom
fix/classifier-callable-fallback
Draft

cryxnet wants to merge 1 commit into
mainfrom
fix/classifier-callable-fallback

Conversation

@cryxnet

@cryxnet cryxnet commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

AutoApprovalClassifier(fallback=some_function) was accepted when built and then failed at the first escalation with AttributeError: 'function' object has no attribute 'request_approval'. ApprovalPolicy(handler=...) and build_agent(approval=...) accept bare functions, so this was inconsistent. Found while reviewing the policy-as-code guide.

  • approval_classifier.py: a callable fallback is wrapped in CallbackApprovalHandler (plain or async, returning ApprovalDecision or bool); anything else raises TypeError at construction.
  • Docs: one sentence in approval-classifier.md. Changelog: Unreleased entry.
  • Tests: TestFunctionFallback (async function, plain function returning bool, non-callable rejected); all three fail before and pass after. Approval suites: 236 passed. Held for the next release.

🤖 Generated with Claude Code

A bare function was accepted at construction and failed at the first
escalation with AttributeError. It is now wrapped in CallbackApprovalHandler
like ApprovalPolicy(handler=...) does; anything else raises TypeError up front.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
)
# A bare function, as ApprovalPolicy(handler=...) accepts; it used
# to pass here and fail at the first escalation.
from .approval import CallbackApprovalHandler
@cryxnet cryxnet mentioned this pull request Oct 27, 2026

This branch has not been deployed

No deployments
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