mail +triage: Extract and preserve mailbox_id from batch_get response#1944
mail +triage: Extract and preserve mailbox_id from batch_get response#1944chumbleyneria wants to merge 1 commit into
Conversation
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
|
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. |
📝 WalkthroughWalkthroughMail triage now copies ChangesMail triage mailbox context
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
shortcuts/mail/mail_triage.go
| // 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 | ||
| } |
There was a problem hiding this comment.
📐 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
Generated by the harness-coding skill (recovery run — original attempt crashed before MR open).
Commits on branch (ahead of main)
Source specs
This MR was created autonomously. Quality gates were enforced by the repo's own pre-commit hooks.
Summary by CodeRabbit
mail +triagehandling for public and shared mailboxes.