Repository navigation
fix(cdp): keep the idempotency key of a rescheduled send - #134438
Conversation
A send accepted to go out now kept its idempotency key for 24 hours, but a reschedule can move it up to 30 days from creation before a worker claims it. A retry of the first request after a day then queued a second send while the first one still waited. Every keyed send now keeps its key until a day after the latest time a reschedule can move it to, as its files already are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… send Keeping every keyed send's key for 31 days would break the documented contract that a retry after 24 hours sends again. A send now records its key's hash in the job state, and a reschedule extends that key, while it still holds the send, until a day after the latest time the send can be moved to. Sends that are never moved keep the 24-hour window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
😎 Merged successfully - details. |
🤖 CI report✅ Trunk lane — non-backend laneThis PR is assigned to the non-backend lane. It does not run backend Python tests and may merge in parallel with PRs in other lanes. ✅ Duplication (Python) — cleanNew Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying. ✅ Duplication (TypeScript) — cleanNew TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying. |
There was a problem hiding this comment.
PostHog Review · Standard · reviewed 2ef1e68: 1 Should fix.
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.
A completion that waited for the key store, or whose answer was lost, rewrote the key with its original 24-hour TTL after a reschedule had lengthened it. The completion now keeps the longer TTL, and a reschedule also lengthens a key whose completion is still pending. Adds tests for the window's upper bound and for a reschedule while the key store is down. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Lengthening a pending reservation kept it pending for weeks when the process that should complete it died, so retries got in-flight instead of a replay. Accept now stores the key's queued record in job state, and a reschedule writes that record with the longer window, so the key replays whether its completion landed, is late, or was lost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…schedule Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…se docstring Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note 🤖 Claude Opus 5.5 responding on behalf of Michael
|
|
Risk: No findings This delta adds a 'triggered' app metric and a non-awaited metrics flush to the hogflow scheduled-invocation handler, plus tests. All metric fields are server-derived and team-scoped, and the flush swallows its own produce errors, so the change introduces no new attacker-reachable surface. Sentinel reviewed |
|
✅ Security review complete — 2 findings posted as a review, in 8 min. Add the |
The record's request fingerprint is an unkeyed hash of the variables, so a lifecycle snapshot that strips a sensitive message's variables must strip it too. 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.
A 200 told the caller the move was safe while the key kept its shorter window, so a later retry of the send could queue a duplicate. The move stays committed, and a retry of the reschedule writes the key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
PostHog Review · Standard · reviewed f233f1c: 2 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.
… send's key Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
PostHog Review · Standard · reviewed 966842c: 1 Should fix.
This is review round 4 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.
…t a key write Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
PostHog Review · Standard · reviewed 845623b: 1 Must fix, 1 Should fix.
This is review round 5 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.
|
✅ Security review complete — 1 finding posted as a review, in 7 min. Add the |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Approved.
The risky changes have a clean current-head agent review, owning-team authorship, and STRONG familiarity. No concrete unresolved substantive concerns or policy refusal grounds are present in the supplied context and checked code.
- Author wrote 81% of the modified lines and has 32 merged PRs in these paths (familiarity STRONG).
- PostHog Review (Standard) reviewed the current head: no findings.
- posthog[bot] reviewed the current head.
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 97L, 3F substantive, 380L/5F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1d-complex (380L, 5F, single-area, fix) |
| stamphog 2.8.0 | .stamphog/policy.yml @ 0ce5910 · reviewed head 0ce5910 |
|
/trunk merge |
Deploy status
This table shows the |
Problem
Note
🟢 Merge risk: low · two-way door
Changes
How did you test this code?
Test rationale: the serial test ages real Valkey TTLs and retries over HTTP, with rows on both sides of the window. Unit rows fail a completion that waits, loses its answer, or dies with its process, with or without its hold expiring. Fault rows fail the store, or leave it unconfigured, during the reschedule.
Decisions
Release status
Docs update
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Agent: Claude Code, Claude Opus 5.5
Skills:
/writing-tests,/writing-pr-descriptionsSecurity review: not needed
More context for AI agents
MARK_QUEUED_SCRIPTandreplayUntilDayAfterinidempotency-keys.ts, andScheduledTransactionalSends.reschedule.🤖 Generated with Claude Code