Skip to content

feat(mail): add email recall support#481

Merged
chanthuang merged 1 commit intomainfrom
feat/mail-recall
Apr 15, 2026
Merged

feat(mail): add email recall support#481
chanthuang merged 1 commit intomainfrom
feat/mail-recall

Conversation

@chanthuang
Copy link
Copy Markdown
Collaborator

@chanthuang chanthuang commented Apr 15, 2026

Summary

  • Add recall tip after sending: when the backend indicates a message is recallable (within 24 hours), the send response includes a recall_available flag and a ready-to-use recall command
  • Add recall and get_recall_detail commands under mail user_mailbox.sent_messages for recalling sent emails and querying recall progress
  • Update mail skill documentation with recall workflow guidance

Usage

Recall a sent email (within 24 hours):

lark-cli mail user_mailbox.sent_messages recall --as user \
  --params '{"user_mailbox_id":"me","message_id":"<message_id>"}'

Query recall progress:

lark-cli mail user_mailbox.sent_messages get_recall_detail --as user \
  --params '{"user_mailbox_id":"me","message_id":"<message_id>"}'

Test plan

  • Send an email, verify recall_available and recall_tip appear in response
  • Recall a recently sent email, verify recall_status: available
  • Query recall detail, verify per-recipient status
  • Attempt recall on email older than 24 hours, verify recall_status: unavailable

Summary by CodeRabbit

Release Notes

  • New Features

    • Added email recall functionality allowing users to retract sent messages when available.
    • Added ability to track recall progress and results asynchronously.
  • Documentation

    • Added guides for recalling sent emails and monitoring recall status.
    • Documented new API methods for recall operations and progress queries.

- Add buildSendResult helper that includes recall_available/recall_tip
  when backend returns recall_status in send response
- Update +send, +reply, +reply-all, +forward to use buildSendResult
- Add "Recall Email" section to mail skill template with recall and
  get_recall_detail command examples
- Regenerate SKILL.md

Change-Id: I44317ead8f8a65db81e874cfc3529ffeb21e1384
Co-Authored-By: AI
@github-actions github-actions bot added domain/mail PR touches the mail domain size/M Single-domain feat or fix with limited business impact labels Apr 15, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 15, 2026

📝 Walkthrough

Walkthrough

A new helper function buildSendResult was introduced to construct mail send operation outputs, conditionally augmenting results with recall availability and CLI instructions. This helper is now integrated into the mail send, reply, reply-all, and forward shortcuts. Documentation was added describing the mail recall API and asynchronous progress polling operations.

Changes

Cohort / File(s) Summary
Mail Helpers
shortcuts/mail/helpers.go
Added buildSendResult() helper that constructs send outputs with message_id and thread_id, plus conditional recall_available flag and formatted recall_tip when recall status is available.
Mail Shortcuts
shortcuts/mail/mail_send.go, shortcuts/mail/mail_reply.go, shortcuts/mail/mail_reply_all.go, shortcuts/mail/mail_forward.go
Refactored success output paths to call buildSendResult(resData, mailboxID) instead of inline map construction, enabling consistent recall information in responses.
Mail Documentation
skill-template/domains/mail.md, skills/lark-mail/SKILL.md
Added recall feature documentation including recall and get_recall_detail API methods with behavioral notes on availability gating and asynchronous progress polling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

domain/mail, size/M

Suggested reviewers

  • infeng

Poem

🐰 A helper hops in with recall in sight,
Through send and reply, it shines so bright,
With tips and flags now fortified,
The mail commands run side-by-side! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(mail): add email recall support' clearly and concisely describes the main feature addition—email recall functionality for sent emails within the mail system.
Description check ✅ Passed The PR description provides a complete summary, usage examples for both recall commands, and a comprehensive test plan covering the main scenarios; it follows the repository template structure with all sections properly filled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/mail-recall

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chanthuang chanthuang requested a review from infeng April 15, 2026 03:27
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@shortcuts/mail/helpers.go`:
- Around line 1946-1948: The recall_tip construction injects mailboxID and
messageID directly into a single-quoted JSON snippet, which breaks the
ready-to-run command if those IDs contain quotes; update the code that builds
result["recall_tip"] to safely escape or serialize the params (e.g., build a Go
map with "user_mailbox_id" and "message_id" and json.Marshal it, or explicitly
escape single quotes/backslashes in mailboxID and messageID) before embedding
into fmt.Sprintf so the resulting lark-cli command is always valid; change the
usage around fmt.Sprintf(...) that sets result["recall_tip"] to use the
serialized/escaped params variable.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 883d0245-6b2e-403f-9d38-3d5d124cb1ae

📥 Commits

Reviewing files that changed from the base of the PR and between 74e4a97 and 0a2e183.

📒 Files selected for processing (7)
  • shortcuts/mail/helpers.go
  • shortcuts/mail/mail_forward.go
  • shortcuts/mail/mail_reply.go
  • shortcuts/mail/mail_reply_all.go
  • shortcuts/mail/mail_send.go
  • skill-template/domains/mail.md
  • skills/lark-mail/SKILL.md

@github-actions
Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@0a2e1830edbbf3af7c36d37427bcaa1705e0db07

🧩 Skill update

npx skills add larksuite/cli#feat/mail-recall -y -g

@infeng infeng self-requested a review April 15, 2026 04:27
@chanthuang chanthuang merged commit 162c255 into main Apr 15, 2026
16 checks passed
@chanthuang chanthuang deleted the feat/mail-recall branch April 15, 2026 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/mail PR touches the mail domain size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants