Skip to content

feat: feishu interactive card approval for agent permission requests#409

Open
xinuxZ wants to merge 1 commit intoRightNow-AI:mainfrom
xinuxZ:feat/feishu-card-approval
Open

feat: feishu interactive card approval for agent permission requests#409
xinuxZ wants to merge 1 commit intoRightNow-AI:mainfrom
xinuxZ:feat/feishu-card-approval

Conversation

@xinuxZ
Copy link

@xinuxZ xinuxZ commented Mar 7, 2026

When an agent requests human approval (e.g. to execute a shell command), send an interactive Feishu card with Approve/Reject buttons instead of requiring the user to type /approve manually.

Key changes:

  • Approval notification: ApprovalManager broadcasts new requests via tokio broadcast channel; bridge layer subscribes and pushes cards to the last active Feishu user in real time

  • Concurrent message dispatch: each inbound message now spawns its own task so a long-running agent call (blocked on approval) no longer prevents the user from sending /approve

  • Feishu card callback parsing: support both card.action.trigger and application.bot.menu_v6 event types; button clicks are converted to /approve or /reject commands

  • Feishu WebSocket receive mode: full implementation with reconnect backoff, protobuf frame decoding, ping/pong heartbeat, and multi-frame message reassembly

  • exec_policy smart approval: allowlisted commands skip approval (fast path); unlisted commands escalate to approval instead of hard-blocking; approved commands are persisted to config.toml

  • Hand agent model restore: use tag-based detection instead of hardcoded name; always re-apply default_model on DB restore

  • Cross-compilation fix (openfang-cli/Cargo.toml, Cross.toml): add openssl vendored feature and rustls-tls for reqwest to fix cross build --target x86_64-unknown-linux-musl failure — the musl Docker container lacks system OpenSSL, so vendored mode downloads and statically compiles OpenSSL from source

Summary

Changes

Testing

  • cargo clippy --workspace --all-targets -- -D warnings passes
  • cargo test --workspace passes
  • Live integration tested (if applicable)

Security

  • No new unsafe code
  • No secrets or API keys in diff
  • User input validated at boundaries

When an agent requests human approval (e.g. to execute a shell command),
send an interactive Feishu card with Approve/Reject buttons instead of
requiring the user to type /approve <id> manually.

Key changes:

- Approval notification: ApprovalManager broadcasts new requests via
  tokio broadcast channel; bridge layer subscribes and pushes cards
  to the last active Feishu user in real time

- Concurrent message dispatch: each inbound message now spawns its
  own task so a long-running agent call (blocked on approval) no
  longer prevents the user from sending /approve

- Feishu card callback parsing: support both card.action.trigger and
  application.bot.menu_v6 event types; button clicks are converted
  to /approve or /reject commands

- Feishu WebSocket receive mode: full implementation with reconnect
  backoff, protobuf frame decoding, ping/pong heartbeat, and
  multi-frame message reassembly

- exec_policy smart approval: allowlisted commands skip approval
  (fast path); unlisted commands escalate to approval instead of
  hard-blocking; approved commands are persisted to config.toml

- Hand agent model restore: use tag-based detection instead of
  hardcoded name; always re-apply default_model on DB restore

- Cross-compilation fix (openfang-cli/Cargo.toml, Cross.toml):
  add openssl vendored feature and rustls-tls for reqwest to fix
  `cross build --target x86_64-unknown-linux-musl` failure — the
  musl Docker container lacks system OpenSSL, so vendored mode
  downloads and statically compiles OpenSSL from source
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