Skip to content

[SUPERSEDED / UNMERGED] Crash recovery integrated on MVP PR #174 - #171

Closed
mark-e-deyoung wants to merge 9 commits into
mainfrom
fix/crash-handover-recovery-20261120
Closed

mark-e-deyoung wants to merge 9 commits into
mainfrom
fix/crash-handover-recovery-20261120

Conversation

@mark-e-deyoung

Copy link
Copy Markdown
Collaborator

Scope

Add fail-closed startup reconciliation for the existing session.transition.json markers after crash/restart, retaining current active pointer as the sole ownership authority. Reject malformed, cross-root, mismatched-operation, or profile-link inconsistent markers. Only paired markers from the same operation are removed, and removals are synced to the directory. Add synthetic filesystem crash-point and adversarial tests; no native Wine execution or private code.

Explicit limitations

This reconciles the session pointer/profile/broker startup view and state file, not crashed/partially completed Wine processes or in-flight recorder operations. Source reviewer must validate durability and rollback order before merge. No unqualified native observer or release promotion; separate from formal broker draft PR #170.

Acceptance

Green exact-head full CI and tests on free public GitHub Actions, model-to-source mapping, failure-injection for both pointer-before/after crash and mismatch handling; no private GHA minutes, user hardware or paid cloud.

Copy link
Copy Markdown
Collaborator Author

2026-11-20 19:27+0100 execution: two independent, source-owned corrective PRs for cross-layer atomicity

P0 broker input fencing, draft #170 current exact source 542f7bc8771a15912253ebe987145370598f38aa. Actual changes to api/core/broker.py introduce authority-generation tickets; all policy/session control changes, grant/renew/revoke invalidate generation; real api/routers/input.py mouse and key routes capture a ticket before asynchronous window lookup and verify it immediately before backend submission; all forged/stale/expired tickets are denied with 423. tests/test_input_revocation_interleaving.py now requires STOP_NOW-before-dispatch to produce no synthetic click or key action, and tests session turnover/lease expiry invalidation. Earlier red witness was intentionally converted to a green safety assertion. The design does NOT prevent already-spawned Wine/X11/AHK subprocess effects, and a later native consumer-side fence/cancel test remains mandatory. Formal/TLC #44793837457 SUCCESS; BuildKit guard #44793837430 SUCCESS; CI #44793837531 finished FAILURE solely at Conformance (Contracts), while Pre-flight (Lint & Unit) SUCCESS, Integration Smoke SUCCESS. CI output is sanitized and does not disclose failed IDs; same independent conformance failure previously occurred in #167 and is NOT proven caused by this patch. No merge or production effect claims.

P0 crash/restart handover, new independently-scoped draft PR #171 from current public main. Adds api/core/handover_recovery.py and api/server.py lifespan hook: on startup, after relinking profile and initializing broker, read only current active-session marker, verify exact in-root peer/op identity, active Wine user symlink, converge active state to current pointer, delete matched peer/active markers with directory fsync, quarantine mismatch/unsafe paths/malformed markers. Does not execute native Wine or attach private source. Eight synthetic tests/test_handover_restart_recovery.py scenarios cover crash before/after pointer, marker orphan, mismatch, external path, malformed data and replay. api/routers/lifecycle.py now verifies profile link during live resume and compensation, fsyncs marker directory after rename, retains marker after failed no-prior-owner activation for restart recovery. First CI #44795118460 FAILED solely lint Ruff F841 unused variable; fixed at exact current #171 head 4ff5ecd991158f2b46ac997b840776e07647bf3a. New exact-head CI #44795406130 IN_PROGRESS. No unit PASS claim until completed.

Safety / known limitations: link verifier is local symlink consensus, not an atomic transaction against arbitrary host process death. Unobserved incomplete intent in an inactive target still requires future namespace scanning/garbage collection. Current-pointer-forward recovery is a deliberate bounded policy; shutdown/recorder processes remain out of scope. Both drafts stay unmerged pending exact-head tests, independent code review and full product qualification. Formal TLA+ checked earlier covers abstract states only. Existing WinInspect private #468 source cloud admission and WineBot #166 actual native observer release gate unchanged. All compute public free GHA; no private Actions minutes, user hardware, paid service, private source projection, or production input.

Copy link
Copy Markdown
Collaborator Author

2026-11-20 19:27+0100 continued — R3 broker correction and R4 independent crash-recovery implementation

Broker, draft #170 exact head 542f7bc8771a15912253ebe987145370598f38aa: production InputBroker issues generation tickets bound to current grant/policy/session; revocation, STOP_NOW, session change, renewal invalidate them; mouse/key routes re-check generation and access directly before backend admission; real route-level mocked interleaving tests require HTTP 423 and NO synthetic click/key after STOP_NOW; tests cover lease expiration and session turnover. Exact TLC + adversarial counterexamples #44793837457 SUCCESS, BuildKit guard #44793837430 SUCCESS. Full CI #44793837531 terminal FAILURE: Pre-flight Lint+Unit SUCCESS, Integration smoke SUCCESS, Conformance Contracts FAILURE with intentionally sanitized failure evidence; similar failures were seen in #167, but attribution/baseline not proven. Do not merge until diagnosed; cannot claim in-flight external command cancellation or full distributed atomicity.

Crash/restart, independently scoped draft #171 current exact head 720f1dbe73b51f3bad5b85caddf62f168f359e2a. Added api/core/handover_recovery.py startup reconciliation: current active-session pointer remains sole authority; verify active Wine profile symlink and exact matching peer operation marker within same session root; commit active state, durably remove matched markers or fail closed/quarantine invalid/malicious peer. api/server.py lifespan invokes after relinking profile and syncing broker, before API ready. Live api/routers/lifecycle.py resume now verifies symlink instead of trusting silent helper errors, compensates previous profile link on rollback, fsyncs marker directory on rename, retains target intent if first-activation failure leaves current pointer with no previous owner. Tests use only synthetic temp files/symlinks, not real Wine. First CI 44795118460 failed Ruff F841 unused synthetic variable; fixed. Next 44795406130 lint PASS but unit suite exposed 2 legacy resume tests mocking old link_wine_user_dir seam; they bypassed new verifier and triggered controlled failure. Updated those test mocks to _link_profile_checked, preserving the production check, and added new real synthetic profile-link test that succeeds on correct symlink and detects silent stale-link failure. Current exact-head CI #44795909932 IN PROGRESS; do not claim new head green prematurely.

Boundaries and residuals: startup reconciliation only covers the marker reachable from current active pointer, does not scan orphan markers in inactive sessions, restart Wine/services, or finalize crashed recorder; it does NOT solve multi-process concurrency or in-flight remote input. Formal checking proves abstract model properties, not automatically runtime correctness. Both #170/#171 remain DRAFT and unmerged; #158 exact MVP baseline 14/14 previously green and native #166 with unqualified old WinInspect ZIP remain held. Private WinInspect #468 needs approved private source cloud admission/CTest/projection. All execution via existing free public GHA; no private Actions minutes, user-owned hardware, paid compute or unauthorized source publication.

Copy link
Copy Markdown
Collaborator Author

2026-11-21 00:46+0100 — shared conformance provenance diagnostic and exact-head qualification

Confirmed: both unrelated independent correction PR heads reached Pre-flight (Lint & Unit) SUCCESS and Integration (Smoke Test) SUCCESS but terminal Conformance (Contracts) FAILURE: broker #170 542f7bc8771a15912253ebe987145370598f38aa CI 44793837531, recovery #171 720f1dbe73b51f3bad5b85caddf62f168f359e2a CI 44795909932. In both, conformance job checks out a separate moving default branch of mark-e-deyoung/winebot-contracts in .github/workflows/ci.yml without a recorded exact contract SHA. Current contracts main 205666f7f0235cb0fc51ca8a5af84f9f67831a74 has recent vNext assertion classification changes (fe3efd1f, 34d1c87a, etc.). Historical MVP #158 at 9809519b had CI 44666519926 SUCCESS, but its actual external contracts SHA was not pinned in source. This is a confirmed reproducibility deficiency and possible common cause of changed conformance verdict, NOT proof that the new contract revision caused the failures. Conformance log deliberately redirects full private/sensitive test details to local only and publishes sanitized summary artifact; do not expose raw failed test IDs or edit conformance to hide failure. Next method: explicitly qualify an exact contract ref on a separate diagnostic branch, compare exact contract SHA from successful vs failing run if available, and use a controlled same-SHA run to isolate source vs contract drift. Keep failed gating visible.

The unit/fixture defects in #171 have been addressed at exact head 720f1dbe73b51f3bad5b85caddf62f168f359e2a CI 44795909932 terminal aforementioned conformance FAIL (unit/smoke SUCCESS). No merge or release. Preserve PR #170/#171 independent authority and product gates, no private GHA spend.

Copy link
Copy Markdown
Collaborator Author

2026-11-21 00:46+0100 independent diagnosis: exact external conformance source admission

Both independent cross-layer patches remain DRAFT and not merged: formal/broker #170 exact 542f7bc8 and crash-handover #171 exact 720f1dbe. Each has Pre-flight Lint+Unit SUCCESS, Integration Smoke SUCCESS, but Conformance (Contracts) FAILURE on full CI. The conformance job currently checks out mark-e-deyoung/winebot-contracts without ref, thus its evolving default-branch contents are not bound to the WineBot commit, compromising reproducibility. Historical owning #158 9809519b full CI 44666519926 SUCCESS does not establish the same external contract revision. Recent external contracts commits changed vNext test classification, but causal responsibility is not yet established.

Created separate public DRAFT diagnostic PR #172 based on otherwise unchanged main f5ba0256f330958dcf35710a822508cdb31fc40b, source exact HEAD 541f9765f4e6ba2469671646b66277b1d9a1d7a8. It only pins the external conformance checkout ref: 205666f7f0235cb0fc51ca8a5af84f9f67831a74 and disables persisted credentials. No contract assertions modified, no test skipped, no raw failure details published. New free public CI #44839445266 queued; source-independent public-safety workflows also queued. Compare exact SHA baseline verdict with same exact external contract SHA on #170/#171 before deciding contract authority and remedial code. Existing sensitive logs remain local/sanitized.

Release status unchanged: #158 baseline qualified but draft, #166 native WinInspect repaired executable not yet admitted; private #468 cloud-source C++ test/projection still blocked. Do not merge #170/#171/#172 or treat pinned ref as final authority without qualification. No paid/private runner, sovereign hardware, credentials, or private code used.

Copy link
Copy Markdown
Collaborator Author

2026-11-21 00:46+0100 — independent exact-contract baseline reproduced failure; custody admission implemented

Actual terminal baseline evidence: the source-only diagnostic draft PR #172, original candidate 541f9765f4e6ba2469671646b66277b1d9a1d7a8 based on otherwise unchanged main f5ba0256f330958dcf35710a822508cdb31fc40b, tested fixed external mark-e-deyoung/winebot-contracts@205666f7f0235cb0fc51ca8a5af84f9f67831a74. Real public CI #44839445266 terminal FAILURE with Pre-flight Lint/Unit SUCCESS, Integration Smoke SUCCESS, Conformance Contracts FAILURE. Its other independent public safety gates passed. Thus the baseline conformance failure is reproducible without any broker #170 or handover #171 runtime changes. This falsifies the hypothesis that either of those diffs is a necessary cause of the current common conformance failure. Exact underlying conformance assertion failure remains unclassified; do not presume contract source drift is the sole cause, or suppress any failures.

New exact-source custody improvement on PR #172 HEAD 7e6597eb8e31b677ae60e6c04f3ab9e838eeba1c: after checkout, CI explicitly compares git -C contracts rev-parse HEAD with authoritative diagnostic exact 205666f7f0235cb0fc51ca8a5af84f9f67831a74, checks a clean contracts checkout, fails closed on mismatch, and emits public-safe CONTRACTS_SOURCE=EXACT_COMMIT_VERIFIED / exact SHA plus a GitHub job summary. The test verdict remains separate and can still fail. New CI #44841649732 in progress at checkpoint; no claim of passed custody step yet. Do not treat chosen pin as approved permanent contractual authority. Pinning is a reproducibility diagnostic, not a workaround.

Broker PR #170 HEAD d00d2110c5d40d7f8862063a3d7901f215da96bd: fixed newly found STOP_NOW bypass for fresh tickets via non-interactive / agent-only mode early returns; check_access() now checks STOP_NOW before shortcuts. Added direct synthetic ticket issuance and invalidation tests for both headless HYBRID and AGENT_ONLY modes. Formal/TLC #44839600564 terminal SUCCESS. CI #44839600357 terminal FAILURE at Conformance Contracts with Pre-flight Unit/Lint and Integration Smoke both SUCCESS; independent unchanged baseline fails similarly. This still does not guarantee cancellation of an already-running external native input.

Handover PR #171 HEAD 720f1dbe73b51f3bad5b85caddf62f168f359e2a: independent fail-closed startup marker reconciliation and filesystem crash-point tests; exact CI #44795909932 unit/lint + smoke SUCCESS, conformance FAIL. All drafts unmerged; no private source/runner, hardware, paid compute, release, or bypass of WinInspect #468 C++/projection native admission gate.

Copy link
Copy Markdown
Collaborator Author

Supersession DLE — main-based recovery branch replaced, no merge

This main-based proof-of-concept contained valuable fail-closed startup marker reconciliation, but was built before the authoritative MVP lifecycle's 108-commit integration and therefore fails 7 legacy contract tests also failing on unchanged main. Its nine synthetic handover tests were not included in the explicit scripts/ci/test.sh allowlist; green prior unit CI for this branch did not execute those new tests. The source has now been reconciled into stacked DRAFT #174 on qualified MVP #158, which adds the test manifest entry, verifies reciprocal intent/operation identity and link, makes marker renames/unlinks directory-durable, demotes stale ACTIVE peers, orders cleanup for idempotent replay, and tests malformed/missing intent and dual-owner crash scenarios. At successor exact head 0e6b8d16f0ceee422853e77d26d20f26a1eef9b9, unit isolation #44844739725 and mandatory CI unit/lint #44844739774 unit steps have passed, while full conformance/smoke checks continue. #174 is DRAFT, not approved for release or merger. Close this obsolete main-based branch unmerged, preserve the original audit history and exact source evidence, and continue all corrective work only in #174 / owning DLE #158.

@mark-e-deyoung mark-e-deyoung changed the title [DRAFT] Restart reconciliation for interrupted session handover [SUPERSEDED / UNMERGED] Crash recovery integrated on MVP PR #174 Nov 21, 2026
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