Skip to content

Add receipt-bound Feishu approval tools - #950

Draft
Y1fe1Zh0u wants to merge 2 commits into
dataelement:mainfrom
Y1fe1Zh0u:agent/feishu-approval-tools
Draft

Add receipt-bound Feishu approval tools#950
Y1fe1Zh0u wants to merge 2 commits into
dataelement:mainfrom
Y1fe1Zh0u:agent/feishu-approval-tools

Conversation

@Y1fe1Zh0u

Copy link
Copy Markdown
Collaborator

What changed

  • Add typed Feishu approval-definition reads, attachment upload, and approval creation tools.
  • Bind approval creation to the tenant, applicant, Runtime Run, Tool Ledger receipt, exact arguments, and an in-chat confirmation.
  • Resolve creation targets through the tenant roster instead of accepting arbitrary Provider identities.
  • Preserve bounded and sanitized Feishu Provider receipts in failed Tool outcomes so the model can repair invalid forms, permissions, and control values.
  • Reject attachment objects before confirmation; approval form attachments must use stable file-code strings returned by the upload Tool.

Why

Approval creation is an external write. A generic confirmation or generic Provider error can either authorize the wrong request or cause the model to retry an ambiguous write. The Runtime needs a single-use proof tied to the exact Tool call, and the model needs sanitized Provider facts to repair deterministic validation failures without replaying uncertain writes.

Safety and behavior

  • Approval creation remains unavailable outside the Durable Runtime confirmation gate.
  • Provider timeouts and ambiguous write receipts remain non-retryable unknown outcomes that require reconciliation.
  • Deterministic HTTP/business rejections are returned as model-visible failures with bounded, redacted receipt metadata.
  • Sensitive form_data stays redacted from observability.

Validation

  • 804 Runtime and Tool tests passed.
  • 201 approval-focused tests passed.
  • Ruff fatal rules passed on all changed files.
  • Architecture Guard P0 passed.
  • Diff check passed.

Remaining validation

  • Live Feishu approval creation and the deployed 3010 confirmation flow have not been run.

CI baseline dependency

This branch is intentionally based directly on main. Current main still contains the independent f061_enterprise_info_tenant_id fresh-database duplicate-column defect. PR #945 fixes that migration and passed the same fresh PostgreSQL lane in Drone #489. If this PR's Drone run stops on that known migration failure, refresh this branch after #945 reaches main; do not mix the migration repair into this approval PR.

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
Preserve a bounded, sanitized Provider receipt in the Tool outcome and surface HTTP status, business code, message, and response body to the model. Approval reads and writes retain their existing retry classification, while attachment inputs are rejected before confirmation unless they contain stable file-code strings.

Constraint: External approval writes must never be replayed after an ambiguous Provider outcome

Constraint: Provider response metadata must pass through the Tool Ledger sanitizer before model visibility

Rejected: Return only a generic rejection string | leaves the model unable to repair invalid form controls or permissions

Rejected: Accept attachment objects in form_data | confirmation would bind an unstable provider payload shape

Confidence: high

Scope-risk: moderate

Directive: Preserve provider receipt bounds and redaction whenever adding new Feishu failure fields

Tested: 804 Runtime and Tool tests; 201 approval-focused tests; fatal Ruff; Architecture Guard P0; diff check

Not-tested: Live Feishu Provider create and deployed 3010 approval flow
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.

1 participant