Skip to content

fix(pod): bound the macOS and Linux boot failure tail to the current start - #21793

Merged
bolichen97 merged 1 commit into
mainfrom
fix/pod-journal-start-bound-21731
Oct 18, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/pod-journal-start-bound-21731

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A failed kirocrew pod up on macOS or Linux shows only this start's log, never an earlier start's FATAL, as the cause.

When pod up cannot get a pod healthy it prints the pod's log tail as the cause. On Windows that tail is already bounded to the current start. On macOS and Linux it is not:

  • macOS: launchd appends every boot to the plist's StandardOutPath / StandardErrorPath, and launchd.recent_journal tails the whole files.
  • Linux: journalctl --user -u <unit> -n <lines> returns the unit's earlier invocations too.

So a start that wrote nothing (or failed for a new reason) can print an earlier start's FATAL: no built dist as its cause.

Why it matters

A developer reads the printed FATAL and fixes the wrong thing: the line is from an earlier boot, not this one. The Windows fix closed this for one backend; the other two still mislead.

Not a goal

  • Changing what pod logs shows. It still prints the whole log, earlier starts included.
  • Changing when pod up fails, stops, or reclaims a pod. Only the text of the failure tail changes.
  • Any Windows behaviour change. The Windows backend now calls the shared helper; its output is unchanged.

What changed (motivation → approach → change)

Symptom: when kirocrew pod up fails on macOS or Linux, the log it prints as the cause includes lines from an earlier pod up of the same pod. Cause: runtime.journal_mark returned a mark only on Windows, so recent_journal(..., since=mark) had nothing to bound by elsewhere.

  • journal_mark now marks on every backend. macOS marks the two log files' byte sizes, like Windows. Linux marks the wall-clock time in microseconds.
  • recent_journal on macOS reads only bytes past the mark. A start that wrote nothing gets the same "no pod log from this start" line Windows prints.
  • On Linux the mark becomes journalctl --since=@<seconds>.<micro>. A mark without that key adds no bound.
  • The byte-offset mark and read moved into a small shared module, pod/log_mark.py, used by both file backends.
  • pod/README.md: one paragraph under the backend table covers all three backends; the Windows-only note it replaces is removed.

Backwards compatibility

Compatible: journal_mark returned None off Windows and now returns a dict; its only caller (pod up) passes it straight to recent_journal, which accepts both. pod logs calls recent_journal without a mark and is unchanged.

Removes nothing: no path, key, record or function is removed; only the failure tail is narrowed to this start.

Tests

  • test/test_pod_launchd.py: an earlier start's FATAL is left out (with a no-mark negative control), this start's FATAL is kept, absent logs mark at 0, and the runtime facade threads the mark through launchd.
  • test/test_pod_journal_since.py (new): journalctl is faked with a journal that honours --since=@<s>; an earlier start's FATAL is left out, this start's is kept, the exact --since argument is pinned, and a file-backend mark adds no bound.
  • test/test_pod_windows.py: the off-Windows journal_mark test now pins the systemd mark shape and that the Windows backend is not called.

Red/green: with the production files reset to origin/main, the 6 new macOS/Linux tests fail; with the fix all pass. Determinism (testing-conventions D12): the 13 mark tests pass 20/20 at -n0, the three files pass 10/10 at -n 4, and the 13 pass in a shuffled order. test/test_pod*.py related set: 750 passed.

Manual verification

On this Linux host (systemd 252), journalctl --user --since=@<epoch>.<micro> accepts the fractional form and returns only later entries. No real macOS run: launchd is faked, as in the rest of test_pod_launchd.py.

Related Issues

Closes #21731

Context: #21571 (Windows variant), fixed by #21729.

Pattern harvest

Not generalizable: the class (a tail of an append-only log read across runs) is already covered by one helper now shared by every pod backend; there is no other reader of these logs.

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 06:58
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

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

Design-Verdict: PASS

On Linux, the mark is the CLI's wall-clock time. If NTP steps the clock back between the mark and the pod's boot, this start's own lines are dropped from the failure tail.

[DESIGN-REVIEWED] 451839b

Description read

[DESCRIPTION-READ] f2e694f6fd09924bec6041d2c813f28af028a6e3c309f68f25104e63587974b3

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 451839beefa1aac5af70f06777ef4334f2def783 — 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

The macOS byte-offset bound was tested only against a faked launchd. Run one failed pod up on a real Mac before merging.

What this change ships

Inventory (6 items) — 6 justified

Intent: a developer whose pod up fails on macOS or Linux sees only this start's log as the cause, never an earlier start's FATAL. This is a FIX (#21731).

  1. On macOS, a failed pod up prints only log lines written by this start — justified
  2. On Linux, a failed pod up asks journalctl only for entries since this start (--since) — justified
  3. On macOS, a start that wrote nothing gets a new "no pod log from this start" message instead of the old tail — justified
  4. Marking a log's size and reading past that mark now live in one shared pod/log_mark.py, used by the launchd and Windows backends — justified
  5. The pod README's Windows-only note becomes one paragraph covering all three backends — justified
  6. The off-Windows journal_mark test now pins the systemd mark shape instead of None — justified

[FIRST-PRINCIPLES-REVIEWED] 451839b

Description read

[DESCRIPTION-READ] 0de7118bc526c2b7e0e5ccd81bbadf3c2b15db4cfe05e051965d2c30064999c6

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 451839beefa1aac5af70f06777ef4334f2def783 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 451839b

Verdict parsed from the review's SHA-scoped output markers for commit 451839beefa1aac5af70f06777ef4334f2def783.

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 451839b

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

@bolichen97
bolichen97 enabled auto-merge (squash) October 18, 2026 07:05
@bolichen97

Copy link
Copy Markdown
Contributor Author

Backend Tests (3.12, 1) and Backend Tests (Windows) (1) fail on test/test_history_bindings.py::test_the_member_set_is_the_frozen_inventory only. That is main's red, not this diff: #21108 added _dir_write_epoch, _dir_write_epochs and warm_search to ConversationLog without listing them in the frozen inventory (tracked in #21790, fix in #21792). This PR waits for #21792, then rebases and re-runs CI.

@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/pod-journal-start-bound-21731 branch from ef742d3 to 451839b Compare October 18, 2026 07:42
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased onto 943a4e5 (#21792 merged, main's history-bindings red fixed); same single commit, now 451839b. Locally: test/test_history_bindings.py, test/test_pod_journal_since.py, test/test_pod_launchd.py pass (259 passed). CI re-running.

@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
  • Linux mark is wall-clock; an NTP step back can drop this start's lines

rebutted (disproportional): the failure direction is safe. A backward step between journal_mark and boot (a window of seconds) can only make the tail SHORTER, never show an earlier start's FATAL as this one's cause, which is the defect #21731 fixes.
The full journal stays one command away (kirocrew pod logs <name> passes no --since).
An invocation-id bound would need the unit to have started and a second systemctl read; not worth it for a seconds-wide clock-step window.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Run one failed pod up on a real Mac before merging

accepted: the unit tests write real log files and read real byte offsets; only launchctl is faked. A real-Mac run is handed to the operator, who runs macOS checks on his own machine; the result will be posted here.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Run one failed pod up on a real Mac before merging

fixed (verified): the operator ran head 451839b on a real Mac. A line FATAL: OLD START MARKER was appended to pod.err.log first; a real boot refusal (FATAL from a symlinked pod os-home) then failed kirocrew pod up with exit 1.
The printed tail showed only this start's FATAL; the old marker matched 0 times, though it is still in the file.

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

Every review lane on the head is clean (only runner notices and PR Scope size warnings); held by the triage cron on size or path rules alone. Approved on the watch holder's request.

@bolichen97
bolichen97 merged commit 6f8f488 into main Oct 18, 2026
107 checks passed
@bolichen97
bolichen97 deleted the fix/pod-journal-start-bound-21731 branch October 18, 2026 09:08
@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 failure tail on macOS/Linux can show an earlier start's FATAL

2 participants