Skip to content

ONLINE-PLAY-1: source-verified restricted Lichess gateway and single-game dry-run - #76

Draft
HMarcusWH wants to merge 69 commits into
mainfrom
feat/online-play-1-restricted-live-canary-gateway
Draft

HMarcusWH wants to merge 69 commits into
mainfrom
feat/online-play-1-restricted-live-canary-gateway

Conversation

@HMarcusWH

Copy link
Copy Markdown
Owner

Scope — PRIVATE SYNTHETIC PR-A ONLY

Source reanchored from main ad1e582637d981199550caf389b43861ce3d2596 (RELEASE-2B-2 merged; 0 open PRs at start). This is a restricted test candidate. No Bot API calls, real credentials, account conversion, merge, deployment, image publication or playing-strength claim is authorized.

  • Source policy and strict schemas remain all false, identities null.
  • Ephemeral Ed25519 runtime admission/one-game SQLite lease, 429/move-once journal.
  • Separate private Lichess gateway, exact GET/POST raw HTTP path/header/body allowlist, BOT identity verification, synthetic-keyed token-test, NDJSON frame forwarding.
  • Explicit opt-in guarded transport profile; original offline entrypoint and release policies byte unchanged.
  • Dual-network Compose and PID1 one-game supervisor, source/host admission, durable PGN recovery and bounded process cleanup.
  • Synthetic fake-API both-color Docker harness with real pinned lichess-bot and sealed Stockfish/Reckless/LC0, independent PGN/SQLite/HTTP verifier.
  • Dedicated no-secrets/no-publication PR CI, release boundaries, threat model and runbook.

Review/qualification pending. Do not merge until all exact-head checks and actual complete games both colors are independently green. This PR deliberately excludes the separate PR-B named real host/account, GPL/AGPL review, live operator trust anchor, irreversible BOT upgrade and first real game approval.

No source-policy boolean authorizes real play. The private synthetic test signer's public key is NOT a real operator trust anchor.

Copy link
Copy Markdown
Owner Author

ONLINE-PLAY-1 PR-A — source review handoff (NOT MERGE READY)

Latest reviewed source head: 7193f704804ceca0d986d1499bed41e56cff00aa against unchanged main ad1e582637d981199550caf389b43861ce3d2596.

Implementation candidate includes source-bound Ed25519 one-use admission; deny-by-default live gateway; separate network namespace/secret handling; pinned upstream bridge and sealed hybrid UCI; independent read-only SQLite SUBMITTING move-intent verification, one-shot POST/restart fencing; durable kill switch; actual fake API/game orchestration and source-independent PGN/HTTP verifier. See PR-A handover.

Do not merge or promote. Exact-head ONLINE-PLAY-1 qualification run 39708827293 was pending without completed jobs at inspection. No completed legal White+Black full games, confirmed Docker isolation receipts, exhaustive adversarial acceptance matrix or independent DRY_RUN_PASS are claimed. The public-release prohibition has remained green on earlier checked source heads but must be rechecked at the exact final head. Any genuine CI failure requires a new repair commit and requalification.

No real Lichess token, account conversion, live Bot API traffic, deployment, image publication, legal/host/live approval, or merge was performed. PR-B remains separate and unapproved.

Copy link
Copy Markdown
Owner Author

PR-A repair implementation handoff — NOT MERGE READY

Current repaired head: 42beb7833d1af37bbc7cb9b4ac60ae0bd4a1e4fe (base remains ad1e582637d981199550caf389b43861ce3d2596).

Implemented in source: categorized/redacted bridge staging failures and sanitized private child traceback module/line/class hints; separate NOT_COMPLETED and independent NOT_RUN artifacts; pinned upstream + source-sealed UCI no-egress preflight; single cleanup before releasing the exclusive SessionOwner flock; independent content-hash validation of signed host receipt; same-WAL-snapshot owner/game/SUBMITTING-intent read; bounded cross-namespace terminal evidence wait; verified real Docker image IDs, mounted immutable source, and cleanup-before-success evidence; adversarial/unit tests and PR-A runbook/threat-model updates.

Still required: latest-head real pinned lichess-bot + sealed Allfather UCI synthetic game as White and Black; independent source/evidence validator DRY_RUN_PASS; exact-head downstream regressions, formal review, and merge decision. The prior run 39789878717 failed on supervised_pinned_game:Exception and cannot be cited as successful evidence. No completed new positive run is claimed while Actions remain queued.

Separate shared blocker: draft PR #77 repairs CI-only signed Ubuntu host-package acquisition; it is NOT a change to RELEASE-2B frozen OS/wheel locks, and must qualify separately before rebasing this candidate.

Forbidden: real Lichess API, credentials, BOT conversion, image publication, host/live release or strength claims. Maintain PR draft and all policy flags false.

Copy link
Copy Markdown
Owner Author

ONLINE-PLAY-1 repair checkpoint — draft / no live authority

Exact head: 82af6ac2568c8febe7d91ceb6cdf9dabc4413818.

  • Repaired the ONLINE-3B terminal-race test fixture by supplying its signed-session nonce and asserting durable challenge-to-game binding.
  • Repaired newline framing in the sanitized upstream traceback test; added unapproved-module redaction negative.
  • Added a delayed, independently persisted terminal-witness regression; mismatched server history must deny success.
  • Prior PR-A commits include source-sealed staging diagnostics, host-receipt digest verification, atomic bridge-journal snapshots, bounded process cleanup and gateway stream-cancellation races.

Dependencies still open: PR #77 repairs host APT qualification; PR #78 isolates the post-bestmove replay-disposition issue in the legacy merge gate.

Do not merge/promote: At this checkpoint the exact-head fake White/Black integration and independent DRY_RUN_PASS are still pending. No actual real Lichess credentials, live bot gameplay, operator arming, public publication or distribution is authorized. All authority flags stay false.

Copy link
Copy Markdown
Owner Author

Sealed staging repair implementation checkpoint — NO REAL LIVE AUTHORIZATION

Current source head bce3f30fa30f765c6441054a1f935b5f6b5f53f7.

The PR-A source now performs independently diagnosed UPSTREAM_LOCK_CHECK and ENGINE_SEAL_CHECK before calling the original immutable offline_session.stage() again. A failure inside the original stage is tagged OFFLINE_STAGE_COPY_OR_CONFIG, not silently bypassed. The source-locked upstream origin/commit, offline release, UCI authority and forbidden production policy remain unchanged.

The exact Docker preflight retains an allowlisted negative stage receipt only in GitHub Actions; raw container stderr is removed and never uploaded. New tests enforce that no failure permits skipping the frozen staging call and that synthetic secret strings never appear in the retained diagnostic. The first new-head bridge unit run exposed a malformed newline test fixture (not production staging), fixed in bce3f30.

The latest source-boundary and merge gate passed. New offline canary full integration remains unqualified: White/Black synthetic complete games and independent DRY_RUN_PASS are not yet available, and the exact failing original frozen-stage suboperation still needs the new image-based diagnostic run. PR #79 holds separate shared runtime fixes; PRs #77 and #78 must be reconciled before any source-qualified merge.

All operator/live/publication/legal/distribution flags remain false. No real Lichess network calls, real token, BOT conversion, promotion or merge.

…e canary (#76)

Preserve the 47 PR-A canary paths and all main resource fixes without path conflicts; synthetic-only authority, sealed staging and no-publication policy unchanged.
…sing exceptions

Classify exact traceback locations in the unchanged offline_session.stage function and retain only allowlisted operation codes and safe exception categories. Add negative tests for shutil copy errors, unknown injection and cross-stage spoofing. No staging bypass, real transport, license or public-release authority.

Copy link
Copy Markdown
Owner Author

Source reconciliation + frozen-stage diagnostic repair — exact-head CI pending

New PR head: 54340f04777c15ac747d161b138df4829911ef28. Source-preserving merge of the original PR-A head with merged #79 (main 2b0c0ea671f0ea556a5a0190410e961047c0eef6), with zero changed-path conflicts: exactly 47 PR-A files versus main and 0 commits behind.

Added an allowlisted offline_operation code derived from the actual traceback frame of the unchanged offline_session.stage() and unique frozen source operation anchors. This distinguishes release copy, tracked upstream export, overlay checks, config generation and release identity without storing raw paths, tokens or exception messages. Added explicit ShutilError/safe import exception classes and injection/redaction regression tests. The original immutable staging call remains mandatory and untouched.

The previous OFFLINE_STAGE_COPY_OR_CONFIG/OtherError is not yet root-caused or fixed; the next synthetic image preflight must yield a safe more-specific receipt if it fails. Complete White and Black games, independent DRY_RUN_PASS, source-exact CI and review are still mandatory. Keep draft. No real Lichess API, credential, BOT upgrade, host authorization, public distribution or release permission.

…nfig validation

Retain immutable offline_session.stage and pinned upstream validation; use a dedicated 1GiB uid10001 private exec/nosuid/nodev tmpfs while keeping general /tmp noexec. Enforce mount identity before lease/staging and independently validate runtime mount evidence. Add allowlisted config-substage and generic upstream Exception diagnostics, no-secret negatives, synthetic host evidence bindings and updated documentation. No real token, live API, deployment or release grant.

Copy link
Copy Markdown
Owner Author

Private executable staging + configuration diagnostics — implementation checkpoint (NOT MERGE READY)

Exact candidate head: 8c6691f3e382157b1d95ef9f88729079a80dc9fd (parent 54340f04777c15ac747d161b138df4829911ef28); 19 changed files.

The last independently retained negative preflight was OFFLINE_STAGE_COPY_OR_CONFIG / OFFLINE_STAGE_CONFIG_GENERATE / OtherError. Since pinned upstream validate_config checks the UCI launcher executable bit and can raise generic Exception, this commit tests a narrow candidate cause: staging copied engines onto a general Docker tmpfs with implicit execution flags. It does not assert a proven root cause.

Implemented: an exact, 1-GiB UID/GID 10001 private executable tmpfs at /run/allfather-canary-stage, with exec,nosuid,nodev,0700 and separate /tmp explicitly noexec; real /proc/self/mountinfo/owner/device checks before canary lease admission and in an independent live-container host probe; updated exact session/replay paths in supervisor, entrypoint and synthetic harness; complete source/evidence verifier bindings; fail-closed config_substage tracing of the original bridge_policy.generate function and allowlisted generic upstream Exception; destructive tests, threat model and runbook. Original offline_session.stage(), upstream pin, RELEASE-1 and all live/release prohibitions remain unchanged.

At posting, source-boundary, gateway and bridge-supervisor units are successful on the new head. Full private Docker preflight, two-color games, independent DRY_RUN_PASS, LOCAL-1/Engine Optimization and release regressions are still running. Do not merge or authorize any real Lichess account, API, token, image publication or deployment without new independently verified exact-head evidence.

…-bot

Frame each gateway NDJSON event/heartbeat as a real HTTP/1.1 chunk for default requests.iter_lines(), never append a second status or clean EOF on stream failure. Add held-open real-socket challenge and gameStart regression, fail-closed broken-stream check, sanitized source-controlled transition counters, and runbook scope. Private fake API only; no upstream pin, operator admission, publication or move authority changes.
On operator shutdown, close the partial HTTP/1.1 chunked response instead of emitting a zero-size terminal chunk. Retain one-status boundary and add a real-socket negative regression under synthetic gateway admission; no live/play authorization.
…ffline wheels

Prior exact-head synthetic White and Black games both completed, but host Python verifier exited before verdict. Validate the existing source-sealed wheelhouse, install with --no-index and the generated runtime-wheels.lock (chess built-wheel hash rather than source sdist hash), and verify host imports before independent gameplay analysis. Keep failed/verifier-missing evidence nonqualifying, avoid raw stderr, no public/play authority.

Copy link
Copy Markdown
Owner Author

Implementation checkpoint — chunked transport and offline verifier (NOT MERGE READY)

Current repair head e02d789e55c4200b65ccc8e1772f2224aa05a30c. The pinned upstream lichess-bot consumes its event stream with default requests.iter_lines(); this branch now uses proper HTTP/1.1 chunked NDJSON framing and real-socket tests of heartbeat/challenge/gameStart arrival while the upstream connection remains open. It also records safe challenge-accept/gameStart transition counters and refuses duplicate HTTP responses or a clean terminating chunk on interrupted streams. Original upstream pin, frozen offline staging, private bridge network, source policies, signed lease, move journal and PR-B denial are unchanged.

Important evidence improvement: The intermediate exact-head run f20b95c17d7612007cff97e28091f77606890994 completed both White and Black sealed-UCI fake API games with bridge/gateway exit code 0, preserved PGN/journal/replay evidence and passed executable mount/PID1 containment. Its integration contract nevertheless failed because the host-side independent verifier subprocess exited 1 before a verdict. The network-integration host had prepared but not installed the source-locked Python wheelhouse. The current head validates build/online3b-wheels, installs offline using generated runtime-wheels.lock with --no-index --require-hashes (proper chess wheel hash), verifies chess import, and retains a safe verifier startup diagnostic. No previous-head result promotes the current head. This PR remains DRAFT until a new full exact-head independent DRY_RUN_PASS, summary and review.

Persist network-integration's independent verdict under build/test-results, upload safe failure evidence on producer failures, and report only allowlisted exception class plus exact verified source-function/line identity. Prevent untrusted paths and exception strings entering artifacts; test source-bound diagnostics. Independent chess/HTTP/journal/replay checks, original frozen staging and all live/public release denials remain unchanged.
…gative receipts

Add optional fixed function-enum and bounded line-number object to the closed independent canary verdict schema; retain all immutable PASS requirements, original evidence checks and operator/public-release prohibitions. Test rejection of unknown diagnostic properties at schema contract level.

Copy link
Copy Markdown
Owner Author

Exact-head evidence rejection diagnostic implemented — still DRAFT

New source head 2e45d1c9737e3650a8368bcaf47d9815362cb7a7 (parent diagnostic patch 22875a79f926668b0b1024c7424ec73f30460dfc). On prior exact head e02d789e55c4200b65ccc8e1772f2224aa05a30c, sealed UCI completed genuine fake-API White and Black games and all container/staging and wheelhouse steps passed, but the independent verifier returned exit 2 before its temporary rejection report was retained; therefore downstream independent-canary-verdict and summary correctly failed.

Changes: tests/lichess/test_live_canary_integration.py now writes build/test-results/online-play-1/integration-verifier.json rather than a deleted TemporaryDirectory report; .github/workflows/online-live-canary-qualification.yml uploads it as a bounded incomplete-diagnostic artifact even when the producer fails. scripts/verify-online-live-canary.py no longer serializes raw exception messages or paths: only an allowlisted exception type plus source-bound verification function/line identity. The closed qualification/schemas/canary-verdict-v1.schema.json explicitly bounds this optional diagnostic, and tests confirm no attacker-controlled secret can appear. All independent source/chess/HTTP/journal/PGN/replay checks and the original no-live/no-publish policy remain unchanged.

The historical evidence has been inspected: both natural checkmates and matching HTTP/journal/replay and source hashes are present. This does not establish which independent assertion failed; exact new-head CI must retain the failure gate before a source-backed narrow correction can be made. No DRY_RUN_PASS, LIVE approval or merge claim is made.

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