Skip to content

fix(pod): count a booting Windows pod in active_names - #32143

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/active-names-boot-27861
Nov 7, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/active-names-boot-27861

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: On Windows, a pod whose boot is still in progress counts as active in active_names, so worktree removal refuses to delete a checkout that boot is using.

#30971 made a Windows pod read as active in unit_state while its boot's producer process is alive, before any gateway pid exists. Worktree removal reads unit_state only when the pod backend is absent. When the backend works, Remove and Prune check active_names, and on Windows that lists only pods with a gateway pid record. A boot that has not spawned its gateway yet has only a run record, so it was invisible there.

Why it matters

Between the moment a boot claims its run and the moment its gateway pid is recorded, the boot validates the checkout and seeds HOME. A Remove in that window found no active pod and could delete the checkout under the boot.

Not a goal

  • Any change to how unit_state reads a boot, or to the Linux and macOS backends.
  • The second removal recheck's absent-backend branch.

What changed (motivation → approach → change)

active_names in pod/windows.py now enumerates the plane's run records (.winrun) as well as its pid records (.winpid). A name counts when its boot is in progress or its gateway pid is live: the same answer unit_state gives, through the same helper. An unreadable run record counts as a boot in progress, because the answer guards a deletion.

Backwards compatibility

Compatible: a pod with a live gateway is listed exactly as before. A Windows pod whose boot is in progress is now listed too, so while it boots, Dev Fleet shows it running, pod ls lists it, the checkout pin guard refuses it, and its HOME is not listed as an orphan. A malformed run record keeps its name listed until the record is removed.

Tests

  • test/test_pod_windows.py::test_active_names_counts_a_boot_before_its_gateway_pid: a pod with only a preparing run record and a live producer is listed, and is not once the producer is gone.
  • Determinism: 20 of 20 runs at -n0, and test_pod_windows.py passed in a shuffled order (68 passed, 2 skipped).

Proof: PROVEN test/test_pod_windows.py::test_active_names_counts_a_boot_before_its_gateway_pid (head 0cd3b3d)

Manual verification

Still needed on a Windows host: start kirocrew pod up on a worktree, and while it boots, confirm Remove on that worktree refuses. Not run here (Linux host); the unit test covers the listing.

Screenshots / video

N/A — no frontend change.

Related Issues

Part of #27861

Sibling sweep

Swept: git grep -n "def active_names" -- src/kiro_crew/pod/
Sibling: src/kiro_crew/pod/launchd.py -- not changed here -- it lists a label whose process is live, and on macOS the boot runs as that job's process; not verified on a Mac.
Sibling: src/kiro_crew/pod/runtime.py -- not affected -- it dispatches to the per-platform function changed here on Windows.

Pattern harvest

Not generalizable: one Windows listing that read only the gateway pid record, while the boot record it already maintains marks the earlier phase; there is no repeatable code shape to lint for.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|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

Contribution License Agreement

Contributed under the project's Apache-2.0 license.

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 7, 2026 06:23
@bolichen97
bolichen97 enabled auto-merge (squash) November 7, 2026 06:23
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 0cd3b3d4d7e4bb15d5b5fd2483e3804e02924adc touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 0cd3b3d4d7e4bb15d5b5fd2483e3804e02924adc — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks. active_names now calls the same _boot_in_progress helper as unit_state, so the listing removal reads agrees with the per-pod state. The listing only grows, and a record it cannot read errs toward refusing a deletion.

Notes

  • If a run record is malformed and stays stuck, the pod shows as active everywhere that reads this listing (pod ls, Dev Fleet, the orphan-HOME sweep) until someone deletes the record. Add that recovery step to the pod README's .winrun recovery steps.

[DESIGN-REVIEWED] 0cd3b3d

Description read

[DESCRIPTION-READ] d7699f0e201835cb6bf9df918410c3d4a36ac665d3ed3a16ccb96e37f0efcf34

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 0cd3b3d4d7e4bb15d5b5fd2483e3804e02924adc — 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 does not.

First-Principles-Verdict: PASS

The fix works at the mechanism level and reuses the existing _boot_in_progress helper. The only other effects are listing side effects, and the description declares them.

Not checked: whether Remove refuses on a real Windows host while a pod is booting (the author also lists this as still needed).

What this change ships

Inventory (5 items) — 5 justified

Intent: on Windows, stop Remove or Prune from deleting a worktree checkout while a pod is still booting from it. This is a FIX.

  1. Remove and Prune now refuse a worktree whose Windows pod has claimed its run but has no gateway pid yet. — justified
  2. Dev Fleet and pod ls show a booting Windows pod as running. — justified
  3. The checkout pin guard refuses a booting pod, and its HOME is no longer reported as an orphan. — justified
  4. A malformed or unreadable run record keeps its pod listed as active until the record is removed. — justified
  5. A new test: a pod with only a run record is listed while its producer is alive, and not after. — justified

[FIRST-PRINCIPLES-REVIEWED] 0cd3b3d

Description read

[DESCRIPTION-READ] d5e7b0afc3b9755ef2627e9eb77417fa754ebe93b012d52dc6af318b65d9263b

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 0cd3b3d4d7e4bb15d5b5fd2483e3804e02924adc — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 0cd3b3d

Verdict parsed from the review's SHA-scoped output markers for commit 0cd3b3d4d7e4bb15d5b5fd2483e3804e02924adc.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 0cd3b3d4d7e4bb15d5b5fd2483e3804e02924adc false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 0cd3b3d4d7e4bb15d5b5fd2483e3804e02924adc and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 0cd3b3d

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 0cd3b3d4d7e4bb15d5b5fd2483e3804e02924adc false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 7, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved for the on-call. Review lanes pass on 0cd3b3d, no conflict, no open change request.

@KiroCrewCaptain
KiroCrewCaptain merged commit 8d2e5e8 into main Nov 7, 2026
96 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/active-names-boot-27861 branch November 7, 2026 07:34
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 7, 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.

2 participants