← Back to Pull requests

fix(runtime): keep Windows lock records out of route discovery #6658

Closed
unknown closed this pull request without merging on Oct 16, 2026 15:36 UTC
View on GitHub
unknown unknown commented on Oct 16, 2026 14:24 UTC
Author

Goal

Close the remaining Windows case of the phantom two-root conflict that f955e8305 fixed for .lock/.ts-effect.lock: a released Windows lock-holder record (or an incident log) beside a root's own global registry must not be read back as machine state, so a Windows machine whose work has settled on one default runtime root stops refusing every implicit-default command (loopx status, update check, usage-ping status).

Closes #6657.

What changed

  • loopx/paths.py: _is_route_observation now recognizes the documented lock-metadata family beside the root's own global registry — registry.global.json.lock, registry.global.json.lock.holder, the legacy registry.global.json.lock.holder.json, registry.global.json.lock.incidents.jsonl, registry.global.json.ts-effect.lock — on every platform, so an archive restored on another host cannot re-create the conflict either. Redirected entries, unknown files and real registries keep their authority.

  • tests/test_local_state_migration.py: extends test_own_registry_locks_do_not_declare_a_second_authority and test_observations_and_consumer_locks_do_not_claim_a_second_runtime with the holder / legacy-holder / incident spellings, and adds test_a_real_lock_round_trip_keeps_the_default_route_fresh, which drives the real exclusive_file_lock producer — the writer behind Goal configuration — so the producer→consumer contract is pinned instead of hand-placed files.
  • Evidence

    Before (pre-fix tree, sandbox with both default roots redirected to a disposable temp tree):

    [OK]  lock only (control):        status='legacy'
    [BUG] lock + released holder:     status='conflict'
    [BUG] lock + legacy holder.json:  status='conflict'
    [BUG] lock + incidents.jsonl:     status='conflict'
    [OK]  lock + ts-effect.lock:      status='legacy'
    

    After (this head):

    [OK]  lock only (control):        status='legacy'
    [OK]  lock + released holder:     status='legacy'
    [OK]  lock + legacy holder.json:  status='legacy'
    [OK]  lock + incidents.jsonl:     status='legacy'
    [OK]  lock + ts-effect.lock:      status='legacy'
    

    Negative case — the new guards against the unfixed paths.py (source fix stashed, tests kept):

    FAILED tests/test_local_state_migration.py::test_observations_and_consumer_locks_do_not_claim_a_second_runtime
    FAILED tests/test_local_state_migration.py::test_own_registry_locks_do_not_declare_a_second_authority[registry.global.json.lock.holder]
    FAILED tests/test_local_state_migration.py::test_own_registry_locks_do_not_declare_a_second_authority[registry.global.json.lock.holder.json]
    FAILED tests/test_local_state_migration.py::test_own_registry_locks_do_not_declare_a_second_authority[registry.global.json.lock.incidents.jsonl]
    FAILED tests/test_local_state_migration.py::test_a_real_lock_round_trip_keeps_the_default_route_fresh
    

    Real-host readback on the reporting machine (read-only, no state written): status: legacy, selected_runtime_root: %USERPROFILE%\.codex\loopx, and loopx status with implicit defaults completes with exit 0. Pre-fix, the same host refused with the two-root conflict message, and loopx usage-ping status died with an unhandled ValueError traceback (both in #6657).

    Validation

    At exact head 5ccf12f2f on Windows 11 (10.0.26100), Python 3.12.12:

  • uv run --extra test python -m pytest tests/test_local_state_migration.py tests/test_file_lock.py tests/test_doctor_installation_scope.py → 14 failed, 101 passed, 3 skipped. The 14 failures are host artifacts (symlink privilege WinError 1314, Windows path-quoting/separator rendering), not new: the pristine run of this file alone gave the identical 14 failed, 67 passed, and neither loopx/paths.py nor this test file changed between that baseline 488e4438e and the push base b2aca67d7 (git diff 488e4438e b2aca67d7 -- loopx/paths.py tests/test_local_state_migration.py is empty). The four new guards are among the passes (-k run: 7 passed; the same run against the unfixed source fails 5, see above).

  • uv run python -m ruff check loopx/paths.py tests/test_local_state_migration.py → clean

  • uv run python scripts/generate_semantic_inventory.py --changed-from HEAD (on the working diff) → changed sources: 1 paths, 1 snapshots; supported candidates: 0 — no new vocabulary carriers
  • Scope

  • Deliberately not changed: the refusal wording and the loopx usage-ping status unhandled-traceback surface (that refusal behavior is a separate defect already carried by another agent's coordination claim); the windows-powershell lane file selection (#6638 / #6639 owns the workflow).

  • uv.lock stays uncommitted (generated by local uv sync).
  • Checklist

  • DCO sign-off on the commit (git commit -s)

  • Focused tests, negative case, honest before/after evidence

  • No private state, credentials, raw logs or local absolute paths in the diff
  • <sub>Drafted with AI assistance at my request, under my direction and review.</sub>

    Diff: 621 lines (+465 / -156) across 7 files Reviewer: JasonBuildAI Review duration: 71m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 621 lines diff across 7 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.385
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #6658"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 50.3% (MEDIUM) · Higher = larger blast radius
    50.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.9% · Safe to merge
    19.9%