Skip to content

[DRAFT RDTE] Model two competing session writers, stale epoch and admission fencing - #182

Draft
mark-e-deyoung wants to merge 3 commits into
integration/mvp-control-reap-observer-20261121from
rdte/mvp-two-writer-fencing-20261121
Draft

mark-e-deyoung wants to merge 3 commits into
integration/mvp-control-reap-observer-20261121from
rdte/mvp-two-writer-fencing-20261121

Conversation

@mark-e-deyoung

Copy link
Copy Markdown
Collaborator

Why this work is on the MVP acceptance path

At combined source #181, api/routers/lifecycle.py::session_transition_lock is a process-local asyncio.Lock. Two Python mutator workers attached to the same shared session root may read the same old owner and independently write pointer/marker/profile/broker state. The existing single-writer TLA+ handover model and fsync semantics cannot prove cross-process atomicity. No real two-worker production incident is claimed.

The WineBot repository currently has GitHub Issues disabled (create attempt returned 410), so this PR is the DLE home for the gap, exact model receipts and a bounded implementation plan.

Source changes (no runtime mutation)

Based on #181 exact eda01696f297b930185546993a2f5184e340603c, one atomic seven-path tree commit 1ab002da96733b1e1ade37403898330425b13c5e:

  • New formal/tla/SessionWriterFence.tla + cfg: proposed two-process exclusive admission, bounded epochs, one holder, stale-commit rejection invariants.
  • New formal/tla/SessionWriterFenceUnsafe.tla + cfg: deliberately unfenced two-worker stale last-write-wins race; TLC must find the expected NoStaleWrite invariant counterexample.
  • New formal/tests/test_session_writer_fence.py: three stdlib deterministic red/blue enumerations (executed locally: 3/3 PASS, no Wine/users/network).
  • New formal/SESSION_WRITER_FENCING.md: exact source seam, SW invariants, lock/mount/fencing limitations and executable sequential implementation/qualification plan.
  • Existing .github/workflows/formal-cross-layer-tlc.yml: extends current public $0 TLC loop to run the additional blue model and explicitly prove the new red counterexample; retains three prior models and two prior negative controls.

Gate

RUN NEW HEAD public free GitHub-hosted [Formal Cross-Layer Safety (TLC)] and full CI/source safety. Any parse/check failure is a real blocker; fix in this branch without reducing tests or merely checking exit status. Do not merge as a production fix. This is abstract design qualification only, not real process admission, epoch CAS, distributed consensus, or native host/guest transaction atomicity.

Next production work: secure singleton mutator admission on explicitly shared persistent root, real two-process race and SIGKILL tests, durable generation CAS and restart handling, exact-head Wine11 failure injection, then review/owner promotion. No paid cloud, private GHA minutes, local/sovereign hardware, unreviewed private WinInspect source or release.

Add bounded two-actor blue epoch fencing and mandatory stale-commit
negative control, offline deterministic search, and a source-bound
admission/refinement plan. This is a modeled design gap; no production
lock, CAS, Wine process or hardware gate is claimed as implemented.
The blue two-writer TLC run passed but the mandatory expected red
counterexample was not observed in CI. Print only filtered public-model
TLC errors to identify the exact first cause. Keep the negative gate
fail-closed; no waiver, bypass or log artifact upload.

Copy link
Copy Markdown
Collaborator Author

2026-11-21 — blue model PASS, mandatory red negative first failure under diagnosis

First exact head 1ab002da96733b1e1ade37403898330425b13c5e, public formal TLC #44912703582, FAILURE at new required step Prove that two unfenced writers can commit a stale epoch: FORMAL_TWO_WRITER_NEGATIVE=NO_EXPECTED_COUNTEREXAMPLE. All four positive TLC models, including new SessionWriterFence (18 distinct states, depth 5), passed. Both preexisting mandatory negative controls also found expected counterexamples. The new negative model's private temp file was deliberately not uploaded and thus first-failure stdout did not distinguish parser/semantic/other TLC diagnostic from no counterexample.

Corrective action, fail-closed: new exact 9cdf1e9a826efc2d2e50722eb693fef5706df739 changes only existing formal workflow's diagnostic branch to show at most 20 regex-filtered lines of the failed public synthetic TLC model. It retains the exact mandatory invariant-match and still exits nonzero if missing. No production changes, test disablement, waiver or artifact upload. The independent offline Python red/blue enumeration already passed 3/3 locally. Exact-head formal requalification is required after actual diagnosis; do not claim red counterexample PASS. New process admission and generation CAS remain UNIMPLEMENTED.

… control

Exact-head TLC #44912828275 identified an underdetermined successor:
without grouping the expression, an OR branch failed to assign the
primed staleCommit variable. Correct only operator grouping; retain
mandatory expected NoStaleWrite counterexample and green-model checks.

Copy link
Copy Markdown
Collaborator Author

2026-11-21 — first-failure root cause and corrective action (public TLC)

The diagnostic-only rerun formal #44912828275 FAILED as intended until the issue was isolated. Exact public source contained staleCommit' = staleCommit \/ (observed[w] # epoch). TLC parsed it as an OR alternative where one branch did not assign primed staleCommit, and reported "Successor state is not completely specified by action UnsafeCommit ... staleCommit". This is an incorrectly grouped TLA+ expression, not evidence that the intended unsafe two-writer race is safe.

Correction: commit 638f3cacd0451009fa39371af4d4451e2cdd5a02 changes exactly one line to staleCommit' = (staleCommit \/ (observed[w] # epoch)), compelling a successor assignment in both logical branches. No production code, model invariant, negative-control expectation or CI gate relaxed. Retain bounded public-safe error output for future first-failure diagnosis. This head must freshly pass TLC blue 4-model run and red 3-control expected invariant counterexamples, plus stdlib deterministic tests; no PASS asserted yet.

Root DLE finding remains: process-local asyncio.Lock is not a cross-process admission lock. Production mutator admission, durable generation CAS and native concurrent-worker testing are unimplemented and remain a separate release gate.

Copy link
Copy Markdown
Collaborator Author

2026-11-21 — terminal two-writer formal proof receipt and refinement boundary

Exact model SHA: 638f3cacd0451009fa39371af4d4451e2cdd5a02, source-owned PR #182. Public TLC run #44912931173 TERMINAL SUCCESS, with four bounded blue safety models (ControlLease, SessionHandover, ReleaseAdmission, SessionWriterFence), three mandatory red/TLC counterexamples (stale-input after STOP_NOW, split-owner crash without recovery, two unfenced writers committing stale generation), and the independent stdlib model-contract unit tests all passed. Original red-model next-state expression bug was fixed with explicit grouping in the exact SHA, not waived. BuildKit guard #44912931155 SUCCESS. Full CI #44912931120 preflight unit/lint and integration smoke PASS, conformance still in progress at checkpoint.

Refinement/red-team finding: api/routers/lifecycle.py uses process-local asyncio lock while container docker/entrypoint.sh mutates state and Wine infrastructure before uvicorn begins; scripts/init/30-start-services.sh starts recorder/tracing and writes API token before FastAPI's startup. Proposed generation-fenced formal protocol is not refined to these source paths. Draft #183 adds only a late API-process lifespan lock, not global entrypoint→API admission. Explicit hold BLOCKED_EARLY_STARTUP_ADMISSION: requires stable shared lock namespace, early shell privilege/UID transition ownership, race-free FD/authority transfer, process/volume qualification, then generation CAS and orphan handover. Do not promote to production or hardware on abstract formal green, and do not claim cross-host consensus.

This branch has not been deployed

No deployments
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