Skip to content

test(platform): keep a held delegated start off the audit chain head - #4027

Merged
larryro merged 1 commit into
mainfrom
test/busy-retry-held-start-off-chain-head
Oct 1, 2026
Merged

larryro merged 1 commit into
mainfrom
test/busy-retry-held-start-off-chain-head

Conversation

@larryro

@larryro larryro commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

The busy-retry lane holds a delegated start open at the agent row while it probes that the retry queues behind it, so the start's SERIALIZABLE snapshot stays open for hundreds of milliseconds in the one organization every lane of the run shares. Assigning its task wrote an audit row, and the audit chain head that row takes is bumped by every audited write of the org: a lane running beside this one failed the start's first attempt (40001 on the chain head's ensure-insert), which rolled back and freed the agent row, so the READ COMMITTED retry queued on it started and the start's second attempt answered agent_busy — one live run, but not the order the round holds. Seen on #4025's Checks run (Backend integration 1234/1235); the job passed on re-run.

  • The task a held start works is now assigned up front, so the start writes no audit row and never reaches for the chain head.
  • What a concurrent lane can still fail (a dependency on an index page it wrote) is rare and never the retry's doing, since the retry commits nothing while it queues: a round whose held start lost its first attempt is void and re-run on fresh tasks, bounded (5), and says so in the log. The lock-order rounds get the same guard.
  • The first attempt's error code is the signal, not an attempt count: a retry queued on the chain head's key runs on a reserved connection the lane's begin trace never sees.

Proof: the throwaway Postgres log attributes 122 of the serialization failures to INSERT INTO app.audit_chain_heads … ON CONFLICT DO NOTHING. Bumping the chain head from a side session every 300 ms voided every held round before the change and none after it. Lane alone: 38/38. Full backend:integration locally: 1231/1231 across 207 lanes.

Test-only; one file.

The busy-retry lane holds a delegated start open at the agent row while it
probes that the retry queues behind it, so the start's SERIALIZABLE snapshot
stays open for hundreds of milliseconds in the one organization every lane
of the run shares. Assigning its task wrote an audit row, and the audit
chain head that row takes is bumped by every audited write of the org: a
lane running beside this one failed the start's first attempt (40001 on
the chain head's ensure-insert), which rolled back and freed the agent row,
so the READ COMMITTED retry queued on it started and the start's second
attempt answered agent_busy — one live run, but not the order the round
holds (CI on #4025, 1234/1235; passed on re-run).

The task a held start works is now assigned up front, so the start writes
no audit row and never reaches for the chain head. What a concurrent lane
can still fail (a dependency on an index page it wrote) is rare and never
the retry's doing, since the retry commits nothing while it queues: a round
whose held start lost its first attempt is void and re-run on fresh tasks,
bounded, and says so in the log. The lock-order rounds get the same guard.

Reproduced locally by bumping the chain head from a side session: every
round voided before the change, and the round passes at its first try
after it.
@larryro
larryro merged commit aca82ed into main Oct 1, 2026
62 checks passed
@larryro
larryro deleted the test/busy-retry-held-start-off-chain-head branch October 1, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant