Add receipt-bound Feishu approvals with repairable Tool feedback - #965
Draft
Y1fe1Zh0u wants to merge 3 commits into
Draft
Add receipt-bound Feishu approvals with repairable Tool feedback#965Y1fe1Zh0u wants to merge 3 commits into
Y1fe1Zh0u wants to merge 3 commits into
Conversation
Add typed Feishu approval definition, attachment upload, and create tools while binding provider submission to the exact tenant, Run, Tool Ledger receipt, applicant, and in-chat confirmation. Constraint: Approval creation must not depend on a new frontend or legacy ApprovalRequest flow Constraint: Existing user worktree changes remain outside this commit Rejected: Bare yes/no confirmation | stale replies could authorize another request Rejected: Raw approver and CC open IDs | bypasses tenant roster authorization Rejected: Reusable bearer proof | could replay an identical provider write Confidence: high Scope-risk: moderate Reversibility: clean Directive: Do not expose feishu_approval_create outside the receipt-bound Durable Runtime conversation gate Tested: 335 relevant backend tests; scoped Ruff; compileall; diff check; independent code review and verification Not-tested: Live Feishu Provider create and 3010 deployment
Native group replies already persist human mentions without dispatching work, but the Runtime at preflight rejected every non-Agent participant. Split public mention validation from Agent handoff validation so mixed human and Agent targets remain atomic while child Runs are created only for wakeable Agents. Constraint: Human mentions must remain visible without creating child Runs. Rejected: Strip human IDs during model repair | loses structured mention metadata and contradicts group message behavior. Confidence: high Scope-risk: narrow Directive: Keep public mention targets distinct from wakeable Agent targets. Tested: 232 scoped Runtime and group delivery tests; Ruff check on changed files. Not-tested: Browser rendering and live 3010 mixed-mention E2E pending deployment.
Some model providers reject composite Tool schemas before execution, while generic Feishu approval failures hide the receipt needed to correct a request. Keep model-visible schemas provider-compatible, enforce composite constraints in handlers, and preserve bounded sanitized Feishu receipts through Runtime outcome storage. Constraint: Model-visible Tool schemas must avoid anyOf, oneOf, and allOf for provider compatibility Rejected: Drop conditional argument constraints | handlers still need to reject invalid calls Rejected: Persist raw provider responses without bounds | response bodies may be large or contain secrets Confidence: high Scope-risk: moderate Directive: Keep composite constraints in handlers when simplifying model-visible schemas Tested: 290 scoped pytest cases passed; Ruff passed on 11 files and the changed agent_tools.py regions had no reported violations Not-tested: Live Feishu approval calls and external model-provider acceptance
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
anyOf,oneOf, andallOffrom model-visible Tool schemas while retaining the constraints in handlersWhy
Feishu approval creation is an external write and must not be authorized by a stale or reusable confirmation. The approval tools therefore bind consent and provider submission to the current conversation, Runtime execution, tenant roster, applicant, and Tool receipt.
Two follow-up problems are addressed in the same branch:
The resulting contract keeps public mention targets separate from wakeable Agent targets, and keeps model-visible schemas compatible without weakening execution-time validation.
Validation
390 passedacross scoped Runtime, group handoff, finish protocol, Tool outcome, deployment, image, Vercel, Feishu approval, and builtin Tool contract testsagent_tools.pyagent_tools.pyremains blocked by 56 pre-existing findings outside the changed regionsNot tested