Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🤖 CI report
|
There was a problem hiding this comment.
PostHog Review · Standard · reviewed 58c9220: 1 Should fix.
This is the only automatic review while this pull request is a draft. Comment @posthog review to review new changes sooner. Otherwise, a review of the new changes runs when you mark it ready for review.
See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.
…x-split/tenant-state-mirror # Conflicts: # products/workflows/backend/migrations/max_migration.txt
…x-split/tenant-state-mirror Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…x-split/tenant-state-mirror Master took workflows migration 0042 (push token imports), so the tenant state migration moves to 0043 and follows it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…x-split/tenant-state-mirror
…x-split/tenant-state-mirror
…x-split/tenant-state-mirror
…x-split/tenant-state-mirror Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…x-split/tenant-state-mirror Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New commits were pushed — dismissing the stamphog approval from an earlier head. Re-add the trigger label to request a fresh review.
There was a problem hiding this comment.
PostHog Review · Standard · reviewed 45f5f67: 1 Should fix.
This is review round 3 on this pull request. When findings keep coming back in the same code, the approach is usually the problem. Before the next fix, check whether a different design would remove the whole class of findings.
…x-split/tenant-state-mirror # Conflicts: # docs/internal/workflows-email-sending-tiers.md
…ox tenant sync Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…x-split/tenant-state-mirror
…x-split/tenant-state-mirror
There was a problem hiding this comment.
Not approved — this change needs a human reviewer.
Re-add the stamphog label to request another review once you have addressed this.
Owning-team authorship provides assurance for the risky workflow changes, but @PostHog's substantive concern about uncounted initial database failures remains unfixed. Address that comment in products/workflows/backend/services/ses_tenant_state.py and test the initial lookup failure before re-requesting.
- @PostHog on products/workflows/backend/services/ses_tenant_state.py: the initial get_or_create at line 118 remains outside both counted exception handlers, so a database failure there does not increment the sync failure counter. The database-error test only mocks the subsequent lock query. Include the initial lookup in the counted error path and add a regression test before re-requesting.
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 283L, 9F substantive, 556L/13F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1d-complex (556L, 13F, cross-cutting, feat) |
| stamphog 2.7.0 | .stamphog/policy.yml @ 62c7c2c · reviewed head 62c7c2c |
The sync created the state row before the counted lock handler, so a database failure there raised without a sync failure metric. Run it inside the same handler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Creating the row inside the lock transaction left the insert uncommitted for the whole SES read, so an overlapping first sync waited on it rather than failing at once with NOWAIT. The row now commits first, and a failed create is still counted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…x-split/tenant-state-mirror
…x-split/tenant-state-mirror Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New commits were pushed — dismissing the stamphog approval from an earlier head. Re-add the trigger label to request a fresh review.
Problem
Merge danger
Warning
🟡 Merge risk: medium · two-way door (merge-risk rubric)
SES_SANDBOX_TENANT_NAMEis empty.git revertthe merge commit. The empty table can stay.Changes
SandboxSenderTenantState, from the SES tenant-state webhook and the daily sweep.reload-sandbox-sender-stateafter commit. Project admins get no email.workflows_sandbox_tenant_sync_failures_total, undermissing,busy,transientorerror. It does not stop the team sweep.NotFoundExceptionreads as a missing sandbox tenant. A rejected read keeps a stored pause. The team tenant read keeps master's handling.NOWAIT. A held lock counts asbusyand its task retries. Any other database error, including a failed create of the row, counts aserror.How did you test this code?
Test rationale:
test_ses_tenant_state.pyandtest_ses_tenant_events.pycatch a pause that is lost, stored without an announcement, or kept after the tenant is gone. They also cover each failure label in the sweep, and a held row lock.NOWAITunder a real second lock holder, because that needs two committed transactions.Earlier local run, at ad87342 (not saved as proof)
A local SESv2 stub answered the tenant reads, with eager Celery and a Redis subscriber on the reload channel. This run predates the
missinglabel and thebusyanderrorsplit.ENABLEDDISABLEDDISABLEDDISABLEDDISABLED, kepttransient2,error1ENABLEDPubSubsaw no subscriber onreload-sandbox-sender-stateand kept running. The worker side ships in #129056.CI report findings
0043creates one new table,workflows_sandboxsendertenantstate, with no rows and no reader before this PR; the risk check rates it Safe.Release status
Docs update
docs/internal/workflows-email-sending-tiers.mddescribes the mirror, the failure labels and the alert prerequisite.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Agent: Claude Code, Claude Opus 5.5
Skills:
/django-migrations,/writing-tests,/writing-code-comments,/stacking-prs,/writing-pr-descriptions,/qa-swarmDecisions for the whole sandbox sender stack
sandbox, created only by PostHog codeWORKFLOWS_SANDBOX_SENDER_ENABLED, no feature flag in CDP Node codeNo open questions.
More context for AI agents
TenantSendingState.missinglabel, limitedbusytoLockNotAvailable, and built the sweep's provider inside the countedtry(ff05e1e, ce9dc8a). Final reads counted a failed create of the row (49b6f2d) and kept that create outside the lock transaction (f5a9b48).sync_sandbox_tenant_stateinses_tenant_state.py, andproviders/ses.py.🤖 Generated with Claude Code