Agents Builders

Hermetic test env for bin/agent-worktree test (fix worktree mailer failures)

Archived
task-383fbd0a1f65

Created

Jun 20, 22:13

Started

Jun 20, 23:20

Completed

Jun 21, 00:25

DevOps handoff

Type

Chore

Shape

backend

Worktree Slug

deflake-mailer-tests

Repositories

mcritchie-studio

Release Train

Branch

feat/deflake-mailer-tests

Local URL

QA URL

Production URL

tests

Acceptance Criteria

  • The full suite is green under single-process (PARALLEL_WORKERS=1) across seeds; ~6 order-dependent failures that parallel isolation/CI-sharding currently mask are fixed (bisect with --seed; remove shared/leaked state).

Expected Test Plan

  • [unit] the identified order-dependent test(s) pass in isolation AND in a seeded full single-process run

Checks Run

  • [manual] root cause = bin/agent-worktree test inherited the worktree stack env (APP_PORT → mailer URLs, LOCAL_EMAIL_CAPTURE → delivery flow); fix = minimal hermetic test env. Full suite green across previously-failing seeds 45758 + 7: 801 runs / 0 failures / 0 errors.

Stage Timeline

Who handled each stage, the time it took (measured), and the model / tokens / cost reported (best-effort) — plus who's on it right now. means the agent didn't report that metric.

No stage changes recorded yet.

Conversation

QA review feedback, agent handoffs, and follow-up notes for this task.

Comment 6 days ago

Cluster identified: under single-process (bin/agent-worktree test full suite) these 6 fail deterministically — MagicLinksControllerTest, StudioEmailDeliveryTest (x2), BroadcastMailerTest (x2), RegistrationsControllerTest. All email/mailer: leaked ActionMailer state (deliveries / default_url_options host) across tests that parallel isolation masks. Fix: reset mailer state in teardown / scope url host per-test.

Comment 6 days ago

Review ✅ (Avi, independent) → reviewed. Verified the diagnosis (env leak, not ordering — fails in isolation), the minimal env (test DATABASE_URL correct, dotenv non-overwriting), and that scope is complete (.env.agent-stack was only reaching tests via the subcommand's hand-injected env). Folded nit: Redis-isolation note. Title corrected (was 'De-flake order-dependent tests').

Sealed-bid sizing

Edit →

Alex (PM)

Avi (PO)

Dev

Actual