Skip to content

Add TLA+ model for deployment concurrency leases - #23030

Open
desertaxle wants to merge 9 commits into
mainfrom
codex/tla-plus-deployment-concurrency
Open

Add TLA+ model for deployment concurrency leases#23030
desertaxle wants to merge 9 commits into
mainfrom
codex/tla-plus-deployment-concurrency

Conversation

@desertaxle

@desertaxle desertaxle commented Sep 4, 2026

Copy link
Copy Markdown
Member

Adds a bounded TLA+ model of deployment-concurrency release authority and durable repository guidance for keeping future models mapped to production contracts.

  • Checks an abstract SQL-authoritative claim protocol against stale expiry work, duplicate delivery, PENDING reacquisition, and competing release paths.
  • Preserves five unsafe current-code traces as deterministic strict-xfail regressions.
  • Documents model selection, non-vacuity, model-to-code mapping, implementation tests, ownership, and removal criteria in AGENTS.md.
  • Adds a path-filtered GitHub Actions workflow that checks the target protocol and verifies all five intentional counterexamples.

The target model does not specify a production schema, migration, or replay protocol, and a green TLC run is not evidence that Prefect's Python implementation conforms.

Related to #22935

Checks and scope

The CI job uses Temurin 21 and checksum-verified TLA+ Tools v1.7.4. The target explores 55,915 distinct states with no invariant violation. The unsafe configurations fail with their expected RenewWinsAgainstStaleScan or NoForeignRelease invariant.

@github-actions github-actions Bot added the bug Something isn't working label Sep 4, 2026
@desertaxle
desertaxle marked this pull request as ready for review September 4, 2026 15:36
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-05T00:27:21.204899Z ce88c86 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

devin-ai-integration[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f52502acf8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread formal/tla/deployment-concurrency/README.md

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce88c8653a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +447 to +451
ClaimReacquire(r, l) ==
LET old == stateLease[r] IN
/\ runState[r] = "Pending"
/\ old # NoLease
/\ leaseState[old] = "Absent"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle nullification after PENDING reacquisition

When a PENDING run with an expired lease still has a future scheduled_time, ValidateDeploymentConcurrencyAtRunning acquires a slot and creates a replacement lease, but the later WaitForScheduledTime rule nullifies the transition; ReleaseFlowConcurrencySlots explicitly skips nullified transitions, so the persisted PENDING state retains its old lease ID while the replacement slot and lease are orphaned. ClaimReacquire has no corresponding rollback/nullification action, so the target cannot explore this mapped retry path or its accounting consequences; model it and add a regression, or explicitly exclude it.

AGENTS.md reference: formal/tla/AGENTS.md:L18-L21

Useful? React with 👍 / 👎.

Comment on lines +121 to +125
CreateLease ==
/\ txnKind = "Acquire"
/\ leaseState[txnLease] = "Unused"
/\ leaseState' = [leaseState EXCEPT ![txnLease] = "Live"]
/\ leaseOwner' = [leaseOwner EXCEPT ![txnLease] = txnRun]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Represent acquisition aborts after lease creation

With a durable external lease store such as the filesystem implementation, terminating the server after create_lease succeeds but before the surrounding orchestration database transaction commits rolls back the slot increment while leaving a live lease; after another run acquires that capacity, reaping the orphan can decrement the replacement run's slot. The split model allows CreateLease only to remain stuck in Acquire or proceed to CommitAcquire, so it implicitly assumes this cross-store crash cannot occur even though the README does not exclude process failure; add an abort action and counterexample or state that availability assumption explicitly.

AGENTS.md reference: formal/tla/AGENTS.md:L11-L13

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant