Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA
TypeScript
{
"schema": "gstack-detector-corpus/v1",
"case": "plan-eng-multi-finding-batching",
"detector": "test/helpers/eng-seeded-coverage.ts#createEngBatchingIssueCounter",
"series_identity": "5553dbf327080983",
"source": {
"run": "37162480720",
"sha": "a818a991fb63699b6af142d5022d781fb418b2ef",
"lane": "periodic",
"artifact": "paid-slice-1-a1",
"path": "shards/skill-e2e-plan-eng-multi-finding-batching/pty-count/ci-37162480720-1-eval-slices-1/plan-eng-review-1791070951503-gDx2l5"
},
"census_outcome": "passed",
"expected": "pass",
"justification": "Census pass: three review-phase questions each bound to their own saved decision-ledger record (R IDs) in the plan; the counter credits each once.",
"input": {
"calls": [
{
"sessionId": "54bbb594-bd16-449c-b2ee-724def405c1b",
"toolUseId": "toolu_01AGyoSfTck7SrmtMJxU4Qzr",
"answeredAt": "2026-10-03T23:45:30.589Z",
"answer": "Library hooks + custom backoff function (recommended)",
"question": {
"question": "D1 — Retry mechanism: reuse the job library's retry hooks or build a custom inline scheduler?\nProject/branch/task: main, \"Add background job retry framework\" plan review; repo holds only PLAN.md, so this is judged on the plan text.\nELI10: The plan rebuilds retry scheduling inside every worker even though the job library already has retry hooks that do the same thing. The stated reason is wanting control over the backoff curve, but libraries in this class let you hand them your own backoff function, so you keep the curve and drop the rebuild. A custom scheduler also has to re-solve things the library already handles: remembering how many attempts happened, surviving a worker crash mid-wait, and showing up in the library's dashboards.\nStakes if we pick wrong: a hand-rolled scheduler means five places where attempt counting or delay math can drift, retries lost when a worker restarts, and a retry framework nobody else on the team recognizes. Picking the library when its hooks turn out to lack a needed feature costs a day of rework, which option C removes.\nRecommendation: A because the plan's only reason to leave the library (\"full control over the curve\") is met by a custom backoff function, so the rebuild buys nothing and costs persistence, observability and five maintenance sites.\nCompleteness: A=9/10, B=5/10, C=n/a (investigation only, approves nothing)\nPros / cons:\nA) Library hooks + custom backoff function (recommended)\n ✅ Attempt count, delay persistence and crash recovery stay library-owned; nothing to re-implement per worker\n ✅ The backoff curve is still fully yours: one function returns the delay for attempt N (human: ~1 day / CC: ~20 min)\n ✅ Finding 2 (five copy-pasted envelopes) disappears: the envelope is config, not worker code\n ❌ Depends on the library's hook API actually accepting a custom backoff function; not verified here because the library is not in this repo\nB) Custom inline scheduler per worker (as planned)\n ✅ Zero dependency on the library's hook surface; works even if its hooks are rigid\n ✅ Lets each worker tune its curve independently without touching queue config\n ❌ Each worker must own attempt tracking, timers and restart recovery; a crash mid-backoff silently drops the retry unless you also build persistence (human: ~3 days / CC: ~1 h)\n ❌ Keeps the five-copy duplication alive and puts the retry path outside the library's metrics and dashboards\nC) Investigate the hook API first, then decide\n ✅ Replaces the unverified assumption in A with a 5-minute read of the library's retry/backoff hook docs or source\n ✅ Costs almost nothing and makes the A/B call on evidence instead of plan text\n ❌ Defers the decision; nothing in this plan can be approved until the read-back is done\nNet: trade an unverified hook-API assumption (A) against a known rebuild of persistence, observability and five maintenance sites (B); C buys the evidence for a few minutes.",
"header": "Retry mechanism",
"multiSelect": false,
"options": [
{
"label": "Library hooks + custom backoff function (recommended)",
"description": "Reuse the job library's built-in retry hooks; supply one custom backoff function for the curve. Library owns attempt count, delay persistence and crash recovery. Makes the five-copy envelope duplication moot. Human ~1 day / CC ~20 min. Risk: assumes the hook API accepts a custom backoff function (unverified, library not in repo). Completeness 9/10."
},
{
"label": "Custom inline scheduler per worker (as planned)",
"description": "Build the exponential-backoff scheduler inline in each of ~5 workers as written in PLAN.md:7-9. Each worker owns attempt tracking, timers and restart recovery; retry path sits outside library metrics. Keeps the five copies pending a separate dedupe decision. Human ~3 days / CC ~1 h. Completeness 5/10."
},
{
"label": "Investigate the hook API first",
"description": "Bounded read of the library's retry/backoff hook API (docs or source, human ~1 h / CC ~5 min) before choosing. Approves nothing; R1 and every dependent row stay pending until the read-back is reported."
}
]
}
},
{
"sessionId": "54bbb594-bd16-449c-b2ee-724def405c1b",
"toolUseId": "toolu_01HvPRvQBD8KTcgtMQpwKVU1",
"answeredAt": "2026-10-03T23:46:55.937Z",
"answer": "At-least-once with idempotency key (recommended)",
"question": {
"question": "D2 — Webhook delivery: what guarantee do receivers get once `processWebhookJob()` can retry?\nProject/branch/task: main, \"Add background job retry framework\"; R1 settled on the library's retry hooks, now the webhook flow's semantics.\nELI10: Today a webhook is sent at most once: if it fails, it is gone, but a receiver never sees the same event twice. The moment you add retries, a request that timed out after reaching the receiver gets sent again, and the receiver sees a duplicate. You have to pick on purpose: embrace duplicates and give receivers a key to spot them, only retry when you are sure the request never left, or keep webhooks out of the retry framework entirely.\nStakes if we pick wrong: silently flipping to at-least-once means customers' systems double-charge, double-notify or double-create records with no way to detect it. Keeping at-most-once means the common failure (a 5xx or a slow receiver) still loses the event.\nRecommendation: A because at-least-once with a documented idempotency key is the standard webhook contract and the only option that both recovers lost deliveries and lets receivers protect themselves.\nCompleteness: A=9/10, B=6/10, C=4/10\nPros / cons:\nA) At-least-once with idempotency key (recommended)\n ✅ Recovers deliveries lost to 5xx and read timeouts, which is most of what a retry framework exists for\n ✅ Receivers get a stable key per event and a documented \"may deliver more than once\" contract they can dedupe on (human: ~1.5 days / CC: ~30 min)\n ❌ Changes the receiver-facing contract; any receiver that does not dedupe will see duplicates until they do\nB) Retry only pre-send failures\n ✅ Preserves the current at-most-once guarantee exactly; no receiver sees a duplicate\n ✅ Still recovers the cheap failures (connection refused, DNS, TLS handshake) with no contract change (human: ~1 day / CC: ~20 min)\n ❌ The most common failures (5xx, slow receiver) stay lost, and classifying \"provably never sent\" per HTTP client is brittle\nC) Exclude the webhook flow from retries\n ✅ Zero contract risk and almost zero work; the other four workers still get retries (human: ~0 / CC: ~2 min)\n ✅ Buys time to decide the webhook contract with receivers separately\n ❌ The webhook flow gets no reliability gain from this change, and the plan's rewrite of `processWebhookJob()` would need to be dropped\nNet: trade a documented contract change that receivers must honor (A) against preserving at-most-once at the cost of still losing the common failures (B, C).",
"header": "Webhook delivery",
"multiSelect": false,
"options": [
{
"label": "At-least-once with idempotency key (recommended)",
"description": "Webhook retries enabled through the library hooks; every delivery carries a stable idempotency key (job id + event id) header and each attempt is recorded (attempt number, response). Receiver-facing docs updated to \"at-least-once, dedupe on the key\". Human ~1.5 days / CC ~30 min. Completeness 9/10. R3 regression contract stays pending."
},
{
"label": "Retry only pre-send failures",
"description": "Retry only when the request provably never left (connection refused, DNS, TLS handshake failure); read timeouts and 5xx are terminal. Preserves at-most-once. Each attempt recorded. Human ~1 day / CC ~20 min. Completeness 6/10: 5xx and slow receivers still lose the event. R3 stays pending."
},
{
"label": "Exclude the webhook flow from retries",
"description": "Keep `processWebhookJob()` on its current no-retry path; the other four workers adopt the library hooks. No contract change, no reliability gain for webhooks. Human ~0 / CC ~2 min. Completeness 4/10. R3 stays pending."
}
]
}
},
{
"sessionId": "54bbb594-bd16-449c-b2ee-724def405c1b",
"toolUseId": "toolu_01H8or2ZvqSURzutGrFcrb2p",
"answeredAt": "2026-10-03T23:47:48.921Z",
"answer": "Full jitter (recommended)",
"question": {
"question": "D3 — Jitter: randomize retry delays, or keep the pure exponential curve?\nProject/branch/task: main, \"Add background job retry framework\"; the curve now lives in one custom backoff function supplied to the library hooks (D1).\nELI10: If a downstream service goes down for a minute, hundreds of jobs fail at the same moment. With a pure exponential curve they all wake up and retry at the same instants, hammering the service just as it recovers. Jitter adds randomness to each delay so the retries spread out instead of arriving as a wave.\nStakes if we pick wrong: without jitter the first retry wave after an outage can knock the dependency over again and extend the incident; with jitter the only cost is that a given retry may fire a little earlier or later than the textbook curve.\nRecommendation: A because full jitter is the documented safe default for background jobs, it is a one-line change inside the backoff function, and every real-world retry-storm bug found in research traced back to its absence.\nCompleteness: A=9/10, B=8/10, C=4/10\nPros / cons:\nA) Full jitter (recommended)\n ✅ Spreads retries across the whole window, the strongest protection against a lockstep wave after a shared outage\n ✅ One line inside the custom backoff function; no new state, no new dependency (human: ~1 h incl. test / CC: ~3 min)\n ❌ A retry can fire almost immediately after a failure (random lower bound is 0), which can look surprising in logs\nB) Equal jitter\n ✅ Guarantees a minimum wait of half the computed delay, so no retry fires \"too soon\"\n ✅ Still breaks up the lockstep wave, just over half the window (human: ~1 h incl. test / CC: ~3 min)\n ❌ Weaker spread than full jitter; only worth it if a hard minimum wait is a real requirement here, and none is stated\nC) No jitter (as planned)\n ✅ Delays are exactly predictable, which makes the curve easy to reason about and test\n ✅ Zero extra code beyond the curve itself\n ❌ Every job that failed in the same outage retries at the same instants; this is the classic retry-storm bug reported against real queue libraries\nNet: a few minutes of code (A or B) against a known outage amplifier (C); A unless a hard minimum wait is a stated requirement.",
"header": "Jitter",
"multiSelect": false,
"options": [
{
"label": "Full jitter (recommended)",
"description": "Custom backoff function returns random(0, base * 2^attempt). One line plus a test asserting delays stay within [0, computed]. Human ~1 h / CC ~3 min. Completeness 9/10. R6 cap, R7 max attempts/dead-letter stay pending."
},
{
"label": "Equal jitter",
"description": "Custom backoff function returns computed/2 + random(0, computed/2). Guaranteed minimum wait. One line plus a bounds test. Human ~1 h / CC ~3 min. Completeness 8/10. R6, R7 stay pending."
},
{
"label": "No jitter (as planned)",
"description": "Custom backoff function returns base * 2^attempt exactly. Lockstep retries after a shared outage are accepted. Human ~0 / CC ~0. Completeness 4/10. R6, R7 stay pending."
}
]
}
}
],
"planEvents": [
{
"at": "2026-10-03T23:45:08.602Z",
"write": "# Eng review: Add background job retry framework\n\nReview target (fixed): `PLAN.md` in `<fixture>` (branch `main`, commit c03143b), titled \"Plan: Add background job retry framework\".\nReport file: this file, at the path the user requested.\nReviewer: Claude (/plan-eng-review), session 689-1791070937-5a52bce9, 2026-10-03.\n\n## Original plan (unchanged copy of PLAN.md)\n\n```markdown\nProceed directly to the requested engineering review; skip the optional /office-hours prerequisite.\nPlease review this plan thoroughly. As you go, write your plan-mode plan to <fixture> (use Edit/Write to that exact path).\n\n# Plan: Add background job retry framework\n\n## Architecture\nWe'll roll a custom exponential-backoff scheduler inline in each worker\nrather than use the existing job library's built-in retry hooks. Same\nshape as the library version, but we want full control over the curve.\n\n## Code quality\nThe retry envelope (compute delay, log attempt, dispatch) is duplicated\nacross 5 worker files with copy-pasted bodies. We will leave the\nduplication for now and refactor \"later.\"\n\n## Tests\nThe existing `processWebhookJob()` flow gets rewritten as part of this\nchange. No regression test for the prior at-most-once delivery guarantee\nis planned.\n\n## Performance\nOn every retry we re-fetch the full job payload from the database, then\niterate the payload to recompute the dependency graph. Could cache the\ngraph on the first attempt; not planned.\n```\n\n## Review preparation record\n\n- Design doc: none found. /office-hours prerequisite skipped at the user's explicit request.\n- Repo evidence: the repository contains only `PLAN.md` and `CLAUDE.md`. No worker files, no `processWebhookJob()`, no job library config, no tests are checked in. Every code-level claim below is calibrated against the plan text only; runtime evidence is `unknown` throughout.\n- Retrospective history: `git log -- PLAN.md` shows one commit (c03143b \"Seed review plan\"); no reverts. Worker files and `processWebhookJob()` are named by the plan but have no path here: `not available`.\n- Test framework: unknown (no runtime markers, 0 test files).\n- TODOS.md: absent.\n- Prior learnings: cross-project learnings set to `false`; project-scoped search returned none.\n- Web research: Aside unavailable; one host WebSearch ran (read-only, untrusted). Takeaways: mainstream job libraries (BullMQ is the documented example) accept a custom backoff strategy function, so \"full control over the curve\" does not require leaving the library's retry hooks; pure exponential backoff without jitter produces lockstep retry storms during a provider outage (reported as real bugs in two queue projects); full or decorrelated jitter plus a delay cap and a dead-letter path are the baseline pattern.\n- Outside Voice: `codex_reviews` is `disabled`; the outside-voice step will be recorded as disabled, not replaced.\n\n## Scope Challenge\n\n### A. Assessment\n\n**What already solves each sub-problem?**\n- Retry scheduling, attempt counting, delay persistence: the plan itself says the existing job library has built-in retry hooks and that the custom scheduler is the \"same shape as the library version\" (PLAN.md:7-9). [Layer 1] reuse candidate. The library's hooks were not inspected (not in repo); label: plan-stated interface, unverified.\n- Backoff curve: libraries in this class take a custom backoff function. The plan's only stated reason to leave the library (\"full control over the curve\") is satisfiable inside the hooks. Assumption, not verified against the actual library.\n- Retry envelope (compute delay, log attempt, dispatch): if the library owns retries, the envelope ceases to exist in worker code. Otherwise it is one small helper, not five copies.\n\n**Minimum change to achieve the goal:** configure the library's retry hooks per queue (attempts, backoff function, jitter, cap, dead-letter), add attempt logging in one place, protect the webhook flow's delivery semantics with a test. The custom scheduler and the five copies are deferrable without blocking anything.\n\n**Complexity check (estimates, plan-stated):** ~5 worker files + the `processWebhookJob()` flow (likely one of the 5, counted once) = ~5-6 changed files; 0 new classes/services (scheduler is inline). Below the 8-file / 2-class gate, so B's selectors are skipped.\n\n**Search check:** done above (WebSearch). Recommendation labels: library hooks [Layer 1]; custom inline scheduler departs from standard practice without a stated reason the library cannot meet.\n\n**TODOS cross-reference:** no TODOS.md.\n\n**Completeness check:** the plan explicitly cuts three corners (duplication, regression test, graph recompute). Each saves CC minutes, not days. Completeness is cheap here.\n\n**Distribution check:** no new artifact; internal worker change only.\n\n### B. Complexity selectors\n\nSkipped: fewer than 8 files and fewer than 2 new classes/services.\n\n### C. Findings\n\n1. `[P1] (confidence: 8/10) PLAN.md:7-9 — Rebuilds retry scheduling the job library already provides (\"Same shape as the library version\"). Custom inline scheduler must re-own attempt persistence, delay timers, crash recovery and observability per worker. Reviewer: Claude.` Motivating lines: \"We'll roll a custom exponential-backoff scheduler inline in each worker / rather than use the existing job library's built-in retry hooks. Same / shape as the library version, but we want full control over the curve.\"\n2. `[P2] (confidence: 8/10) PLAN.md:12-14 — Retry envelope copy-pasted across 5 workers; a bug in delay math or attempt logging has to be fixed five times. Reviewer: Claude.` Motivating lines: \"The retry envelope (compute delay, log attempt, dispatch) is duplicated / across 5 worker files with copy-pasted bodies.\" Depends on finding 1: resolves itself if the library owns retries.\n\nFindings surfaced here but owned by later sections (not resolved in Scope Challenge): webhook at-most-once guarantee under retry (Architecture + Tests, PLAN.md:17-19); missing jitter / cap / max attempts / dead-letter (Architecture, PLAN.md:7-9); payload re-fetch and graph recompute per retry (Performance, PLAN.md:22-24).\n\nScope Challenge result: pending R1.\n\n## Decision ledger\n\n### R1: Retry mechanism — library built-in hooks vs custom inline scheduler\nFinding: Scope Challenge #1, P1, confidence 8/10, PLAN.md:7-9, reviewer Claude\nPlan baseline: original proposal — custom exponential-backoff scheduler inline in each of ~5 workers, bypassing the library's retry hooks (PLAN.md:7-9). Nothing approved yet.\nRuntime evidence: unknown. No worker source, library config or hook API is in the repo. The plan states the library has built-in retry hooks (plan-stated interface, unverified).\nComparison grid:\n\n| Choice | Current | A) Library hooks + custom backoff fn | B) Custom inline scheduler (as planned) | C) Investigate hook API first |\n|---|---|---|---|---|\n| R1 retry mechanism | custom inline scheduler per worker, proposed | library's retry hooks own scheduling, attempt count and persistence; one custom backoff function supplies the curve | custom scheduler inline in each worker, as written | pending; bounded read of the library's retry hook API (human ~1h / CC ~5 min), no implementation |\n| Backoff curve control (\"full control over the curve\") | required by plan | retained: the custom backoff function returns any delay | retained | pending |\n| Attempt state across worker crash/restart | unspecified | library-owned (plan-stated capability, unverified) | must be built per worker | pending |\n| R2 webhook delivery semantics under retry | unspecified, pending | pending | pending | pending |\n| R3 regression contract for at-most-once webhook flow | none planned, pending | pending | pending | pending |\n| R4 retry envelope deduplication (5 copies) | 5 copy-pasted bodies, pending | becomes moot: envelope lives in library config, not worker code | pending | pending |\n| R5 jitter | unspecified, pending | pending | pending | pending |\n| R6 delay cap / max attempts / dead-letter | unspecified, pending | pending | pending | pending |\n| R7 dependency-graph caching on retry | not planned, pending | pending | pending | pending |\n\nQuestion D1:\nD1 — Retry mechanism: reuse the job library's retry hooks or build a custom inline scheduler?\nProject/branch/task: main, \"Add background job retry framework\" plan review; repo holds only PLAN.md, so this is judged on the plan text.\nELI10: The plan rebuilds retry scheduling inside every worker even though the job library already has retry hooks that do the same thing. The stated reason is wanting control over the backoff curve, but libraries in this class let you hand them your own backoff function, so you keep the curve and drop the rebuild. A custom scheduler also has to re-solve things the library already handles: remembering how many attempts happened, surviving a worker crash mid-wait, and showing up in the library's dashboards.\nStakes if we pick wrong: a hand-rolled scheduler means five places where attempt counting or delay math can drift, retries lost when a worker restarts, and a retry framework nobody else on the team recognizes. Picking the library when its hooks turn out to lack a needed feature costs a day of rework, which option C removes.\nRecommendation: A because the plan's only reason to leave the library (\"full control over the curve\") is met by a custom backoff function, so the rebuild buys nothing and costs persistence, observability and five maintenance sites.\nCompleteness: A=9/10, B=5/10, C=n/a (investigation only, approves nothing)\nPros / cons:\nA) Library hooks + custom backoff function (recommended)\n ✅ Attempt count, delay persistence and crash recovery stay library-owned; nothing to re-implement per worker\n ✅ The backoff curve is still fully yours: one function returns the delay for attempt N (human: ~1 day / CC: ~20 min)\n ✅ Finding 2 (five copy-pasted envelopes) disappears: the envelope is config, not worker code\n ❌ Depends on the library's hook API actually accepting a custom backoff function; not verified here because the library is not in this repo\nB) Custom inline scheduler per worker (as planned)\n ✅ Zero dependency on the library's hook surface; works even if its hooks are rigid\n ✅ Lets each worker tune its curve independently without touching queue config\n ❌ Each worker must own attempt tracking, timers and restart recovery; a crash mid-backoff silently drops the retry unless you also build persistence (human: ~3 days / CC: ~1 h)\n ❌ Keeps the five-copy duplication alive and puts the retry path outside the library's metrics and dashboards\nC) Investigate the hook API first, then decide\n ✅ Replaces the unverified assumption in A with a 5-minute read of the library's retry/backoff hook docs or source\n ✅ Costs almost nothing and makes the A/B call on evidence instead of plan text\n ❌ Defers the decision; nothing in this plan can be approved until the read-back is done\nNet: trade an unverified hook-API assumption (A) against a known rebuild of persistence, observability and five maintenance sites (B); C buys the evidence for a few minutes.\nHeader: Retry mechanism\nOptions:\nA) Library hooks + custom backoff function (recommended)\nReuse the job library's built-in retry hooks; supply one custom backoff function for the curve. Library owns attempt count, delay persistence and crash recovery. Makes the five-copy envelope duplication moot. Human ~1 day / CC ~20 min. Risk: assumes the hook API accepts a custom backoff function (unverified, library not in repo). Completeness 9/10.\nB) Custom inline scheduler per worker (as planned)\nBuild the exponential-backoff scheduler inline in each of ~5 workers as written in PLAN.md:7-9. Each worker owns attempt tracking, timers and restart recovery; retry path sits outside library metrics. Keeps the five copies pending a separate dedupe decision. Human ~3 days / CC ~1 h. Completeness 5/10.\nC) Investigate the hook API first\nBounded read of the library's retry/backoff hook API (docs or source, human ~1 h / CC ~5 min) before choosing. Approves nothing; R1 and every dependent row stay pending until the read-back is reported.\n\nState: pending\nActual answer: unanswered\nAccepted scope: none\nHistory: none\n"
},
{
"at": "2026-10-03T23:46:32.676Z",
"old": "State: pending\nActual answer: unanswered\nAccepted scope: none\nHistory: none\n",
"new": "State: approved\nActual answer: A) Library hooks + custom backoff function — D1 answer, 2026-10-03\nAccepted scope: Replace the custom inline per-worker scheduler (PLAN.md:7-9) with the job library's built-in retry hooks; supply one custom backoff function for the curve; library owns attempt count, delay persistence and crash recovery. R4 (five-copy envelope dedupe) is moot under this answer: the envelope becomes queue/hook configuration, not worker code. Carried pending: R2, R3, R5, R6, R7 and later rows. Assumption to confirm at implementation: the library's hook API accepts a custom backoff function.\nHistory: none\n\n### R2: Webhook delivery semantics once `processWebhookJob()` gains retries\nFinding: Architecture #1, P1, confidence 8/10, PLAN.md:17-19, reviewer Claude. Motivating lines: \"The existing `processWebhookJob()` flow gets rewritten as part of this / change. No regression test for the prior at-most-once delivery guarantee / is planned.\"\nPlan baseline: original proposal — the webhook flow is rewritten into the retry framework; its current at-most-once guarantee is named but no decision is made about what replaces it. R1 approved (library hooks) governs the mechanism; semantics still unspecified.\nRuntime evidence: unknown. `processWebhookJob()` is not in the repo; whether it records a send before the HTTP call, or what receivers rely on, cannot be checked here.\nComparison grid:\n\n| Choice | Current | A) At-least-once with idempotency key | B) Retry only pre-send failures | C) Exclude webhook flow from retries |\n|---|---|---|---|---|\n| R2 delivery guarantee receivers get | at-most-once (plan-stated), under rewrite with no replacement guarantee named | at-least-once; each delivery carries a stable idempotency key (job id + event id) so receivers can dedupe | at-most-once preserved: retry only when the request provably never left (connection refused, DNS, TLS handshake); post-send ambiguity (read timeout, 5xx) is terminal | at-most-once preserved by keeping `processWebhookJob()` on the current no-retry path |\n| Duplicate deliveries to receivers | none today | possible; deduplicable via key | none | none |\n| Lost deliveries on 5xx / read timeout | lost (no retry today) | retried | still lost | still lost |\n| Receiver-facing contract change | none | yes: documented key header + \"may deliver more than once\" | none | none |\n| Per-attempt delivery record (attempt no., response) | unspecified | yes, part of this behavior | yes, part of this behavior | no change |\n| R1 mechanism | approved D1 | library hooks, unchanged | library hooks, unchanged | library hooks for the other 4 workers, unchanged |\n| R3 regression contract for the webhook flow | pending | pending | pending | pending |\n| R5 jitter, R6 delay cap, R7 max attempts/dead-letter, R8 graph caching | pending | pending | pending | pending |\n\nQuestion D2:\nD2 — Webhook delivery: what guarantee do receivers get once `processWebhookJob()` can retry?\nProject/branch/task: main, \"Add background job retry framework\"; R1 settled on the library's retry hooks, now the webhook flow's semantics.\nELI10: Today a webhook is sent at most once: if it fails, it is gone, but a receiver never sees the same event twice. The moment you add retries, a request that timed out after reaching the receiver gets sent again, and the receiver sees a duplicate. You have to pick on purpose: embrace duplicates and give receivers a key to spot them, only retry when you are sure the request never left, or keep webhooks out of the retry framework entirely.\nStakes if we pick wrong: silently flipping to at-least-once means customers' systems double-charge, double-notify or double-create records with no way to detect it. Keeping at-most-once means the common failure (a 5xx or a slow receiver) still loses the event.\nRecommendation: A because at-least-once with a documented idempotency key is the standard webhook contract and the only option that both recovers lost deliveries and lets receivers protect themselves.\nCompleteness: A=9/10, B=6/10, C=4/10\nPros / cons:\nA) At-least-once with idempotency key (recommended)\n ✅ Recovers deliveries lost to 5xx and read timeouts, which is most of what a retry framework exists for\n ✅ Receivers get a stable key per event and a documented \"may deliver more than once\" contract they can dedupe on (human: ~1.5 days / CC: ~30 min)\n ❌ Changes the receiver-facing contract; any receiver that does not dedupe will see duplicates until they do\nB) Retry only pre-send failures\n ✅ Preserves the current at-most-once guarantee exactly; no receiver sees a duplicate\n ✅ Still recovers the cheap failures (connection refused, DNS, TLS handshake) with no contract change (human: ~1 day / CC: ~20 min)\n ❌ The most common failures (5xx, slow receiver) stay lost, and classifying \"provably never sent\" per HTTP client is brittle\nC) Exclude the webhook flow from retries\n ✅ Zero contract risk and almost zero work; the other four workers still get retries (human: ~0 / CC: ~2 min)\n ✅ Buys time to decide the webhook contract with receivers separately\n ❌ The webhook flow gets no reliability gain from this change, and the plan's rewrite of `processWebhookJob()` would need to be dropped\nNet: trade a documented contract change that receivers must honor (A) against preserving at-most-once at the cost of still losing the common failures (B, C).\nHeader: Webhook delivery\nOptions:\nA) At-least-once with idempotency key (recommended)\nWebhook retries enabled through the library hooks; every delivery carries a stable idempotency key (job id + event id) header and each attempt is recorded (attempt number, response). Receiver-facing docs updated to \"at-least-once, dedupe on the key\". Human ~1.5 days / CC ~30 min. Completeness 9/10. R3 regression contract stays pending.\nB) Retry only pre-send failures\nRetry only when the request provably never left (connection refused, DNS, TLS handshake failure); read timeouts and 5xx are terminal. Preserves at-most-once. Each attempt recorded. Human ~1 day / CC ~20 min. Completeness 6/10: 5xx and slow receivers still lose the event. R3 stays pending.\nC) Exclude the webhook flow from retries\nKeep `processWebhookJob()` on its current no-retry path; the other four workers adopt the library hooks. No contract change, no reliability gain for webhooks. Human ~0 / CC ~2 min. Completeness 4/10. R3 stays pending.\n\nState: pending\nActual answer: unanswered\nAccepted scope: none\nHistory: none\n"
},
{
"at": "2026-10-03T23:47:31.675Z",
"old": "Keep `processWebhookJob()` on its current no-retry path; the other four workers adopt the library hooks. No contract change, no reliability gain for webhooks. Human ~0 / CC ~2 min. Completeness 4/10. R3 stays pending.\n\nState: pending\nActual answer: unanswered\nAccepted scope: none\nHistory: none\n",
"new": "Keep `processWebhookJob()` on its current no-retry path; the other four workers adopt the library hooks. No contract change, no reliability gain for webhooks. Human ~0 / CC ~2 min. Completeness 4/10. R3 stays pending.\n\nState: approved\nActual answer: A) At-least-once with idempotency key — D2 answer, 2026-10-03\nAccepted scope: `processWebhookJob()` retries through the library hooks (R1). Every delivery carries a stable idempotency key (job id + event id) header; each attempt is recorded (attempt number, response). Receiver-facing documentation updated to \"at-least-once, dedupe on the key\". Intentional difference from today: at-most-once is replaced by at-least-once. Carried pending: R3 (regression contract for the webhook flow), R5, R6, R7, R8.\nHistory: none\n\n### R5: Jitter on retry delays\nFinding: Architecture #2, P2, confidence 8/10, PLAN.md:7-9, reviewer Claude. Motivating lines: \"We'll roll a custom exponential-backoff scheduler ... we want full control over the curve.\" No jitter is mentioned anywhere in the plan.\nPlan baseline: original proposal — pure exponential curve, jitter unspecified. R1 approved: the curve is supplied by one custom backoff function in the library hooks.\nRuntime evidence: unknown (no backoff code in repo). Web research: two queue projects filed real bugs for lockstep retries after a provider outage because their exponential backoff had no jitter.\nComparison grid:\n\n| Choice | Current | A) Full jitter | B) Equal jitter | C) No jitter |\n|---|---|---|---|---|\n| R5 jitter | unspecified, pending | delay = random(0, base * 2^attempt) | delay = half fixed + half random of base * 2^attempt | delay = base * 2^attempt exactly, as planned |\n| Lockstep retry storm after a shared outage | unmitigated | spread across the full window | spread across half the window, guaranteed minimum wait | all failed jobs retry at the same instants |\n| Where it lives | n/a | inside the one custom backoff function (R1) | inside the one custom backoff function (R1) | inside the one custom backoff function (R1) |\n| R1 mechanism, R2 webhook semantics | approved D1, D2 | unchanged | unchanged | unchanged |\n| R3 regression contract, R6 delay cap, R7 max attempts/dead-letter, R8 graph caching | pending | pending | pending | pending |\n\nQuestion D3:\nD3 — Jitter: randomize retry delays, or keep the pure exponential curve?\nProject/branch/task: main, \"Add background job retry framework\"; the curve now lives in one custom backoff function supplied to the library hooks (D1).\nELI10: If a downstream service goes down for a minute, hundreds of jobs fail at the same moment. With a pure exponential curve they all wake up and retry at the same instants, hammering the service just as it recovers. Jitter adds randomness to each delay so the retries spread out instead of arriving as a wave.\nStakes if we pick wrong: without jitter the first retry wave after an outage can knock the dependency over again and extend the incident; with jitter the only cost is that a given retry may fire a little earlier or later than the textbook curve.\nRecommendation: A because full jitter is the documented safe default for background jobs, it is a one-line change inside the backoff function, and every real-world retry-storm bug found in research traced back to its absence.\nCompleteness: A=9/10, B=8/10, C=4/10\nPros / cons:\nA) Full jitter (recommended)\n ✅ Spreads retries across the whole window, the strongest protection against a lockstep wave after a shared outage\n ✅ One line inside the custom backoff function; no new state, no new dependency (human: ~1 h incl. test / CC: ~3 min)\n ❌ A retry can fire almost immediately after a failure (random lower bound is 0), which can look surprising in logs\nB) Equal jitter\n ✅ Guarantees a minimum wait of half the computed delay, so no retry fires \"too soon\"\n ✅ Still breaks up the lockstep wave, just over half the window (human: ~1 h incl. test / CC: ~3 min)\n ❌ Weaker spread than full jitter; only worth it if a hard minimum wait is a real requirement here, and none is stated\nC) No jitter (as planned)\n ✅ Delays are exactly predictable, which makes the curve easy to reason about and test\n ✅ Zero extra code beyond the curve itself\n ❌ Every job that failed in the same outage retries at the same instants; this is the classic retry-storm bug reported against real queue libraries\nNet: a few minutes of code (A or B) against a known outage amplifier (C); A unless a hard minimum wait is a stated requirement.\nHeader: Jitter\nOptions:\nA) Full jitter (recommended)\nCustom backoff function returns random(0, base * 2^attempt). One line plus a test asserting delays stay within [0, computed]. Human ~1 h / CC ~3 min. Completeness 9/10. R6 cap, R7 max attempts/dead-letter stay pending.\nB) Equal jitter\nCustom backoff function returns computed/2 + random(0, computed/2). Guaranteed minimum wait. One line plus a bounds test. Human ~1 h / CC ~3 min. Completeness 8/10. R6, R7 stay pending.\nC) No jitter (as planned)\nCustom backoff function returns base * 2^attempt exactly. Lockstep retries after a shared outage are accepted. Human ~0 / CC ~0. Completeness 4/10. R6, R7 stay pending.\n\nState: pending\nActual answer: unanswered\nAccepted scope: none\nHistory: none\n"
}
]
}
}