Skip to content

fix(config): keep memory.history_idle_hours a positive finite number - #26518

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
crew/conductor/fix-history-idle-hours
Oct 31, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
crew/conductor/fix-history-idle-hours

Conversation

@RohanK6

@RohanK6 RohanK6 commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: History consolidation runs on a sane idle timer whatever number sits in memory.history_idle_hours, and an older config.json still loads.

memory.history_idle_hours is the one memory number the loader reads with a bare section.get(...). The schema pass lets any JSON number through, so 0, -5, Infinity and NaN reach the code that multiplies it by 3600.

Why it matters

A zero or negative value makes history consolidate on every idle check. A non-finite value means it never consolidates, so daily history and lessons silently stop. Either way there is no warning.

Not a goal

What changed (motivation → approach → change)

The idle timer can be zero, negative or infinite because this field skips the _safe_* read its siblings use. It now reads like them:

stored value loads as logged
positive number, "3" from an older file that number of hours no
0, negative, Infinity, NaN, null, text, true the default, 3.0 yes
positive but below 0.5 0.5, the dashboard's floor yes

The floor lives in config/memory_sections.py as HISTORY_IDLE_HOURS_MIN. The docs/configuration.md row says what the field accepts.

Backwards compatibility

Compatible: no value makes the load fail. A usable value loads exactly as before, and "3" still reads as 3.0.

Reader: src/kiro_crew/cli_server.py:_run_task -- chat -- multiplies a positive finite float by 3600 (test_digit_string_from_an_older_file_is_read_as_hours)
Reader: src/kiro_crew/slack/gateway_runtime/service_boot.py:_init_services -- chat -- reads the same built MemoryConfig (test_wrong_type_never_reaches_the_multiplier)
Reader: src/kiro_crew/history_consolidation.py:reconfigure -- chat -- hot reload builds through the same loader (test_unusable_number_takes_the_default_with_a_warning)

Tests

test/test_config_history_idle_hours.py runs load() on raw JSON (0, -5, Infinity, NaN, 1e400, 0.1, null, "abc", "3") and calls the builder directly without the schema pass. It checks the value, that it is a float, and that exactly the changed cases log.

Proof: not provable -- other: prove.py reverts the shared constant with the builder, so the mutated run stops at collection. Reverting only the builder hunk by hand turns 19 of the 31 new cases red; all 31 pass with the fix.

Determinism: 3 repeated runs under xdist and a reversed class order, all green. The tests use temp files and caplog only.

Related set: 40 test files touching the config loader, section builders, memory handlers and hot reload, 2259 passed. isort, flake8, black, mypy and the flake-pattern ratchet pass.

Manual verification

N/A — unit coverage sufficient: the change is one pure function on the load path, tested through load() and directly.

Related Issues

Fixes #26515

Sibling sweep

Swept: git grep -nE "=section.get("[a-z_]*(hours|secs|days|dim|count|max|min|size|limit|timeout|pct|threshold)")" -- src/kiro_crew/config/
Sibling: src/kiro_crew/config/section_builders.py:280 -- not affected -- embedding_dim is not a timer; a wrong width needs a store rebuild, not a load-time reset

Pattern harvest

Rule candidate: semgrep
Pattern: a numeric DTO field built with a bare SectionReader.get instead of SectionReader.read with a _safe_* coercer

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

@RohanK6
RohanK6 requested review from a team and KiroCrewCaptain as code owners October 31, 2026 01:47
@RohanK6
RohanK6 requested a review from cruisercohen October 31, 2026 01:47
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

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

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

No design-level concerns: the field now goes through the same _safe_float read as its sibling fields, the load floor matches the dashboard's existing 0.5-hour floor, and all three readers that multiply by 3600 get a positive finite float.

Notes

[DESIGN-REVIEWED] 7be5c37

Description read

[DESCRIPTION-READ] e19ede285a86b0183567bb6e294bf16ba7bf55bb2136bf01c3f552245bcfd7c7

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

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

One rider beyond the Goal, a new load-time floor at 0.5 hours. It is reversible, so it is a note.

Notes

  • Item 2 — rides along, inherited: the Goal is to stop zero, negative and non-finite values, and that is done in the hours <= 0 branch. The floor's only support is symmetry with the dashboard: "the same 0.5 hours the dashboard's settings write clamps to". A hand-edited 0.1 used to work and is now raised. Its one consumer is section_builders.py, and dashboard/handlers/memory.py:585 still hardcodes max(0.5, ...), so the floor is now written in two places. Subtraction: delete HISTORY_IDLE_HOURS_MIN and the hours < HISTORY_IDLE_HOURS_MIN branch, and drop "At least 0.5…raised to it" from the doc row.

What this change ships

Inventory (4 items) — 2 justified

Intent: keep history consolidation running on a sane idle timer whatever is hand-written in config.json — a FIX.

  1. A zero, negative, infinite, NaN, null, text or bool idle-hours value now loads as 3.0 and logs a warning — justified
  2. A positive value below 0.5 hours is now raised to 0.5 and logs a warning — rides along; floor only mirrors the dashboard
  3. A new public constant HISTORY_IDLE_HOURS_MIN — one consumer; the dashboard keeps its own literal
  4. The configuration doc row now says what values the field accepts — justified

[FIRST-PRINCIPLES-REVIEWED] 7be5c37

Description read

[DESCRIPTION-READ] 7977cb0812076933eb17fca85ec7fe5cfb6f2ea50823ad3ab562fff0793e273e

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 7be5c373ced108313b383bb8e4cc5820fd83d2b6 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 7be5c37

Verdict parsed from the review's SHA-scoped output markers for commit 7be5c373ced108313b383bb8e4cc5820fd83d2b6.

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

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 7be5c373ced108313b383bb8e4cc5820fd83d2b6 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 7be5c37

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 7be5c373ced108313b383bb8e4cc5820fd83d2b6 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 Oct 31, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) October 31, 2026 03:04

@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: config loader now refuses a non-positive or non-finite memory.history_idle_hours and raises a value below 0.5 to the floor, with the reference table row and tests updated to match.

@KiroCrewCaptain
KiroCrewCaptain merged commit e009412 into main Oct 31, 2026
95 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the crew/conductor/fix-history-idle-hours branch October 31, 2026 03:05
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 31, 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.

memory.history_idle_hours loads 0, negative and non-finite values as-is

2 participants