Repository navigation
[DRAFT RDTE / API-ONLY] Single-writer admission — entrypoint handoff still blocked - #183
mark-e-deyoung wants to merge 2 commits into
Conversation
Add fail-closed POSIX flock under shared session root with secure path flags and FD lifetime ownership, precede all startup state/profile/broker mutations, and enroll real two-process contention and SIGKILL tests. This is a bounded single-process guard, NOT distributed epoch fencing.
Source-exact full CI #44913250928 first-failed only at UP035 import location. Preserve all admission/runtime behavior, tests and formal gates; require fresh public CI rather than waiving lint.
2026-11-21 — first exact-head CI failure and source-exact fix (R033)Initial Linux admission PR #183 Corrective source: commit |
2026-11-21 — red-team cross-layer startup ordering gap (explicit release hold)Static source fact: Consequence: No false source-to-system promotion even if all #183 CI is green. The entrypoint's existing Required next implementation before release: acquire one process-lifetime, shared-root exclusive admission as early as possible after privilege drop but before line 94, then hand the same kernel lock ownership/FD to the API/long-running runtime without a release/reacquire gap; validate ownership (same inode, UID, trusted directory, exact namespace/mount) across shell→service→API and ensure no orphan child holds an unintended lock or carries mutating authority after takeover. A separate trusted volume/root test is required because DLE classification: BLOCKED_EARLY_STARTUP_ADMISSION, source-rooted negative finding. #183 remains DRAFT / RDTE, despite its local 4/4 POSIX primitive test and native public TLC PASS. No unqualified native release, private source access, paid cloud/hardware or merge. |
Current safety correction
The first-source implementation only guards the FastAPI lifespan. Do not interpret it as complete single-writer WineBot startup admission. The shell entrypoint and service bootstrap mutate instance state, Wine/profile environment, tracing, recorder and API token files before uvicorn lifespan obtains the lock. See the pinned red-team DLE comment on this PR and the next required entrypoint→API atomic FD handoff. This is a release blocker even if source-bound CI succeeds. No main/hardware/release promotion.
Intent
Implement the first production-facing bounded mitigation identified in formal two-writer DLE #182: no two API processes may concurrently mutate the same Linux session root. A module-local
asyncio.Lockis insufficient across processes. This does NOT complete cross-host generation fencing or the multi-file transactional protocol.Exact-source workcell
Stacked on corrected and formal/TLC-green #182 at
638f3cacd0451009fa39371af4d4451e2cdd5a02. One atomic five-path commit8e2a8ded024268e2f0907ff0425c3a90c6055ffe, compare ahead one/behind zero. Source:api/core/writer_admission.py: Linux/POSIX nonblocking exclusiveflockretained via one FD for process lifespan, held underconfig.WINEBOT_SESSION_ROOT/.winebot-active-writer.lock. Requires absolute non-symlink root, secureO_NOFOLLOW/O_CLOEXECand directory-relative file open, regular single-linked current-UID lock file, 0600 perms. Fails closed on contention/unsupported platform/invalid identity; no permissive fallback.api/server.py: wraps existing lifespan in an admission context before any running-instance write, user profile-link mutation, broker initialization or crash-recovery call. Existing inner startup and shutdown logic unchanged.tests/test_writer_admission.py: actual competing process and FD denial, lock/root symlink negative, synthetic SIGKILL release/reacquisition, relative-root fail-closed, startup refusal before instance state mutation. No Wine/desktop/network/real user data.scripts/ci/test.sh: explicit new regression enrollment, preserved100755executable mode (Git tree read-back checked).Independent local experiment
The lock primitive and four corresponding disposable Linux subprocess tests passed in the ChatGPT execution sandbox (4/4); this is not a release proof. The new server-startup guard and exact combined source MUST pass hosted free public CI before accepting even the bounded Linux process-exclusivity claim.
Acceptance / non-claims
Require new exact-head $0 public GitHub Actions full lint/unit, frozen external conformance, smoke, TLC and red/blue checks, BuildKit/public trust guards; then synthetic and actual multi-worker runtime launch under one shared persistent root and SIGKILL, source/projection/mount review. Preserve DRAFT, no automatic merge, hardware or image promotion. POSIX flock is local advisory admission only; shared filesystem/NFS semantics and multi-host or VM fencing not qualified. Orphan Wine/AHK process effects, atomic multiple-file session state and generation CAS remain separate gates, as does private WinInspect C++ #468 and native HWND #166. No private Actions minutes, paid compute, user hardware, private source or public image publication.