Skip to content

fix(pod): stop the pod up wait when this start's boot refuses - #21831

Merged
bolichen97 merged 1 commit into
mainfrom
fix/pod-up-boot-refusal-21824
Oct 18, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/pod-up-boot-refusal-21824

Conversation

@bolichen97

@bolichen97 bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: When a pod's boot refuses, kirocrew pod up stops right away and prints the refusal's reason, instead of waiting out its budget and calling the pod "still starting".

On macOS, a boot that refuses (for example a symlink planted at the pod's os-home) records why in <name>.refused and exits 0, so launchd does not restart it. pod up then waited the whole 90s budget and said gateway still starting after 90s ... (process alive; ...), which is false: the boot had already quit. Found on a real Mac while verifying #21793.

Why it matters

Anyone whose pod refuses to boot on macOS waits 90s for nothing and is told to raise the wait budget, which can never help. On Linux and Windows the wait already stops early, but the message blames "the worktree build", which is also not the cause.

Not a goal

  • Changing what a boot refuses, or how it records the refusal.
  • Changing how launchd or systemd report unit state.
  • Any other pod up verdict.

What changed (motivation → approach → change)

pod up waited 90s after a macOS boot refusal and blamed a slow boot. The wait in src/kiro_crew/pod/cli.py only looked at the port and the unit state, and a refusal that exits 0 leaves the unit looking clean. The note the boot writes was never read.

pod up now records the refusal note's identity (inode, mtime, size, via lstat) just before it starts the pod. While waiting, a note that exists and differs from that record means this start refused, so the wait ends at once with a new HEALTH_BOOT_REFUSED verdict. An earlier boot's note, a note a later boot cleared, or a pod this command did not start never trigger it. pod up then prints the pod's boot refused and exited: <recorded reason>, read before any teardown, plus a line pointing at kirocrew pod ls, which shows the same note. It records the failure in the audit log as boot refused, like the other pod up failure verdicts.

Backwards compatibility

Compatible: the wait gains an optional refusal_mark argument that defaults to the old behaviour, and the new verdict only fires on a refusal note this start wrote.

Removes nothing: no path, key, record or verdict is taken away; one verdict is added.

Tests

In test/test_pod_health_wait.py:

Test Locks in
test_a_refusal_written_during_the_wait_ends_it_early a note written mid-wait ends it on that poll, with the unit reading inactive like launchd after an exit 0
test_an_earlier_boots_note_does_not_end_the_wait a note present before the start is not this start's refusal
test_a_note_this_boot_cleared_is_not_a_refusal a note that disappears is not a refusal
test_without_a_mark_the_note_is_never_read a pod this command did not start is never judged by its note
test_the_refused_sentinel_collides_with_no_sibling the new verdict shares no value with the other wait verdicts
test_a_refused_boot_reports_its_recorded_reason pod up prints the reason, not "still starting" or "worktree build", and still stops the unit it started
test_up_stamps_the_refusal_note_before_the_start the record is taken before start_pod and reaches the wait

Red on the parent: with the new check in the wait disabled, test_a_refusal_written_during_the_wait_ends_it_early fails. Determinism: the 7 new tests passed 10 repeated runs, a reversed order and a parallel run (-n 4). They use the wait's private ManualClock and a temp HOME.

Manual verification

N/A for this head: the bug was reproduced on a real Mac (forced refusal via a symlinked pod os-home, recorded on #21793), and unit tests cover the wait and the verdict on every backend. A re-run on a Mac after merge would confirm pod up now exits within a second of the refusal.

Related Issues

Closes #21824

Pattern harvest

Rule candidate: review-prompt
Pattern: a wait loop that infers failure only from a supervisor's state misses a child that records its failure in a side file and exits 0

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

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners October 18, 2026 09:15
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 48f107899fad861de2576faf024e78c943ac7c6a touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 18, 2026
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Before merge, check that pinned_fs.write_file_pinned replaces the note atomically. A new inode is what lets a repeated identical refusal differ from the stamp taken before the start.

[DESIGN-REVIEWED] 48f1078

Description read

[DESCRIPTION-READ] f6a2337ee3fe36591931e042ecb9b557150fe278ce607330d817ab8fd2e99360

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 Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 48f107899fad861de2576faf024e78c943ac7c6a — 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

Before merge, confirm on a real Mac that a forced os-home symlink refusal makes pod up exit within one poll; only unit tests cover that path on this head.

Not justified as shipped

  • Item 4 — undeclared: the _audit(... error="boot refused") record is not mentioned in the description. It is harmless: it follows the existing failure-audit pattern.
  • Item 5 — undeclared: the hint line "The same note is shown by kirocrew pod ls" is not mentioned in the description. It is harmless: it points at an existing reader (cli.py:1150).

What this change ships

Inventory (6 items) — 4 justified

Intent: when a pod's boot refuses, pod up should stop right away and say why, not wait out its budget. FIX (Closes #21824; the test this PR adds fails on base).

  1. On macOS, pod up stops at the first poll after this start's boot writes a refusal note, not after 90s — justified
  2. pod up prints the boot's recorded refusal reason instead of "still starting" or "worktree build" — justified
  3. On Linux and Windows, the refusal verdict now comes before the generic crash verdict — justified
  4. A failed pod up writes a new audit error, "boot refused" — undeclared, harmless rider
  5. The failure message adds a pointer to kirocrew pod ls — undeclared, harmless rider
  6. A note from an earlier boot, or one a later boot cleared, never ends the wait; this relies on the pre-start lstat stamp — justified

[FIRST-PRINCIPLES-REVIEWED] 48f1078

Description read

[DESCRIPTION-READ] dc88041035b2224c76b230b33b33d0989313401df013b626f69d1548d93fa4ae

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 added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 18, 2026
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 48f107899fad861de2576faf024e78c943ac7c6a — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 48f1078

Verdict parsed from the review's SHA-scoped output markers for commit 48f107899fad861de2576faf024e78c943ac7c6a.

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

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 48f107899fad861de2576faf024e78c943ac7c6a and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 48f1078

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

@bolichen97
bolichen97 force-pushed the fix/pod-up-boot-refusal-21824 branch from e62b000 to a3eb149 Compare October 18, 2026 09:22
@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 labels Oct 18, 2026
@bolichen97
bolichen97 force-pushed the fix/pod-up-boot-refusal-21824 branch from a3eb149 to 48f1078 Compare October 18, 2026 09:28
@bolichen97
bolichen97 enabled auto-merge (squash) October 18, 2026 09:35
@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 Oct 18, 2026
@bolichen97

bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=5a761f4d9654 Undeclared audit record error="boot refused"

fixed (description): the PR body now names the audit record; the code is unchanged and follows the existing pod up failure-audit pattern.
Punchline (atomic replace): verified. pinned_fs.write_file_pinned publishes through atomic_write_at (temp file plus rename on the pinned directory), so every refusal write gets a new inode and differs from the pre-start stamp even when the reason text is identical.

@bolichen97

bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=3cfe4bd452c8 Undeclared hint line pointing at kirocrew pod ls

fixed (description): the PR body now names the hint; it points at the existing refusal reader in kirocrew pod ls.

@bolichen97

bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=5a761f4d9654 Undeclared audit record error="boot refused"

fixed (description): the PR body now names the audit record; the code is unchanged and follows the existing pod up failure-audit pattern.
Punchline (real-Mac run): the bug itself was reproduced on a real Mac with exactly this forced os-home symlink refusal (recorded on #21793). Confirming the fixed head on a Mac is handed to the operator, who runs macOS checks on his own machine; the result will be posted here.

@bolichen97

bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=3cfe4bd452c8 Undeclared hint line pointing at kirocrew pod ls

fixed (description): the PR body now names the hint; it points at the existing refusal reader in kirocrew pod ls.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision readiness: action required A blocking check or review needs attention labels Oct 18, 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.

Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: pod up stops its health wait when the boot it started records a refusal, instead of running out the budget; tests cover stale and cleared notes.

@bolichen97
bolichen97 merged commit 7172b49 into main Oct 18, 2026
117 checks passed
@bolichen97
bolichen97 deleted the fix/pod-up-boot-refusal-21824 branch October 18, 2026 11:04
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 18, 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.

pod up waits out its 90s budget after a macOS boot refusal and reports it as still starting

2 participants