Skip to content

fix(feishu): patch approval cards after button resolution#10412

Open
Magic-Jia wants to merge 1 commit into
NousResearch:mainfrom
Magic-Jia:fix/feishu-approval-button-card-updates
Open

fix(feishu): patch approval cards after button resolution#10412
Magic-Jia wants to merge 1 commit into
NousResearch:mainfrom
Magic-Jia:fix/feishu-approval-button-card-updates

Conversation

@Magic-Jia

Copy link
Copy Markdown

What does this PR do?

Fixes the Feishu command-approval card flow after a button click.

Previously, the card-resolution path could fail to match the pending approval when Feishu delivered action.value as a JSON string and/or returned approval_id as a string. The follow-up card update also used message.update, which is less suitable for mutating the existing interactive card after a button click. This change makes the callback path tolerant to those payload shapes and patches the original card in place after resolution.

Related Issue

No linked issue.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • In gateway/platforms/feishu.py:
    • enable update_multi on approval cards so they can be updated after an action
    • switch approval-card mutation from message.update to message.patch
    • parse stringified action.value payloads in card callbacks
    • resolve approvals even when approval_id arrives as a string instead of an int
    • add request builders for Feishu patch-message requests
  • In tests/gateway/test_feishu_approval_buttons.py:
    • assert update_multi=True is present on approval cards
    • cover JSON-string action.value with string approval_id
    • update approval-card tests to expect message.patch

How to Test

  1. Run source venv/bin/activate && python -m pytest tests/gateway/test_feishu_approval_buttons.py -q
  2. Confirm all 17 tests pass.
  3. In Feishu, trigger a dangerous-command approval card and click an approval/deny button.
  4. Confirm the pending approval resolves and the original card is patched to the final approved/denied state.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Ubuntu/Linux

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

$ source venv/bin/activate && python -m pytest tests/gateway/test_feishu_approval_buttons.py -q
.................                                                        [100%]
17 passed in 1.52s

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter comp/gateway Gateway runner, session dispatch, delivery labels Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/feishu Feishu / Lark adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants