Skip to content

fix(mailer): enforce Max access and preserve inbox resources on failure - #7950

Merged
icecrasher321 merged 3 commits into
stagingfrom
codex/fix-sim-mailer-entitlement
Sep 17, 2026
Merged

icecrasher321 merged 3 commits into
stagingfrom
codex/fix-sim-mailer-entitlement

Conversation

@icecrasher321

@icecrasher321 icecrasher321 commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Enforce hosted Sim Mailer eligibility using the workspace payer, including Max for Teams, and preserve inboxes when billing lookups fail during cleanup.
  • Show enable, disable, and secret-access errors in settings without exposing raw provider responses.
  • Provision replacement addresses before switching configuration. Commit inbox and webhook changes atomically, retain resource cleanup in the outbox, and prevent retries from deleting reused addresses or activating resources whose cleanup started.
  • Keep the current per-workspace webhook model; provider capacity limits still apply.

Type of Change

  • Bug fix

Testing

  • 182 focused tests passed, including eligibility, settings errors, concurrent configuration changes, provider failures, and asynchronous deletion retries.
  • App type-check, repository lint, all 46 repository audits, block-registry audit, and docs-manifest check passed.
  • No database migration required. Deploy the updated outbox worker before the app so the new cleanup handler is available.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 17, 2026 11:16pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no new actionable failure remains in the changes since the previous review.

Summary

This PR tightens hosted Sim Mailer eligibility, makes inbox replacement and cleanup failure-safe, and surfaces sanitized settings errors.

  • Uses the workspace payer’s Max or enterprise entitlement while preserving resources when retention checks are uncertain.
  • Provisions replacement resources before atomically switching configuration.
  • Moves provider cleanup into the durable outbox with reuse, cancellation, and asynchronous-deletion safeguards.
  • Expedites rollback cleanup after failed activation while retaining the queued fallback.
  • Adds focused coverage for entitlement, provider responses, lifecycle races, cleanup retries, and settings errors.
Diagram
sequenceDiagram
  participant U as Settings request
  participant L as Inbox lifecycle
  participant A as AgentMail
  participant DB as Database
  participant O as Cleanup outbox

  U->>L: Enable or replace inbox
  L->>A: Create inbox
  L->>A: Create webhook
  L->>O: Queue delayed rollback
  L->>DB: Begin activation transaction
  L->>DB: Lock and verify current configuration
  L->>O: Cancel rollback in transaction
  L->>DB: Atomically install inbox and webhook

  alt Transaction commits
    DB-->>L: Activated
    L->>O: Queue old-resource cleanup
  else Transaction fails
    DB-->>L: Roll back rollback cancellation
    L->>O: Expedite queued rollback
    O->>A: Delete newly provisioned resources
  end
Loading

Reviews (3) · Last reviewed commit: "fix(mailer): expedite rollback after act..."

Comment thread apps/sim/lib/mothership/inbox/cleanup-outbox.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 13 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/mothership/inbox/cleanup-outbox.ts Outdated
Comment thread apps/sim/lib/mothership/inbox/agentmail-client.ts Outdated
Comment thread apps/sim/lib/mothership/inbox/lifecycle.ts Outdated
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 14 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/mothership/inbox/lifecycle.ts
@icecrasher321
icecrasher321 force-pushed the codex/fix-sim-mailer-entitlement branch from ad4ad43 to 2f0762d Compare September 17, 2026 23:16
@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@icecrasher321 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 14 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@icecrasher321
icecrasher321 merged commit bfb7ff3 into staging Sep 17, 2026
35 checks passed
@icecrasher321
icecrasher321 deleted the codex/fix-sim-mailer-entitlement branch September 17, 2026 23:27

This branch was previously deployed

1 inactive deployment
Preview 2f0762da Deployed Sep 17, 2026 by vercel[bot]
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