Repository navigation
Description
This was generated by AI during triage.
Idea
Adapt Cursor's create-formal-verification-skill to thirdshift. It would produce a project-local skill that model-checks one promise thirdshift makes, and that an agent reruns whenever a change touches the code behind it.
Why this skill and not create-verification-skill
create-verification-skill generates a verify-<app> skill that launches the app and drives its user surface the way a user would, then captures evidence of that. thirdshift's surface is a CLI that drives GitHub, git and an agent Harness. The integration tests already drive it through fakes (tests/fakes/, tests/pickup_run.rs), and driving the real binary would need a sandbox GitHub repository and paid Harness sessions on every check. It would add little evidence for a high cost.
The formal skill targets "concurrency, retries, state machines": a promise that tests rarely reach and that harms users when it breaks. That describes thirdshift's riskiest code:
- Pickup reservation (ADR-0017). Two hosts can read the same Ready issue. A
--force-with-leasecreate ofrefs/heads/thirdshift/pickup/<n>elects a winner, and a Claim-count comparison against the full label history rejects stale selections. Two machines' Pickup runs can take the same Ready issue at once #712 was a real two-clone double dispatch. The current tests are examples of orders someone thought of. - Claim lifecycle. Make, keep, release and requeue Claims through failed runs, a Stop, Self-merge, the Sweep and Day shift hand-back. Releasing a reservation does not release a Claim.
- Worktree acquisition and disposal. The GLOSSARY entry for Worktree is a list of before-and-after authority checks around every destructive attempt, including retries.
Proposed first target
The property is: for any number of Pickup hosts on one repository, at most one Run or Spec run is dispatched per Ready generation of an issue. The model includes crashes, a failed winner that restores ready-for-agent, and Day shift hand-back. If it breaks, two implement sessions push competing work to one Issue branch.
- Tool: TLA+ with TLC. It answers the question "can steps happen in a bad order?" across processes and is independent of the implementation language. The Rust code itself is not what's in question here.
- Each action in the model maps to a function in
src/pickup*/src/claim.rs, and each atomic step matches one request to GitHub or origin. - The check must be shown failing on a broken variant, for example with the Claim-count recheck or the empty lease expectation removed.
- The generated skill records which files and functions it covers and the commit it was last synced at. It runs as one command with a pinned TLC version.
Out of scope for the first pass
Worktree disposal and Self-merge's missing base guard (GLOSSARY: "offers no atomic expected-base guard") are good second targets but stay out of the first pass.
Open questions for the Day shift
- Should the generated skill be a repository skill under
.agents/skills/, or a Factory skill underskills/that Runs load when their diff touchessrc/pickup*/src/claim.rs? - Should CI run TLC (it needs a JVM on the runner), or should it stay an agent-run check?
Activity
JacobStephens2 commentedon Oct 20, 2026
Triage Notes
Decided:
.agents/skills/, not a Factory skill underskills/. Bringing it into the Factory waits on a Verification run (Verification run: thirdshift creates and maintains a repository's verification skills unattended #883).maintain-formal-verification-skill, into.agents/skills/alongsidecreate-formal-verification-skill. A Day shift session runs it after merges that touched covered code (src/pickup*,src/claim.rs) without rechecking. It walks the commits since the recorded sync commit and labels each checkin sync,updated,bugorblocked. Its job is to catch the dangerous case: a check that still passes while describing code that no longer exists.Still open:
cargo test, at the cost of a less expressive model.JacobStephens2 commentedon Oct 20, 2026
Brief (ready-for-human)
Category: enhancement
Summary: Model-check with Stateright that competing Pickup runs dispatch at most one Run per Ready generation of an issue, and leave a repository skill that reruns and maintains the check.
Why not ready-for-agent: The maintainer wants to review before an agent takes this. The modeling also needs judgment: deciding which requests are one indivisible step, and deciding whether a counterexample is a real bug or a modeling error.
Decided:
cargo test, so it runs in CI with the existing tests and needs no JVM. The first property only requires that nothing bad ever happens, which Stateright handles well, and ADR-0017 makes no "eventually" promise. TLA+ and TLC remain the fallback for a later target that needs an "eventually" property..agents/skills/, a repository skill and not a Factory skill.create-formal-verification-skillandmaintain-formal-verification-skillare imported alongside it.Current behavior:
ADR-0017 arbitrates competing Pickup runs. A reservation ref on origin is created with an empty
--force-with-leaseexpectation and holds a unique parentless commit. After acquiring it, the winner rechecks that the issue is still Ready and that its Claim-application count in the label history is unchanged since selection. The reservation is released with a lease that expects exactly the owner's commit. A crashed owner's reservation waits for the Day shift. Tests in the pickup and reservation suites cover chosen interleavings only. #712 was a real double dispatch from two clones.Desired behavior:
A Stateright model of Pickup selection, reservation, the Claim recheck, dispatch, the Claim ending and reservation release, covering:
ready-for-agent;Each model action names the function or request in the Pickup reservation code and the Claim module that it stands for, and each indivisible action is exactly one request to GitHub or origin. The checked property is: never two dispatched Runs or Spec runs for the same Ready generation of an issue.
Key interfaces:
claim::make, the Claim ending) are the code the model must describe.Modelimplementation, with a state that holds per-host phase, the reservation ref, the issue's labels and the Claim count.Acceptance criteria:
cargo testinvocation and passes in CI within the existing test job's time budget..agents/skills/lets a cold agent tell whether a change touches covered code, run the check, tell a real bug from a modeling error, and update the model and sync commit.create-formal-verification-skillandmaintain-formal-verification-skillare under.agents/skills/.Out of scope:
JacobStephens2 commentedon Oct 21, 2026
The maintainer has finished reviewing the brief above and moved this issue to
ready-for-agent. That brief is the Agent Brief. Its "Why not ready-for-agent" note no longer applies; everything else in it stands.