Skip to content

fix(run-store): stop run-create failing on a brief write stall - #4514

Merged
matt-aitken merged 1 commit into
mainfrom
feature/tri-12968-fix-5s-interactive-transaction-timeout-fails-68-run
Aug 5, 2026
Merged

fix(run-store): stop run-create failing on a brief write stall#4514
matt-aitken merged 1 commit into
mainfrom
feature/tri-12968-fix-5s-interactive-transaction-timeout-fails-68-run

Conversation

@ericallam

Copy link
Copy Markdown
Member

Summary

On the run-ops store, creating a run could intermittently fail with a "Transaction already closed" error, and the run would never be created. Single-write run creates no longer run inside an interactive transaction, so a brief database write stall can't blow the transaction budget and drop the run.

Fix

The dedicated run-ops createRun / createFailedRun wrapped a single nested taskRun.create in an interactive $transaction. Its default 5s budget is wall-clock from BEGIN, so when a write briefly stalls the transaction expires before the create completes and throws, even though the statement itself is fast at the database.

A single-write create does not need an interactive transaction: Prisma's implicit nested create is already atomic and holds no app-side budget, so it now runs directly. Only the triggerAndWait path (run plus its associated waitpoint, two writes that must commit together) keeps an interactive transaction, now with headroom over the default.

Verified with a red/green test against the real split topology (reproduces the exact expiry on the unchanged code, green after) and an end-to-end run created and completed through the dedicated store.

@changeset-bot

changeset-botBot commented Aug 5, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 075c12b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitaiBot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The run store now accepts transaction options and defines a 15-second write timeout. Dedicated createRun and createFailedRun paths use a single write when no waitpoint exists. They use the configured timeout when creating a run with a waitpoint. An integration test verifies run and execution snapshot persistence when interactive transactions time out after 1 ms. A server change note documents the fix.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
Title check✅ PassedThe title clearly and concisely describes the run-store fix for failures caused by brief write stalls.
Description check✅ PassedThe description clearly explains the fix and includes verification details, although it omits the template's issue link and checklist sections.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/tri-12968-fix-5s-interactive-transaction-timeout-fails-68-run

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]

This comment was marked as resolved.

@ericallam
ericallamforce-pushed the feature/tri-12968-fix-5s-interactive-transaction-timeout-fails-68-run branch from ee4f7c2 to 975ed18CompareAugust 5, 2026 15:10
@coderabbitai

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@ericallam
ericallam marked this pull request as ready for review August 5, 2026 15:24
devin-ai-integration[bot]

This comment was marked as resolved.

On the run-ops store, a run create with no associated waitpoint was wrapped in an interactive transaction whose default 5s budget is wall-clock from BEGIN, so a brief write stall could expire it and throw before the create ran, losing the run. Single-write creates now run as an implicit transaction with no app-held budget; the triggerAndWait path (run plus associated waitpoint) keeps an interactive transaction with headroom.
@ericallam
ericallamforce-pushed the feature/tri-12968-fix-5s-interactive-transaction-timeout-fails-68-run branch from 975ed18 to 075c12bCompareAugust 5, 2026 15:35
@coderabbitai

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@matt-aitken
matt-aitken merged commit b208062 into mainAug 5, 2026
51 of 59 checks passed
@matt-aitken
matt-aitken deleted the feature/tri-12968-fix-5s-interactive-transaction-timeout-fails-68-run branch August 5, 2026 16:35
@github-actionsgithub-actionsBot mentioned this pull request Aug 5, 2026
Sign up for freeto 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.

2 participants

@ericallam@matt-aitken