fix(email): allow move_to_label to restore inbox - #3267
Conversation
Request changesThe single-message fix is right and matches what the issue asked for: asking the email agent to put a message back in the inbox now actually leaves it there instead of silently archiving it again, and non-inbox moves are untouched. Two things to sort out before merge. The bulk version still has the original bug. The batch "move these messages to a label" tool always archives after labelling, so restoring three or more messages at once still adds the message to the inbox and takes it right back out — while reporting success. Since this PR advertises inbox restore in the tool description the model reads, the model will reach for the bulk tool the moment a user names more than a couple of messages, and land on exactly the silent no-op #2626 is about. Either apply the same guard there, or make the bulk tool refuse an inbox target and point at the single-message tool, and file the follow-up. Missing changelog entry. Comparable email-agent fixes (the label-resolution and archive-verification fixes) each added an entry to the agent package's changelog, and the project rule is that a behavior change lands in the package's docs in the same change. This is a user-visible behavior change to a shipped tool with no entry. Real-world evidenceN/A — no evidence bundle was produced for this run, so this verdict rests on static review plus reading the changed code and its tests. Worth noting the PR description shows unit tests and lint only, while the issue explicitly asked for a before/after label set on a real or fixture message demonstrating the restore. The change also edits a tool description the model sees, which the project treats as an LLM-affecting surface — prior email PRs either ran the agent eval or stated in the description why it wasn't warranted; this one does neither. A one-line note either way would close that out. 🔍 Technical detailsIssues🟡 Batch path still archives unconditionally (
If you'd rather keep the PR scoped to the single-message path, reject 🟡 No Precedent: #2428 (
Nits🟢 Use the existing 🟢 The new docstring is Gmail-only guidance ( Strengths
|
kovtcharov-amd
left a comment
There was a problem hiding this comment.
Blocking on the review above: the bulk move tool still has the original bug, so restoring three or more messages at once still adds them to the inbox and takes them straight back out while reporting success. Since this PR advertises inbox restore in the description the model reads, that's the path the model will take. The package changelog entry is also still missing.
Marking this formally so the PR stops reading as ready to merge — CI going green doesn't clear an open review request. Push the fix and re-request review.
|
Implemented the batch follow-up in commit
Validation:
The updated PR head is remotely verified and the new CI run is pending. |
|
Follow-up for the CI failure: commit 72e74aa adds the missing minimal OrganizeToolsMixin test host and preserves the tool registry around registration. The batch regression now reaches the real move_to_label_batch closure and asserts all three messages retain INBOX with zero archive calls. Validation:
The new GitHub Actions run is pending. |
|
🟡 The changelog entry for this fix landed in four places instead of one — the correct Remove the three copies from the released version blocks; keep only the one in 🔍 Technical details
Delete the duplicate blocks at lines 169–172, 452–455, and 838–841 (four-line block each: the bullet and its two continuation lines). Keep the entry at line 12. |
Closes #2626
Summary
INBOXon a message whenmove_to_labelis used to restore itValidation
python -m pytest hub/agents/email/python/tests/test_move_to_label_inbox_2626.py hub/agents/email/python/tests/test_label_resolution_2428.py -q— 11 passedpython -m black --check --target-version py311 hub/agents/email/python/gaia_agent_email/tools/organize_tools.py hub/agents/email/python/tests/test_move_to_label_inbox_2626.pypython -m isort --check-only hub/agents/email/python/gaia_agent_email/tools/organize_tools.py hub/agents/email/python/tests/test_move_to_label_inbox_2626.pygit diff --checkpython -m compileall -q hub/agents/email/python/gaia_agent_email/tools/organize_tools.py hub/agents/email/python/tests/test_move_to_label_inbox_2626.pyThe full-suite failures are the pre-existing scheduler timing test on this host, two source-read tests requiring UTF-8 under the Windows GBK locale, and the source-checkout package-metadata test for
gaia-agent-email.