Skip to content

fix(session): log steady-state runtime reconcile readings at debug - #19620

Merged
KiroCrewCaptain merged 1 commit into
kirodotdev:mainfrom
rubencu:fix/reconcile-steady-state-log-level
Oct 17, 2026
Merged

KiroCrewCaptain merged 1 commit into
kirodotdev:mainfrom
rubencu:fix/reconcile-steady-state-log-level

Conversation

@rubencu

@rubencu rubencu commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The gateway log stops carrying the runtime reconciler's unchanged reading at WARNING every five minutes, while passes that kill, would kill or retract something still warn.

Every cleanup tick writes one or two WARNING lines that say nothing happened, for the life of the gateway:

WARNING kiro_crew.runtime_reconcile: runtime_reconcile owned_dead=10 forgotten=0: records named processes that are gone or whose pid now belongs to a stranger
WARNING kiro_crew.session: Runtime reconcile: unowned_alive=20 owned_dead=0 (killed 0, would_kill 0, retracted 0)

Why it matters

Every Linux install with long-lived tool work, an app backend or a record held only by the MCP pidfile gets 288 or more WARNING lines a day that need no action. They bury the few reconcile lines that do (a retraction, a kill, a withheld kill) and train anyone reading the log to skip Runtime reconcile: warnings.

Not a goal

  • Pruning the not-mine records so owned_dead reaches zero.
  • Changing what the reconciler counts, kills or retracts, or the session.runtime_reconcile counter.
  • Changing the per-pid lines (the failed-retraction WARNING and the not-mine DEBUG stay as they are).

What changed (motivation → approach → change)

Symptom: two WARNING summaries every tick while the pass did nothing. Cause: each summary's level was chosen by whether a count was non-zero, but owned_dead made only of not-mine answers and unowned_alive made only of permanently withheld pids are steady states. The per-pid not-mine line had already been moved to DEBUG for this reason; the summaries above it had not.

Change: both summaries pick their level from whether the pass acted. The dead-direction summary in runtime_reconcile.py is WARNING when a record was retracted or a retraction it owed failed (it now counts failures), and DEBUG otherwise. The hook summary in session_cleanup.py is WARNING when the reading has a kill, a would-be kill or a retraction, and DEBUG otherwise. DEBUG over INFO because the steady line would still repeat every tick, and the counter already publishes every field each pass. The runtime-ownership spec records the rule.

Backwards compatibility

Compatible: only log levels change; no field, counter, config key or return value moves.

Removes nothing: the same lines are still written with the same text, at DEBUG instead of WARNING when the pass did nothing.

Tests

test/test_runtime_reconcile_wiring.py, beside the existing not-mine level tests, five new tests (seven cases):

  • test_a_dead_count_that_is_all_not_mine_is_summarised_below_warning: all not-mine gives a DEBUG summary.
  • test_a_dead_count_with_a_retraction_is_summarised_at_warning and ..._with_a_failed_retraction_...: either keeps the summary at WARNING.
  • test_a_steady_reading_is_summarised_below_warning: the hook summary for unowned_alive=20 owned_dead=10 and nothing done is DEBUG.
  • test_a_reading_that_acted_is_summarised_at_warning[killed|would_kill|retracted]: each keeps the hook summary at WARNING.

The two steady-state tests fail with the source change reverted (2 failed, 5 passed) and pass with it. Determinism: the five tests passed 10 of 10 repeated runs and in reversed node-id order; they use explicit caplog/monkeypatch arguments, no autouse fixtures. All test/test_runtime_reconcile*.py files plus every test file importing session_cleanup pass: 575 passed, 5 xfailed. black, isort, flake8 and mypy are clean on the touched files. test/test_flake_pattern_ratchet.py passes. Semgrep is not installed on this host, so the SAST lane is CI's.

Manual verification

N/A — unit coverage sufficient: the change is two log-level choices, and both branches of each are asserted on the real code paths (the reconciler's run_once and the cleanup hook).

Related Issues

Closes #19618

Pattern harvest

Not generalizable: the class (a steady-state reading at WARNING) has no shape a rule can see, because whether a count is "steady" depends on what each count means here.

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

@rubencu
rubencu requested review from a team and KiroCrewCaptain as code owners October 12, 2026 23:49
@rubencu
rubencu requested a review from mbriones98 October 12, 2026 23:49
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: checking Automated validation is still running labels Oct 12, 2026
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ⏭️ skipped

Revision 83986599f041e806a7515ae6f8c2760bb9b85a2d 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 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 83986599f041e806a7515ae6f8c2760bb9b85a2d via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check that a stray population that grows but never meets the kill conditions has a visible signal now that its summary line logs at DEBUG.

[DESIGN-REVIEWED] 8398659

Description read

[DESCRIPTION-READ] 173a348b4dec71c3a2768bbf157a3577bea0e8db5095e0f7db50f93fab6eabe4

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 13, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of 83986599f041e806a7515ae6f8c2760bb9b85a2d via the fork AI-review pipeline — 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

On an install with session.reconcile_max_kills: 0, any real candidate still makes would_kill non-zero, so the summary stays at WARNING every tick. The Goal intends that; confirm it is wanted.

What this change ships

Inventory (4 items) — 4 justified

Intent: stop the gateway log repeating the runtime reconciler's unchanged reading at WARNING every tick, while passes that act still warn. FIX (closes #19618).

  1. The runtime_reconcile owned_dead=… forgotten=… summary drops to DEBUG when the pass retracted nothing and no retraction failed. — justified
  2. The Runtime reconcile: unowned_alive=… hook summary drops to DEBUG when nothing was killed, would have been killed, or retracted. — justified
  3. The dead-direction pass now counts failed retractions internally (local failed), so a failure keeps the summary at WARNING. — justified
  4. The runtime-ownership spec states the summary-level rule. — justified

[FIRST-PRINCIPLES-REVIEWED] 8398659

Description read

[DESCRIPTION-READ] d708bfe213fa75bda193ef8d41c8e874409758ae0cb52c380f494ea2d55e0644

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 13, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 83986599f041e806a7515ae6f8c2760bb9b85a2d via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 8398659

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed 83986599f041e806a7515ae6f8c2760bb9b85a2d via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 8398659

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Oct 13, 2026
@rubencu
rubencu force-pushed the fix/reconcile-steady-state-log-level branch from 0d5beec to d89cb55 Compare October 15, 2026 03:45
@rubencu

rubencu commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main 9a77e12 (new head d89cb55). The only conflict came from #20537 splitting test/test_runtime_reconcile.py: the five new summary-level tests now live in test/test_runtime_reconcile_wiring.py, next to the existing not-mine level tests and the _cleanup_with_clock/_drive_reconcile helpers they use. The source and spec hunks are unchanged. test/test_runtime_reconcile*.py plus the session_cleanup test files: 575 passed, 5 xfailed. black, isort, flake8 and mypy are clean.

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

rubencu commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author
  • A failed kill and the hook summary level

rebutted: the hook summary never reported a failed kill. A kill that raises adds to neither killed nor would_kill and the reading has no field for it, so before this change that pass printed the same WARNING as an idle one.
The failure is still reported where it was: a SEL row with outcome failed and the pass's INFO line counted and left alone (kill failed). Probed at d89cb55: killed 0, would_kill 0, both records present, hook summary at DEBUG.
Letting acted see it needs a new reading field, which changes what the reconciler counts, a listed non-goal. The dead-direction failed is a local in _reconcile_dead that only picks that line's level.

@rubencu

rubencu commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author
  • A zero-budget candidate warns every tick

rebutted: that repeat is intended. The Goal keeps passes that "kill, would kill or retract something" at WARNING.
would_kill is non-zero only when an operator has lowered session.reconcile_max_kills to 0 (default 5) and a pid meets every kill condition, so it names a real stray the operator chose to observe. Restoring the budget reclaims it and the count returns to 0.
The readings moved to DEBUG are ones no operator action changes: not-mine records and permanently withheld pids. Probed at d89cb55: a zero-budget candidate gives would_kill 1 and a WARNING summary on consecutive ticks.

@rubencu
rubencu force-pushed the fix/reconcile-steady-state-log-level branch from d89cb55 to 8398659 Compare October 16, 2026 20:33
@rubencu

rubencu commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Maintenance rebase onto main 9037cde (new head 8398659). green_age.py reported STALE: main had edited docs/system-specs/modules/runtime-ownership.md (#21032, #20862, away from this hunk), and two test files that import the changed modules moved. The rebase had no conflicts and the diff is unchanged (same patch-id).

Local, at 8398659: the 22 test files that import runtime_reconcile or session_cleanup gave 700 passed and 5 xfailed. The one failure was test_identity_topology.py::test_a_proven_recycle_is_not_unverifiable, which fails the same way when run alone on main and passes in its own file. black, isort, flake8, mypy, comment-history, brand, line-cap, docs-lint and the flake ratchet are clean. The frontend half of local-gate.py did not run on this host (npm auth); this diff has no frontend 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 Oct 17, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) October 17, 2026 23:09

@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 (4 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: the two per-pass runtime reconcile summaries drop to DEBUG when the pass changed nothing, and stay WARNING when it acted. Spec files changed as a ride-along (a minority of the diff on both file count and changed lines), not reviewed as a design decision: docs/system-specs/modules/runtime-ownership.md.

@KiroCrewCaptain
KiroCrewCaptain merged commit 6e43219 into kirodotdev:main Oct 17, 2026
98 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

runtime_reconcile: steady-state reading logged at WARNING every cleanup tick

2 participants