Skip to content

fix: accept local admin-owned workflow allocator files - #11461

Merged
bolichen97 merged 1 commit into
mainfrom
fix/windows-workflow-allocator-owner
Sep 19, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/windows-workflow-allocator-owner

Conversation

@bolichen97

@bolichen97 bolichen97 commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Workflows fail to start on native Windows when Kiro Crew runs as administrator. The caller sees Workflow memory is unavailable, but startup fails while checking who owns the run-number files, before any agent starts.

Why it matters

A normal Windows file-creation policy blocks every workflow on these installations. Choosing another member name or retrying cannot fix it.

What changed (motivation → approach → change)

Windows can make the local Administrators group the owner of files created by an elevated process. The workflow allocator required the owner's SID to equal the user's SID, so it rejected its own files.

src/kiro_crew/workflow_memory.py accepts that group owner only on a confirmed local volume. The same group SID on a network share belongs to another machine and remains rejected. Unknown users, unreadable owners and other owners remain rejected. The existing file-identity checks and required owner-only DACL writes stay in place. Ownership is not rewritten.

Allocator owner Before After
Current user 🟦 Accepted 🟦 Accepted
Local Administrators group, local volume 🟥 Rejected 🟩 Accepted
Administrators group, remote or unknown volume 🟦 Rejected 🟦 Rejected
Other owner or unknown current user 🟦 Rejected 🟦 Rejected
Failed required permission lockdown 🟦 Rejected 🟦 Rejected

🟩 added · 🟥 removed · 🟦 unchanged

docs/system-specs/modules/workflows.md records this narrow rule. This does not change member memory provisioning, member bindings, or fall back to Global V1.

Tests

test/test_workflows_run_identity.py covers the owner/volume matrix, unreadable descriptors, unchanged POSIX ownership, and failure to tighten directory/lock/counter permissions without advancing the counter. Its native Windows test uses the real ACL writer and verifies all four objects retain their owner and receive protected owner-only permissions.

The new owner and native-allocation checks fail on the old implementation. On the current base (1c7f9637), test/test_workflows_run_identity.py passes 61 tests; its 3 test_simultaneous_services_never_share_run_identity cases error at setup on this Windows host with Private memory requires canonical member admission, identically on a clean origin/main checkout, from the test_workflows_private_execution.py world fixture, outside the allocator path. test_memv2_audit_d_workflows.py::test_global_parent_still_runs_when_private_members_exist, which fails on main on an administrator-owned host with Workflow allocator owner is invalid, passes all 14 cases on this branch.

isort, flake8, black and mypy pass on the changed files. Full suites and non-Windows native execution remain for CI.

Manual verification

The original thread-allocation test reproduced the owner rejection on this native Windows administrator account. The native regression reads real security descriptors, allocates consecutive IDs and verifies the protected DACLs. Existing tests exercise separate real Windows processes, delayed lock creation, durable counters and crash recovery. No online configuration, private memory or credential contents were read or changed for these checks.

Related Issues

no linked issue: reported directly while preparing native Windows Memory V2 support; this PR fixes only the workflow startup prerequisite.

Pattern harvest

Not generalizable: owner SID equality is not a universal Windows ownership rule. This allocator permits only the specific local group used for elevated file creation; private execution and other trust boundaries retain their own rules.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@bolichen97
bolichen97 requested review from a team and krishdhasmana September 17, 2026 05:15
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 17, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Intent: Restore workflow startup on native Windows when elevated creation gives allocator files the local Administrators group owner, while retaining mandatory ownership, local-volume, DACL and run-identity checks.
Not a goal: Enable native Windows private Memory V2, change member bindings, fall back to Global V1, rewrite filesystem ownership, or change the host security policy.

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 4b1264f3096a8352263c24bca4a9c50dcd5393c7 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 4b1264f

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 4b1264f3096a8352263c24bca4a9c50dcd5393c7: <one-sentence reason>

@bolichen97

Copy link
Copy Markdown
Contributor Author

Local verification on bd48496:

  • Native Windows elevated-creation failure reproduced before the change; the owner matrix and native allocator regressions failed on the old code.
  • All 68 allocator tests pass serially, including real protected DACL verification and unchanged owner identity. Existing tests exercise independent Windows allocators, lock/witness integrity and crash recovery.
  • Complete selected backend set: 48 files, four workers, 1394 passed / 49 skipped / exit 0. The first helper had malformed PYTEST_ADDOPTS path escaping; the entire related set was rerun with a correct isolated path, not just its failed cases.
  • All 51 resolved local Prepare PR gates pass; the source was also reviewed through both extracted CI-contract local lanes, with no findings on this exact commit.
  • No full local suite, non-Windows native execution, or Windows private Memory V2 support is claimed. Remote CI and required human review remain authoritative.

The prerequisite patch is intentionally separate from the requested native Windows Memory V2 implementation.

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 4b1264f3096a8352263c24bca4a9c50dcd5393c7 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Confirm CI's Windows lane actually executes the new skipif-gated native ACL test rather than silently skipping it.

[DESIGN-REVIEWED] 4b1264f

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 4b1264f3096a8352263c24bca4a9c50dcd5393c7 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Verify the native Windows test ran elevated and non-elevated: with ownership loosened, the owner-only DACL lockdown alone now fences the counter from other admins.

What this change ships

Inventory (6 items) — 6 justified

Intent: FIX — workflows refuse to start on elevated native Windows because the allocator rejects its own Administrators-owned run-number files.

  1. Workflows now start when allocator files are owned by local Administrators on a local volume — justified
  2. The same Administrators owner on a remote or unknown volume stays refused — justified
  3. Spec paragraph in workflows.md recording the rule, same commit — justified
  4. Owner/volume test matrix expanded; unreadable-owner and POSIX exact-UID behaviour pinned — justified
  5. Native Windows regression reading real security descriptors and DACLs — justified
  6. Lockdown-failure test proving the counter never advances when tightening fails — justified

Defect provenance: the new ("current", "S-1-5-32-544", True, True) case fails on base. Sibling count: grep \.owner_sid in src/ finds one other owner policy, github_runner.py:304/311, which already trusts S-1-5-32-544 behind its own volume_is_local gate — zero unfixed siblings, and that broader trusted-set mechanism (includes S-1-5-18, TrustedInstaller) is deliberately not reused: the allocator refuses SYSTEM, pinned in the new matrix. No new config key, flag, or public symbol; no deleted pin — the old test never covered the Administrators owner.

[FIRST-PRINCIPLES-REVIEWED] 4b1264f

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed 4b1264f3096a8352263c24bca4a9c50dcd5393c7 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 4b1264f

Verdict parsed from the review's SHA-scoped output markers for commit 4b1264f3096a8352263c24bca4a9c50dcd5393c7.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 4b1264f3096a8352263c24bca4a9c50dcd5393c7: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 17, 2026
@bolichen97
bolichen97 enabled auto-merge (squash) September 18, 2026 17:31
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 19, 2026
@bolichen97
bolichen97 force-pushed the fix/windows-workflow-allocator-owner branch from bd48496 to e6bd6e3 Compare September 19, 2026 21:02
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Sep 19, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased onto main 1c7f963 (previous head bd48496 conflicted in docs/system-specs/modules/workflows.md after the Memory V2 simplification). The allocator patch is unchanged; the doc paragraph now sits on the rewritten section. CI re-running on e6bd6e3.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 19, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

CI triage on head e6bd6e3: all 10 red jobs (Backend Tests shards 1/5/6/8 on Linux and Windows, Coverage Gate, Real Adapter Contract Tests) are inherited from main. main's own push run 35469148028 at 39892f5 (the #12091 revert) fails the same 10 jobs, and the failing node ids match exactly per shard: shard 1 test_subagent_continuable.py (60), shard 5 test_spawn_reasoning_effort.py (7 errors), shard 6 test_real_adapter_gate.py (1), shard 8 test_acp_capability_sets_leaf.py::test_membership_is_unchanged_by_the_move (1). None touch this PR's 3 files. Holding the re-sync until main is green; rebasing onto a red main would only reproduce the same set.

Elevated Windows processes create allocator objects with the local Administrators group as owner. Accept that owner only on a confirmed local volume, while retaining the current-user requirement and fail-loud DACL lockdown. Preserve private execution and binding checks.
@bolichen97
bolichen97 force-pushed the fix/windows-workflow-allocator-owner branch from e6bd6e3 to 4b1264f Compare September 19, 2026 21:38
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased onto main 891e6de (after #12088 restored the shard-1/8 tests). Head e6bd6e3 -> 4b1264f; patch-id identical, still 3 files. Local on the rebased head: test/test_workflows_run_identity.py 64 passed (the 3 inherited setup errors are gone on new main); isort/flake8/black/mypy clean on the changed files.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 19, 2026
@bolichen97
bolichen97 merged commit 080c481 into main Sep 19, 2026
87 checks passed
@bolichen97
bolichen97 deleted the fix/windows-workflow-allocator-owner branch September 19, 2026 22:28
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 19, 2026
amadsalmon pushed a commit to amadsalmon/KiroCrew that referenced this pull request Sep 22, 2026
)

Elevated Windows processes create allocator objects with the local Administrators group as owner. Accept that owner only on a confirmed local volume, while retaining the current-user requirement and fail-loud DACL lockdown. Preserve private execution and binding checks.
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.

2 participants