Skip to content

test(platform): Backend integration stops before its lanes when a legacy proof's DROP DATABASE outlasts its 8 s statement timeout #5133

Closed

Description

@yannickmonney

Problem

Since 2026-10-29 18:00 UTC the Backend integration job (checks.yml) started its suite 21 times and passed once (the merge train's #5128, third attempt). In 14 of the 20 failures the run never reached its lanes:

FAIL  harness: the run reaches its lanes — RUN TRUNCATED before the lanes: PostgresError: canceling statement due to statement timeout

(once as AggregateError: legacy agent proof or owned database cleanup failed). A truncation ends the run before any of the 287 lanes, so it hides every other check, and it is the most common reason the required CI ready (Checks) is red on main, on pull requests and on the merge train's pull request. It struck the merge queue, pull requests and pushes to main alike.

Cause

The two boot-cutover proofs that run before the lanes, checkLegacyAutomationProtocol (services/platform/backend/domains/automations/legacy-protocol.integration.ts) and checkLegacyAgentFlow (legacy-agent-flow.integration.ts), each create a disposable database on an admin connection opened with -c statement_timeout=8000 -c lock_timeout=8000 and drop it on the same connection when they finish. The PostgreSQL log the job prints after the run names the statement the timeout cancelled:

  • in 12 runs, DROP DATABASE "itest_legacy_<id>", the protocol proof's cleanup (legacy-protocol.integration.ts:838), after every check of that proof had passed. The harness's FAIL line comes exactly 8.0 s after the proof's last check, organization legacy-hold preflight returns a tenant-scoped conflict [ORG-R12];
  • in 1 run, the agent-flow proof's DROP DATABASE "itest_legacy_agent_<id>" (legacy-agent-flow.integration.ts:435), 8.0 s after its last check;
  • in 1 run, a statement of migration 0007 that the protocol proof applies to its fresh database, 42 s into the proof, then that proof's DROP DATABASE as well.

DROP DATABASE waits for an immediate checkpoint (PostgreSQL 16, dropdb() in src/backend/commands/dbcommands.c), so it lasts as long as writing out every dirty buffer of the server. After the protocol proof's writes, on the shared self-hosted runners where other jobs load the same disks, that regularly takes more than 8 s. The 8 s budget is right for the statements the proofs test, where a timeout means a hang in the code under test. It does not fit the fixture's own setup and cleanup.

Started (UTC) Run / job Source Statement the timeout cancelled
10-29 18:11 40927763639 attempt 1 merge queue, pr-5094 DROP DATABASE "itest_legacy_…"
10-29 18:19 40927501582 attempt 1 merge queue, pr-5089 DROP DATABASE "itest_legacy_…"
10-29 18:20 40928478962 attempt 1 merge queue, pr-5087 DROP DATABASE "itest_legacy_…"
10-29 18:20 40928488577 attempt 1 merge queue, pr-5091 DROP DATABASE "itest_legacy_…"
10-29 18:21 40928485343 attempt 1 merge queue, pr-5076 DROP DATABASE "itest_legacy_…"
10-29 18:29 40928488626 attempt 1 merge queue, pr-5090 migration 0007 (protocol proof database); DROP DATABASE "itest_legacy_…"
10-29 18:30 40928481772 attempt 1 merge queue, pr-5080 DROP DATABASE "itest_legacy_…"
10-29 18:54 40933624556 attempt 1 merge queue, pr-5076 DROP DATABASE "itest_legacy_…"
10-29 19:10 40936935140 attempt 1 merge queue, pr-5094 DROP DATABASE "itest_legacy_…"
10-29 21:40 40947104308 attempt 1 pull request fix/project-create-audience-read-state DROP DATABASE "itest_legacy_…"
10-29 21:41 40947231413 attempt 1 pull request fix/pii-two-digit-year-dob DROP DATABASE "itest_legacy_…"
10-29 21:46 40947434882 attempt 1 pull request fix/workflow-model-capacity-backoff DROP DATABASE "itest_legacy_agent_…"
10-29 21:49 40947419087 attempt 1 pull request fix/send-dictated-words DROP DATABASE "itest_legacy_…"
10-30 01:06 40983790799 attempt 1 push 97256fcea9 (main) DROP DATABASE "itest_legacy_…"

The other 6 failures in the same window were check-level failures inside the lanes and a truncation at lane 104 (checkRestProjectAgents); #4921 tracks those.

Done means

  • Each proof's database DDL (CREATE DATABASE, ALTER DATABASE … SET, DROP DATABASE) and the migrations it applies to its fresh database run without the 8 s statement timeout, or with a budget sized for a loaded runner (the job's own timeout still bounds them). The 8 s statement and lock timeouts stay on the statements under test.
  • A cleanup that does fail still fails the run, as it does today: only the budget changes, not the strictness.
  • Evidence: three consecutive Backend integration runs on the self-hosted runners reach their lanes, and the job log shows the proofs' DROP DATABASE statements completing.

Activity

  1. added
    agent-ready
    on Oct 30, 2026
  2. added a commit that references this issue on Oct 30, 2026
    7290b21
  3. added a commit that references this issue on Oct 30, 2026
    a58423c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readybug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions