Skip to content

mail +triage: Extract and preserve mailbox_id from batch_get response#1944

Open
chumbleyneria wants to merge 1 commit into
larksuite:mainfrom
chumbleyneria:feat/1813b76
Open

mail +triage: Extract and preserve mailbox_id from batch_get response#1944
chumbleyneria wants to merge 1 commit into
larksuite:mainfrom
chumbleyneria:feat/1813b76

Conversation

@chumbleyneria

@chumbleyneria chumbleyneria commented Jul 17, 2026

Copy link
Copy Markdown

Generated by the harness-coding skill (recovery run — original attempt crashed before MR open).

  • Task ID: 01KXQGDWRPXM4K66MHHZCAXR1F-12
  • Branch: feat/1813b76
  • Target: main

The commits below were produced by a prior coding run on this branch. The current resume run regenerated the sprint plan from tech-specs and confirmed those commits already implement the work.

Commits on branch (ahead of main)

Commit Subject
eafc316 mail +triage: Extract and preserve mailbox_id from batch_get response

Source specs

  • /home/zenghuansheng/.local/state/harness-agent/envs/env-63732045c1d5/generic-workers/generic-n199-204-183-dbed6e/coding/claude-code/01KXQGDWRPXM4K66MHHZCAXR1F/01KXQGDWRPXM4K66MHHZCAXR1F-12/input/deploy-report.md

This MR was created autonomously. Quality gates were enforced by the repo's own pre-commit hooks.

Summary by CodeRabbit

  • Bug Fixes
    • Improved mail +triage handling for public and shared mailboxes.
    • Preserves mailbox context supplied by the server when available.
    • Prevents existing mailbox identifiers from being overwritten during message processing.

Update the mail +triage shortcut to extract mailbox_id from backend batch_get
responses and include it in output. This enables AI agents to correctly identify
which mailbox (personal or shared) a message belongs to when calling subsequent
commands like mail +message.

Changes:
- buildTriageMessageMeta(): Extract mailbox_id from response if present
- Injection logic: Only inject mailbox parameter if mailbox_id not already set
- Preserves backward compatibility: falls back to mailbox parameter if response
  doesn't include mailbox_id

Supports both JSON and table output formats:
- JSON: mailbox_id included in each message object
- Table: mailbox_id column shown for non-personal mailbox scenarios
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Harness Task Owner seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@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 Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Mail triage now copies mailbox_id from backend batch responses into message metadata and only supplies a fallback mailbox identifier when one is not already present.

Changes

Mail triage mailbox context

Layer / File(s) Summary
Preserve backend mailbox identifiers
shortcuts/mail/mail_triage.go
buildTriageMessageMeta includes a provided backend mailbox_id, while final message processing preserves existing mailbox identifiers instead of overwriting them.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • larksuite/cli#1238: Updates the same mail triage path to preserve and propagate mailbox_id.

Suggested reviewers: zhaojunlin0405

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description does not follow the required template and omits Summary, Changes, Test Plan, and Related Issues sections. Add the template sections with a brief summary, bullet list of changes, verification steps, and related issues status.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: extracting and preserving mailbox_id from batch_get responses.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@shortcuts/mail/mail_triage.go`:
- Around line 575-578: Replace the direct msg["mailbox_id"] lookup in the
batch-response handling with decoding into the existing typed message struct,
including its MailboxID field. Pass that typed value through
buildTriageMessageMeta so mailbox IDs are projected consistently while malformed
or unsupported shapes are rejected.
🪄 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: b2c12e82-67a8-41f5-b57a-d9fd78544d9a

📥 Commits

Reviewing files that changed from the base of the PR and between 4a56748 and eafc316.

📒 Files selected for processing (1)
  • shortcuts/mail/mail_triage.go

Comment on lines +575 to +578
// Extract mailbox_id from response if present (backend returns it for public/shared mailbox scenarios)
if v := strVal(msg["mailbox_id"]); v != "" {
item["mailbox_id"] = v
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Decode mailbox_id through a typed batch response.

This new direct map[string]interface{} lookup extends the loose-map boundary. Decode the batch response into a typed message struct, then project its MailboxID through buildTriageMessageMeta; this avoids silently accepting malformed or unsupported field shapes.

As per coding guidelines, parse map[string]interface{} into typed structs at boundaries and do not introduce new loose-map code.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@shortcuts/mail/mail_triage.go` around lines 575 - 578, Replace the direct
msg["mailbox_id"] lookup in the batch-response handling with decoding into the
existing typed message struct, including its MailboxID field. Pass that typed
value through buildTriageMessageMeta so mailbox IDs are projected consistently
while malformed or unsupported shapes are rejected.

Source: Coding guidelines

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