Skip to content

fix(pod): show only the current start's log in a Windows boot failure - #21729

Merged
iamwhatever merged 1 commit into
mainfrom
fix/21571-pod-stale-fatal
Oct 18, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/21571-pod-stale-fatal

Conversation

@bolichen97

@bolichen97 bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: When a Windows pod up fails, its report shows only what this start wrote, never an earlier start's FATAL.

On Windows, a pod hard-killed before its supervisor claim (case C of #10998) is refused by pod up and pod down. That refusal is correct. But the journal tail printed above it carried FATAL: no built dist from an earlier failed start. It reads like the cause of this refusal, and it is not.

Why it matters

A Windows operator reading that report fixes a dist that is already fine, instead of following the manual retirement the refusal points to.

Not a goal

What changed (motivation → approach → change)

Symptom: the failure tail of pod up shows a FATAL line from a previous boot.
Root cause: the Task Scheduler .cmd wrapper appends (>>) every boot to the same pod.out.log / pod.err.log, and recent_journal tails the whole file.
Change: pod up records both files' sizes (journal_mark) right before start_pod. On failure it reads only bytes written after that mark (recent_journal(..., since=mark)). A start that wrote nothing says so and points to kirocrew pod logs. A log that shrank since the mark is read whole. Without a mark (an already-running pod, other platforms) the tail is read exactly as before. Files: src/kiro_crew/pod/windows.py (journal_mark, since), src/kiro_crew/pod/runtime.py (dispatch), src/kiro_crew/pod/cli.py (mark before start_pod), src/kiro_crew/pod/README.md (one note).

Backwards compatibility

Compatible: since is an optional argument; every existing caller and non-Windows path reads the same tail as before.

Removes nothing: no log, file, key or function is removed; earlier output stays on disk and in pod logs.

Tests

  • test/test_pod_windows.py: test_journal_since_mark_leaves_out_an_earlier_starts_fatal (with a negative control: the same files read without a mark still show the stale FATAL), test_journal_since_mark_keeps_this_starts_fatal, test_journal_mark_of_absent_logs_reads_a_first_start_whole, test_journal_since_mark_reads_a_replaced_file_whole, test_runtime_threads_the_journal_mark_to_the_windows_backend, test_journal_mark_is_none_off_win32.
  • test/test_pod_health_wait.py: test_failure_journal_is_read_from_this_starts_mark (mark taken before start_pod and passed to the tail read), test_failure_journal_of_a_running_pod_is_the_whole_tail.
  • Existing stubs of recent_journal in test/test_pod.py, test/test_pod_launchd.py, test/test_pod_health_wait.py and test/test_pod_windows.py accept the new since keyword: callers always pass it (None means the whole tail).
  • Red/green: with only the test files applied on the parent 6ed866fdfa, the 8 new tests fail; with the fix they pass. They use only tmp_path files and monkeypatched stubs: no clock, no sleep, no shared state.

Manual verification

Native Windows Server 2025 (build 26100), Python 3.12.10, isolated pod plane (own KIROCREW_HOME, pod root, env dir, task prefix, base port), on the same diff over 8c4a3d9bce (the pod files are unchanged between that and this base):

Case Before After
C: wrapper hard-killed before the claim, after an earlier dist-missing boot tail shows the earlier FATAL: no built dist no pod log from this start ... Earlier starts' output is in kirocrew pod logs; refusal text unchanged
B: dist removed right after the reservation FATAL: no built dist shown still shown (it is this start's); retire, restore, up health=200, down zero residue

The test task, its folder and the plane were removed afterwards.

Related Issues

Closes #21571
Related: #10998, #21580 (alternative approach: deletes both logs before each start)

Pattern harvest

Rule candidate: review-prompt
Pattern: a failure report that tails an append-only log must bound the read to the current attempt (offset, run id or timestamp), or an earlier run's error reads as this run's cause.

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 02:50
@bolichen97
bolichen97 requested a review from buluoray October 18, 2026 02:50
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 5c9204e8b569e08b573a868520d4d68871bdcb8e 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 5c9204e8b569e08b573a868520d4d68871bdcb8e — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] 5c9204e

Description read

[DESCRIPTION-READ] 85df9ae3a5a6aa0bb54f6488a68c8cefc4bc2c1fa572a920ef2d984f1afbf684

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 5c9204e8b569e08b573a868520d4d68871bdcb8e — 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

Check that #21731 covers the macOS launchd.recent_journal tail too: it still reads its log files whole, and this PR leaves it untouched on purpose.

What this change ships

Inventory (5 items) — 5 justified

Intent: when a Windows pod up fails, the operator sees only what this start wrote, so they are not sent to fix an earlier start's FATAL. This is a FIX (Closes #21571, with before/after reproduced on Windows Server 2025 and 8 tests that fail on the parent commit).

  1. A failed Windows pod up report leaves out lines from earlier starts that are still in the appended logs — justified
  2. A start that wrote nothing now says "no pod log from this start" and points to kirocrew pod logs — justified
  3. A log that shrank since the mark is read whole — justified
  4. Internal: journal_mark in runtime/windows, plus an optional since keyword on recent_journal. Each has one consumer (cli._up), and pod logs still gets the full tail — justified
  5. A pod README note on the append-plus-mark behaviour — justified

[FIRST-PRINCIPLES-REVIEWED] 5c9204e

Description read

[DESCRIPTION-READ] c5b467f20b19b62e2e36689415e424ebbcfd0b3aba40c9ec15e05bbae38f2540

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 5c9204e8b569e08b573a868520d4d68871bdcb8e — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 5c9204e

Verdict parsed from the review's SHA-scoped output markers for commit 5c9204e8b569e08b573a868520d4d68871bdcb8e.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 5c9204e8b569e08b573a868520d4d68871bdcb8e: <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 5c9204e8b569e08b573a868520d4d68871bdcb8e and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 5c9204e

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

The Task Scheduler wrapper appends every boot to the same pod.out.log and
pod.err.log. A failed pod up printed their tail, so a start that wrote nothing
(a hard kill before the claim) showed an earlier start's FATAL as its cause.

pod up now marks both files' size just before start_pod and reads only what
was written after that mark. Earlier output stays in pod logs. The refusal
itself is unchanged.

Closes #21571
@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
@bolichen97
bolichen97 force-pushed the fix/21571-pod-stale-fatal branch from 1d60793 to 5c9204e Compare October 18, 2026 03:06
@bolichen97

bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=79cf39154b4d Item 3: duplicate since-is-None branches

fixed in 5c9204e: both forks deleted; cli.py and runtime.recent_journal now make one call each with since=.
Existing test stubs of recent_journal were widened to accept the keyword instead.

@bolichen97

bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=b7ea14c1567c Item 1: launchd and journalctl siblings

accepted-and-deferred: #21571 and this PR's goal are the Windows failure report; the macOS and Linux tails need their own bound (byte mark for launchd, a start bound for journalctl) and their own tests.
Tracked in #21731 (deferred-finding, assignee bolichen97, Due: 2026-10-31). Needs a human to accept this deferral.

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

Copy link
Copy Markdown
Contributor Author

Deferral accepted by the operator (bolichen): First Principles Item 1 (span=b7ea14c1567c, launchd and journalctl siblings) is out of this PR's Windows scope and is tracked in #21731 (Due: 2026-10-31).

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

APPROVE at 5c9204e.

The fix targets the real cause: the Task Scheduler wrapper appends every boot to the same pod.out.log / pod.err.log, and the failure report tailed the whole file. pod up now records both sizes right before start_pod (cli.py#L610), and the failure tail reads only bytes past that mark (windows.py#L1278-L1340). An already-running pod, other platforms and pod logs keep the whole-file read. A shrunk file is read whole, and a start that wrote nothing points to kirocrew pod logs. The new Windows tests include a negative control, so they would catch the old behaviour.

The launchd and journalctl siblings are deferred to #21731. I checked that issue: it carries the deferred-finding label, an assignee and a due date, and it names both tasks. Every AI lane on this head is PASS or no findings. All checks on this head are green with nothing pending, and no review requests changes.

— crew-pr-reviewer (r110)

@iamwhatever
iamwhatever merged commit c3b65e8 into main Oct 18, 2026
106 checks passed
@iamwhatever
iamwhatever deleted the fix/21571-pod-stale-fatal branch October 18, 2026 05:30
@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 down/up refusal on Windows (no identity record) shows a stale FATAL line from the previous start

2 participants