Skip to content

fix(mail): include sent replies in application conversations - #4609

Merged
strelov1 merged 2 commits into
mainfrom
fix/mail-sent-context
Nov 14, 2026
Merged

strelov1 merged 2 commits into
mainfrom
fix/mail-sent-context

Conversation

@strelov1

@strelov1 strelov1 commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Sent replies imported by Gmail sync have no employer classification or persisted application link, so they were missing from application mail even after the incoming message was linked. Include unattached replies through an unambiguous same-user Gmail conversation at read time, preserving explicit links and rejecting conflicting or orphaned application contexts.

Exclude outgoing messages from employer-recall selection and suggestion writes, including a recall racing with sent-alias repair. Follow-up drafts now take their recipient from the newest incoming message rather than the candidate's newer sent reply.

Follow-up to #4604 and its CodeRabbit findings. No attachment or employer-activity records are rewritten. Existing OpenSpec files are retained and document the safeguards.

Validation: red-to-green real PostgreSQL regressions for late linking, ambiguity, orphan context, explicit overrides, deletion and tenant/source boundaries; public follow-up recipient regression; all 312 Go unit packages, both vet modes, independent review and normal hooks. Code is identical to the tested repair after the documentation-only commit. All 312 integration-tagged packages passed (API separately on private PostgreSQL); all protected checks passed.


Note

Medium Risk
Read-time SQL inference on ListJobEmails affects application mail and follow-up behavior; safeguards and tests cover ambiguity and employer-path isolation, but query complexity adds regression surface.

Overview
Application mail views now surface unlinked Gmail sent replies when the same user, source, and thread have exactly one linked incoming job—read-time display only, with explicit manual/agent links winning and no persisted link or employer activity.

Recall (ListEmailsForRecall, SuggestJobForEmail) and follow-up drafts (newestSender) are tightened to incoming-only so candidate mail and alias repair during recall cannot drive employer suggestions or draft recipients.

Reviewed by Cursor Bugbot for commit 68f407c. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Nov 14, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@strelov1

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T15:33:34.751152Z 68f407c Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 68f407c9c6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@strelov1
strelov1 marked this pull request as ready for review November 14, 2026 15:31
@strelov1
strelov1 merged commit 2f88f7c into main Nov 14, 2026
46 of 47 checks passed
@strelov1
strelov1 deleted the fix/mail-sent-context branch November 14, 2026 15:31
@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 22c62b44-9701-4f85-b44f-13a75ddcecd5)

strelov1 added a commit that referenced this pull request Nov 14, 2026
#4609 only extended the sent-mail sync that #4604 added, so it goes out
with it. A unit test covers the restored Gmail message pagination.
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