← Back to Pull requests

fix(canary): keep a passing smoke's verdict when a Windows fixture holds read-only git objects #6716

Closed
unknown closed this pull request without merging on Oct 18, 2026 05:27 UTC
View on GitHub
unknown unknown commented on Oct 17, 2026 05:06 UTC
Author

Goal And Delivered Outcome

  • Outcome basis / optional anchor: Closes #6710 — a reproduced defect with the raw before

  • evidence.

  • Goal/source and gap: on native Windows the canary smoke runner could not remove a

  • per-check fixture root that contained a git object store. Git marks every loose object and
    pack read-only, and Windows refuses to unlink a read-only file, so shutil.rmtree raised
    PermissionError [WinError 5]; the runner then recorded the check as failed although its
    command had exited 0
    , retained the tree, and put the cleanup error in the check's
    reason. The pre-merge gate this repository requires contributors to run
    (loopx canary premerge --from-git-diff) attaches the canary-runner risk profile to every
    control_plane path, so on Windows it reported a failure the diff did not cause for every
    control-plane diff, and the same host behaviour aborted the shipped issue-fix
    repo-branch-fixture command, two public reviewer smokes, and the documented pytest facade
    in tests/test_smoke_suite.py.

  • Observable before → after, with the validation row that proves it: the same single-check

  • invocation of the canary runner reported status: failed / ok: false / returncode: 0
    with reason fixture cleanup failed; retained <TEMP>\loopx-smoke-… before, and reports
    status: passed / ok: true / failure_count: 0 after. See the
    real_entrypoint and regression_parity rows below.

  • Issue/task and intended base: Closes #6710; intended base main.
  • Author Declaration

  • Written by: model_agent — an AI agent running in DeepSeek Harness (model

  • deepseek-v4.1-flash).

    AI disclosure: this change was drafted with AI assistance at my request, under my direction
    and review. I set the constraints (one host behaviour, both owners it reaches, no unrelated
    cleanup or refactor) and reviewed the diff, the failing-before evidence and the check output
    before submission.

    Implemented against

  • Specification and revision: no accepted RFC or protocol document covers smoke-fixture

  • teardown; the basis is the reproduced defect and its acceptance criteria in
    #6710, against base revision
    fdf03ec61.
  • Criteria:
  • | Criterion (spec clause) | Disposition | Symbol / path | Test or command |
    | --- | --- | --- | --- |
    | A check whose command exited 0 is reported as passed | implemented | loopx/canary/runner.py::_remove_fixture_root | tests/canary/test_smoke_fixture_cleanup.py::test_a_passing_check_survives_a_read_only_fixture_member; real_entrypoint row |
    | The owned fixture root is removed instead of retained | implemented | loopx/extensions/process_runtime.py::remove_owned_tree | same test asserts the reported root no longer exists |
    | Cleanup that cannot be confirmed still fails the check and retains the tree | implemented | loopx/canary/runner.py cleanup-error path | tests/canary/test_smoke_fixture_cleanup.py::test_the_runner_still_reports_cleanup_that_cannot_be_confirmed |
    | The issue-fix packet's temporary repository teardown no longer raises | implemented | loopx/capabilities/issue_fix/acceptance_loop.py::_remove_temporary_git_workspace | tests/capabilities/test_issue_fix_temporary_workspace.py; python examples/issue-fix-workflow-e2e-smoke.py |
    | POSIX deletion behaviour is unchanged | implemented | remove_owned_tree acts only on os.name == "nt" for attributes; a linked root is refused on every host | the new regression tests pass on POSIX with and without the fix; no POSIX-only path changed |
    | Teardown never changes permissions outside the owned tree | implemented | remove_owned_tree linked-root guard; _clear_windows_read_only_files skips linked directories | tests/extensions/test_process_runtime.py symlink and native-Windows junction no-mutation regressions |
    | A shared hard-linked object is never modified by teardown | implemented | _clear_windows_read_only_files leaves any file with st_nlink > 1 untouched and lets rmtree fail closed | tests/extensions/test_process_runtime.py hard-link regression; tests/canary/test_smoke_fixture_cleanup.py real-runner regression |
    | Public smokes that carried their own copy of the teardown use the shared owner | implemented | examples/issue-fix-reviewer-recommendation-smoke.py, examples/issue-fix-reviewer-request-smoke.py | loopx canary smoke-suite --suite full-public --script … sweep row |

  • Self-check before submission: read the changed call sites and the pre-merge classification

  • that attaches canary-runner to control-plane diffs; ran the real entrypoints before and
    after; confirmed the three remaining tests/canary failures and the four WinError 32
    smoke failures are present on the untouched base revision (evidence below) and deliberately
    left them out of scope.

  • Placement rationale for the new owner: remove_owned_tree sits in

  • loopx/extensions/process_runtime.py beside terminate_process_tree, the module that
    already owns teardown of an owned, previously isolated host resource and is imported by
    loopx/canary/runner.py, loopx/control_plane/runtime/validation_command.py,
    loopx/chat_agent.py and loopx/zcode_goal_mode/diagnostics.py. A new top-level module
    would spend part of the pinned top-level module budget (see #5685) for one stdlib-only
    function, and a home under loopx/canary/ would make a capability import the gate it is
    validated by.

    Scope And Continuation

  • Completed scope and remaining work: complete within this scope. Named items deliberately not

  • touched:

    - Four other control-plane smokes fail on native Windows with WinError 32 because a live
    helper still holds the directory; that is a different root cause and is already reported
    as #6642 (PR #6652).
    - loopx/capabilities/integration_branch/core.py removes a git worktree root with
    shutil.rmtree(..., ignore_errors=True), so on Windows it silently leaves the tree
    behind. It is a leak rather than a failure and no shipped gate reads it, so it is left
    for a separate change.
    - examples/issue-fix-reviewer-request-smoke.py has an unrelated pre-existing Windows
    failure (trusted_clock["secondary_notification_status"]); this PR only stops the
    teardown error from masking it.
    - Other pre-existing native-Windows smoke failures (bash-dependent installer checks,
    unprivileged symlink creation, extension doctor readiness, loopx-update-smoke) remain
    and are outside this defect.

  • Slice boundary / successor: N/A — the reproduced defect is closed; the remaining items above

  • have their own owner or are named as separate work.

  • Independent review, and what it changed: an independent adversarial review of revision

  • 97756955e (value, scope, logic and edge cases, abstraction, test sufficiency, check
    plausibility) returned APPROVE WITH NOTES and reproduced the before/after verdict, the two
    smoke entrypoints, the facade and the pre-existing failures on the untouched base. Its two
    findings are fixed here: (1) the three regression suites ran on no hosted Windows lane, so
    the guard was inert where the bug reproduces — .github/workflows/python-tests.yml now
    qualifies them on windows-latest; (2) one canary test monkeypatched a symbol this PR
    introduces and therefore tested nothing pre-fix — it is now a fail-closed contract test over
    the teardown seam (remove_owned_tree), and the tautological shutil.rmtree mock test was
    dropped. The reviewer's residual nits are deliberately not applied: the pre-existing
    ten-attempt loops in the two example smokes and the five-attempt loop in the issue-fix
    teardown keep their transient-race handling, and each attempt now re-walks the tree, which is
    bounded by the size of the owned fixture.

  • Second independent review, and what it changed: a review of d1062324c returned

  • CHANGES_REQUESTED with one P2 — os.walk starts at a root that is itself a directory symlink
    or Windows junction, so the Windows attribute pass cleared read-only bits in the link target
    before shutil.rmtree refused the link (base/head counterfactual through the real runner:
    target file 0444 throughout on base versus 0444 → 0666 on head). Fixed at this head:
    remove_owned_tree refuses a linked or junction root before any attribute change, and the
    Windows walk now prunes linked directories so a nested junction is not rewritten either. New
    regressions cover a directory symlink and a native Windows junction and assert the external
    file keeps both its bytes and its read-only attribute. The reviewer's native-Windows and
    junction qualification limits are addressed for junction roots by running that regression on
    the shipped windows-powershell lane; a directory-symlink case still skips on hosts without
    symlink privilege, where the junction case is the discriminator.

  • Third independent review, and what it changed: a review of 5c7f2d9c1 returned

  • CHANGES_REQUESTED with one P2 — a normal local git clone hard-links loose objects, so the
    clone object and the source object are one file with one read-only attribute; the Windows
    attribute pass cleared that shared bit outside the fixture while teardown still reported
    success. Fixed at this head: _clear_windows_read_only_files leaves every file with
    st_nlink > 1 untouched, so shutil.rmtree fails closed and the caller retains the fixture
    instead of changing another owner's object. Regressions cover the helper with a hard-link
    fixture and the real canary runner (command exits 0, cleanup failure is reported, the fixture
    is retained, and the external object keeps 0444 and its bytes). Native-Windows
    counterfactual: the pre-fix helper returned success and moved the source object 0444 →
    0666; the fixed helper raises PermissionError and leaves it 0444. Disclosed tradeoff:
    a fixture that leaves read-only hard-linked objects behind now reports cleanup failure and is
    retained; that is the fail-closed boundary. The shipped issue-fix repository fixture creates
    its own objects with git init (link count 1), so its passing path is unchanged.

    Validation

  • Tested revision: 803c0e242 (base f9bdae675). Independent adversarial reviews were

  • performed at 97756955e, d1062324c and 5c7f2d9c1; every finding is fixed in this head and
    named under Scope And Continuation.
  • Run state: finished

  • Input classes: synthetic, public_fixture
  • | Check kind | Result | Public-safe evidence / limitation |
    | --- | --- | --- |
    | static | passed | python -m ruff check over every touched file: All checks passed!. scripts/generate_semantic_inventory.py --changed-from HEAD: no supported new vocabulary carriers (the change introduces no enum, literal or closed set). |
    | unit | passed | tests/canary/test_smoke_fixture_cleanup.py 3 passed; tests/capabilities/test_issue_fix_temporary_workspace.py 1 passed; tests/extensions/test_process_runtime.py 9 passed / 27 skipped (the 26 existing POSIX-only process-group regressions plus the directory-symlink case, which needs symlink privilege on this host; the native junction and hard-link cases run and pass here). |
    | regression_parity | passed | A hard link to a read-only object outside the fixture, run through the real remove_owned_tree on native Windows: pre-fix the call returned success and the source object went 0444 → 0666; at this head the call raises PermissionError, the source object stays 0444 with its bytes unchanged, and the fixture is retained. test_remove_owned_tree_never_clears_a_shared_hard_link_attribute fails on the pre-fix helper and passes here; test_a_shared_hard_link_is_not_rewritten_outside_the_fixture pins the same input through run_canary_smoke_check (returncode 0, ok: false, cleanup reason, retained root). |
    | regression_parity | passed | A root junction to a directory holding a read-only .git/objects-shaped file, run through the real remove_owned_tree on native Windows: pre-fix the file went 0444 → 0666 and the helper then raised Cannot call rmtree on a symbolic link; at this head the same call raises refusing to remove linked tree root before the walk and the file stays 0444 with its bytes unchanged. test_remove_owned_tree_refuses_a_junction_root_without_touching_its_target therefore fails on the pre-fix helper and passes here; the symlink case pins the same contract cross-host. |
    | regression_parity | passed | Substituting a plain shutil.rmtree at the two call sites (the pre-fix behaviour) on native Windows makes test_a_passing_check_survives_a_read_only_fixture_member and test_temporary_git_workspace_teardown_removes_read_only_objects fail with PermissionError [WinError 5] on a .git/objects path, and makes the pytest-facade check fail with assert False is True. With the owner they pass. On POSIX the same tests pass either way, because unlink ignores the read-only bit there; the Windows host is the discriminator. |
    | real_entrypoint | passed | loopx canary smoke-suite --suite full-public --script examples/canary/catalog-planner-smoke.py: before status failed, ok false, returncode 0, reason fixture cleanup failed … [WinError 5] … .git\objects\…; after status passed, ok true, failure_count 0, stdout_tail catalog-canary-planner-smoke ok. |
    | real_entrypoint | passed | python examples/issue-fix-workflow-e2e-smoke.py: before PermissionError [WinError 5] from acceptance_loop._remove_temporary_git_workspace; after issue-fix-workflow-e2e-smoke: ok, exit 0. |
    | real_entrypoint | passed | python -m pytest tests/test_smoke_suite.py --loopx-smoke-script examples/canary/catalog-planner-smoke.py: before 1 failed / 1 passed with assert False is True; after 2 passed. |
    | integration | passed | Native Windows sweep of the 33 of 514 full-public checks that invoke a git object write (loopx canary smoke-suite --suite full-public --jobs 4): failures 20 → 18; checks whose failure mentioned read-only unlink 4 → 0; verdicts changed failure → pass: catalog-planner-smoke and issue-fix-reviewer-recommendation-smoke; no check changed pass → failure. Two checks (issue-fix-acceptance-loop-smoke, issue-fix-reviewer-request-smoke) stay failing for their own, unrelated assertion once the teardown error stops masking it. |
    | manual | failed | loopx canary premerge --from-git-diff --git-diff-base f9bdae675 on this 9-file diff: 6 direct checks 0 failures (diff hygiene, RFC bilingual, py_compile, module ceiling); risk_profile_run 8 executed / 0 failures; boundary_run 1 executed / 0 failures; catalog_run 8 of 10 passed. The two catalog failures are environment-bound and pre-existing on this host: cli-output-budget-regression-smoke exceeds the 120 s per-check budget (direct run: 202 s, then the known PermissionError [WinError 32] on a temp root held by a live helper, tracked by #6642 / PR #6652), and issue-fix-json-input-boundary-smoke hits a GBK console decode while capturing a UTF-8 child, unrelated to teardown. Aggregate ok: false for those two; neither touches code changed here. The before run (fix absent, scratch control-plane diff) failed the same section with 3 failures, one of which was catalog-planner-smoke reporting returncode 0 as failed with the read-only reason. |
    | static | passed | python -m mypy --platform linux: Success: no issues found in 17 source files (the Windows junction attribute is read with getattr, so the cross-platform stat_result type is not widened). ruff check over every touched file: All checks passed!; the semantic inventory advisory reports no supported new vocabulary carriers. .github/workflows/python-tests.yml adds one windows-powershell step that runs the three regression files on windows-latest, and scripts/ci/test_windows_lane_coverage.py still passes (2 passed, 12 subtests). Without that step the new suites pass trivially on Ubuntu and never run on the host where the defect reproduces. |
    | unit | failed | tests/canary on this Windows host: 3 pre-existing failures (test_example_symlink_cannot_escape_selected_checkout, test_telemetry_isolation.py::test_update_smoke_minimal_environment_keeps_opt_out, test_telemetry_isolation.py::test_smokes_isolate_routes_and_home_in_serial_and_parallel). Proof they are not from this diff: the same 3 tests fail the same way on the untouched base revision fdf03ec61 in a clean worktree (unprivileged symlink creation, a POSIX-HOME assumption in Path.home(), and the unrelated loopx-update-smoke plan assertion). |

  • Coverage and gaps: the changed lines are covered by both owners' regression tests plus real

  • entrypoint runs on the host where the defect reproduces. Not covered by construction: none of
    the read-only-member tests can discriminate on POSIX, where unlink ignores the read-only bit,
    so the native-Windows lane is the discriminator and this PR adds the three suites to its
    qualification step. The linked-root guard is covered on POSIX by the directory-symlink case,
    and discriminatingly on Windows by the junction case, which needs no symlink privilege. The
    shared-hard-link guard is covered twice: the helper-level hard-link regression and the
    real-runner case, both asserting the external object keeps 0444 and its bytes. Its
    limitation is deliberate: a fixture that retains read-only hard-linked objects fails closed and
    is kept rather than silently rewriting the source. CI on head 5c7f2d9c1 passed
    kernel-static-checks (including mypy), windows-powershell, typescript-core,
    dashboard-browser, stage2c, both build jobs and the other lanes; its test-shard jobs
    were still pending when this head replaced it, and they are rerunning here. The earlier
    d1062324c shard failures were tests/architecture/test_top_level_module_budget.py (a
    main-side budget mismatch: loopx/workflow_skill_install.py is the 146th top-level module
    while the pinned budget is 145, which reproduces on this head without any diff in that path)
    plus two assertions in tests/test_managed_effect_runtime_fixture.py and
    tests/presentation/test_codex_attached_conversation.py that pass locally on this head and
    live in files this diff does not change. This head is rebased onto f9bdae675, so CI reruns
    on the exact requested head.

    Frontend / Visual Evidence

  • UI impact: none — no dashboard, website, desktop, documentation chrome or other user-visible

  • surface changed.
  • Before: N/A

  • After: N/A

  • States and viewports shown: N/A

  • Source data: none

  • Attention review: N/A — no viewport changed.

  • Craft review: N/A — no showcase surface changed.
  • Type of Change

  • Bug fix

  • New feature

  • Breaking change

  • Refactoring (no functional changes)

  • Documentation update

  • Test update
  • LoopX Area

  • Build, packaging, installer, or CI

  • Benchmark boundary (adapters, runners, verifiers, scoring, evidence)

  • Capability or extension (providers, adapters, skills)

  • Public docs or presentation surface (README, protocols, dashboard)

  • Host or runtime integration
  • Primary area: Build, packaging, installer, or CI (the canary pre-merge/smoke-suite gate); the
    shared teardown owner and the issue-fix call site are why Host or runtime integration is also
    marked.

    Technical Direction

  • Direction / acceptance reference, when applicable: N/A — self-contained reproduced defect;

  • no roadmap S/G/R, milestone card or RFC section is claimed.

    Shared-authority RFC fixture impact

  • Production-scale fixture schema: N/A — no TypeScript control-plane or shared Goal Authority

  • contract is touched.
  • Semantic dimensions changed, or reviewed no-impact rationale: N/A.

  • Provider conformance arms run: N/A.

  • Read-only legacy/file/PostgreSQL three-arm rehearsal: 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 (including .loopx/, .codex/goals/, and live ACTIVE_GOAL_STATE.md). Absolute host paths in the quoted evidence are shown as <TEMP>.

  • 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.

  • Existing English/Chinese RFC pairs (including ledger entries) both have a diff, and the local premerge check python3 scripts/check_rfc_bilingual.py --base origin/main --head HEAD passes, or no paired RFC changed.

  • 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: 1461m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)). 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%
    56%
    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 #6716"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 22.5% · Safe to merge
    22.5%