← Back to Pull requests

fix(task-lease): discover machine identity on native Windows #6653

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 13:29 UTC
Author

Impact: on native Windows the verified-worktree lease path could never be acquired — the documented, CLI-recommended loopx task-lease acquire --write-worktree <path> always failed closed with invalid_worktree_lease_request / "host identity unavailable for worktree isolation" — because the host-identity source only covered macOS (IOPlatformUUID) and Linux (/etc/machine-id). Every Windows contributor or agent following the write_scope_conflict advisory, the flag help or the code-edit worktree guide dead-ended, and the released 1.4.2 wheel reproduced the identical payload, while POSIX hosts were unaffected and the two observation tests skipped on win32, which is why the defect survived. Closes #6640.

Goal And Delivered Outcome

  • Outcome basis / optional anchor: issue #6640 (public bug report with a smoke-based minimal reproduction at dda6f7ef7).

  • Goal/source and gap: loopx/control_plane/work_items/task_lease_workspace.ts derived the worktree-isolation host identity from ioreg IOPlatformUUID on darwin and /etc/machine-id on linux, leaving machine null on every other platform; observeLeaseWorktree then failed closed, so on native Windows every --write-worktree acquire rejected at the durable_writeback settlement step.

  • Observable before → after, with the validation row that proves it: uv run python examples/control_plane/task-lease-runtime-smoke.py aborted at its first worktree acquire with CalledProcessError and the exact payload quoted in #6640; with this head the same smoke exits rc=0 and prints task-lease-runtime-smoke ok, and tests/control_plane_ts/task_lease_workspace.test.ts goes from 5 pass / 3 skipped to 19 pass / 0 fail / 2 skipped on the same host (the observation test now runs; all 13 of its subtests pass). See the real_entrypoint and unit rows.

  • Issue/task and intended base: Closes #6640, intended base main at d3b7b141c.
  • Author Declaration

  • Written by: an autonomous OpenCode agent running DeepSeek V4.1 Flash (provider: opencode), operating from the JasonBuildAI/loopx fork at the request of and under the direction of the repository account owner.
  • Implemented against

  • Specification and revision: issue #6640 ("Expected behavior": add a Windows host-identity source with the same fail-closed semantics, narrow the platform skips, keep the platform sentence honest) at main dda6f7ef7; the same file's repository-identity codec was normalized in #5584, and the advisory workflow landed with #5364/#5587.

  • Criteria:
  • | Criterion (spec clause) | Disposition | Symbol / path | Test or command |
    | --- | --- | --- | --- |
    | Verified machine discovery has a Windows identity source | implemented | machineIdentity() win32 branch reading HKLM\SOFTWARE\Microsoft\Cryptography\MachineGuid through reg query | tests/control_plane_ts/task_lease_workspace.test.ts observation test (runs on win32 now) |
    | The documented --write-worktree acquire works on native Windows | implemented | observeLeaseWorktree | examples/control_plane/task-lease-runtime-smoke.py: rc=1 before → rc=0 after |
    | The existing fail-closed error is kept when no identity can be read | implemented | machineIdentity() default undefined; unchanged throw new LeaseWorktreeObservationError | branch unchanged by the diff; unsupported hosts still throw — no CI execution, same as before, see Coverage |
    | Platform skips narrow to the implemented identity sources | implemented | tests/control_plane_ts/task_lease_workspace.test.ts (win32 unskipped), two Python skip reasons corrected | TS 19 pass / 0 fail / 2 skipped; focused pytest 36 passed, 10 skipped (remaining skips are the Windows symlink fixture) |
    | The supported-host documentation matches the implementation | implemented | docs/reference/canonical-lease-renew.md | sentence now reads macOS, Linux and Windows in the verified machine discovery paragraph |
    | The suite runs on the windows-powershell lane so the source cannot silently regress | deferred (concrete successor step named below) | .github/workflows/python-tests.yml (lane step) | the lane mechanism is the in-flight #6639 (owned by another contributor); its current qualified-suite list does not yet include this file, so the remaining one-line addition of tests/control_plane_ts/task_lease_workspace.test.ts to the lane step stays a named follow-up. This PR deliberately does not touch the workflow to avoid conflicting with that in-flight change |

  • Self-check before submission: ran the smoke, the TypeScript suite, the focused Python lease tests, ruff, the control-plane typecheck and the repository premerge gate on this host before and after the change; read the diff for stray changes (none; a local untracked uv.lock was left uncommitted); deliberately left out the workflow change (owned by #6639) and the two Python symlink tests (unrelated fixture constraint).
  • Scope And Continuation

  • Completed scope and remaining work: the machineIdentity() extraction with the win32 source, the win32 test unskip, corrected Python skip reasons, and the lease-guide sentence. The two Python tests remain skipped on Windows because their fixture creates symlinks (needs Developer Mode or administrator rights) — a separate, pre-existing constraint now named in their skip reason.

  • Slice boundary / successor: complete within this scope; the issue's recommended lane step is the named remaining action — after the Windows lane mechanism lands (#6639), add this suite to the lane step, and until then the win32 branch is covered by local host runs plus the unskipped test. This PR does not modify the workflow (owned by the in-flight lane change). No follow-up issue is needed for the identity source itself.
  • Validation

  • Tested revision: c20493b7b41f1324b60af96b92893b838fcda7cc (rebased onto main d3b7b141c; this amended head differs from 0dd51f535, on which the gate measurements below were taken, only by a docs line rewrap, and all focused checks were re-run green at this head)

  • Run state: finished

  • Input classes: public_fixture (repository smokes and tests with synthetic fixtures; the registry value was read on the host but is not published)
  • | Check kind | Result | Public-safe evidence / limitation |
    | --- | --- | --- |
    | static | passed | ruff check on the two changed Python files → All checks passed!; tsc --project tsconfig.control-plane.json --noEmit → clean; git diff --check → clean |
    | unit | passed | node --experimental-strip-types --test tests/control_plane_ts/task_lease_workspace.test.ts → # tests 21 / # pass 19 / # fail 0 / # skipped 2 (observation test now executes on win32; 13/13 subtests pass); focused pytest on the four lease test files → 36 passed, 10 skipped |
    | real_entrypoint | passed | uv run python examples/control_plane/task-lease-runtime-smoke.py (drives the shipped CLI task-lease acquire/renew/release against the file and sqlite authority stores): aborted with CalledProcessError before → rc=0, task-lease-runtime-smoke ok after |
    | integration | failed | loopx canary premerge --from-git-diff --git-diff-base upstream/main (risk-based gate): direct checks 4/4 passed; catalog canaries 6 selected / 0 failed (1 advisory — a pre-existing ratchet finding in an unrelated turn-driver file, explicitly marked inherited baseline); risk-profile run 2 of 8 failed — both are the known Windows smoke-harness fixture-cleanup class (retained temp dir with read-only .git/objects, WinError 5) after the selected check itself printed catalog-canary-planner-smoke ok; the failing commands' sources are untouched by this diff and a parallel Windows contributor reproduced the same class at the merge base. Gate status is therefore failed and this PR is not self-merged |
    | unit | failed | pre-existing, disclosed: tests/control_plane/test_task_lease_argument_recovery.py → 28 failed, 12 passed on this host, every failure the same json.decoder.JSONDecodeError: Invalid \escape while loading a fixture whose $ROOT placeholder was substituted with a Windows path (fails before product code); tests/control_plane_ts/retained_lease_receipts.test.ts fails the same way inside its restore helper (Bad escaped character in JSON) — both unrelated to this diff |
    | regression_parity | passed | released 1.4.2 wheel (pre-fix artifact) driven from a disposable environment returned "error": "host identity unavailable for worktree isolation", error_code: invalid_worktree_lease_request — identical to the source-checkout baseline; the source-checkout smoke is green at this head. No rebuilt wheel was validated (packaging builds from main) |

  • Coverage and gaps: the changed surfaces are the identity helper, its call site, three test files and one doc sentence. The win32 branch is covered by the unskipped TypeScript observation test and the runtime smoke on a native Windows host; the linux source is also exercised by the ubuntu control-plane TypeScript lane through the sharded suite runner; the darwin/linux branches are unchanged line-for-line (ioreg / /etc/machine-id), and the fail-closed path is unchanged (not CI-executed on any platform, same as before; the win32 CI lane addition is the deferred row above). Disclosed host failures above all fail at fixture load or in the smoke harness on Windows before product code. No manual holds were recorded by the gate. A local untracked uv.lock was scanned by the boundary check and is not committed.
  • Frontend / Visual Evidence

  • UI impact: none

  • Before: N/A

  • After: N/A

  • States and viewports shown: N/A

  • Source data: none

  • Attention review: N/A — no user-visible surface changes; the CLI advisory, flag help and worktree guides already describe the capability, and this change makes them true on Windows.

  • Craft review: N/A
  • Type of Change

  • Bug fix
  • LoopX Area

  • Control plane (goals, todos, quota, scheduler, registry, runtime)
  • Technical Direction

  • Direction / acceptance reference, when applicable: N/A — bounded host-portability repair of the existing typed task-lease contract, aligned with the repository's native-Windows support work.
  • Shared-authority RFC fixture impact

  • Production-scale fixture schema: N/A

  • Semantic dimensions changed, or reviewed no-impact rationale: N/A — no typed vocabulary, state classification or protocol literal is introduced; the change reads one additional host identity source under the existing digest-only contract.

  • Provider conformance arms run: N/A

  • Read-only legacy/file/PostgreSQL three-arm rehearsal (required for promotion, runtime-routing, or compatibility-projection changes): N/A
  • Boundary Checklist

  • Neither the diff nor this PR body/comments/attachments disclose private state, credentials, raw traces or verifier output, internal links, or local machine paths.

  • I did not duplicate maintainer-owned benchmark work unless a maintainer split out a public issue for it.

  • I kept the change scoped to the linked issue/task.

  • I completed the visual evidence section for UI changes, or marked UI impact none.

  • Every commit includes a DCO Signed-off-by trailer (git commit -s).
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: JasonBuildAI Review duration: 127m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    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.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #6653"
    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: 52% (MEDIUM) · Higher = larger blast radius
    52%
    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: 20.5% · Safe to merge
    20.5%