Skip to content

refactor(config): give each config domain a named owner module - #14558

Merged
bolichen97 merged 1 commit into
mainfrom
refactor/b07-config-composition
Sep 28, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
refactor/b07-config-composition

Conversation

@bolichen97

@bolichen97 bolichen97 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Make each configuration rule easy to find and safe to change by giving every group of config.json settings a named owner module, without changing a single setting's behaviour.

src/kiro_crew/config/sections.py (8,199 lines) and config/loader.py (6,840 lines)
were the two places every config rule lived. Finding the owner of one setting meant
scrolling one of them, and a small edit sat next to forty unrelated sections. Both
files are among the most-edited in the repository, so that cost is paid constantly.

Why it matters

A setting whose rule is hard to find is a setting people change by guessing. The two
files carry security clamps, fail-closed defaults, the write-back migrations and the
credential list, so a guess there is expensive: a wrong default ships silently and is
only noticed when an operator's gateway behaves differently from their config file.
Named owners make the rule for one domain readable on its own, and the same split
lets a reviewer see that a change touches only the domain it claims to.

Not a goal

  • No behaviour change. Every default, coercion rule, log line, clamp, lock, migration and serialized byte stays identical; config-baseline.json is unchanged.
  • No change to the public import surface. config.sections and config.loader still expose every name they exposed, as the same objects.
  • Not a full split of either file: the residual core of each stays put because something outside the config package names that file (table below).
  • No new config section, field, or schema entry.
  • No change to config consumers, the live watcher, config/paths.py, or session_work_dir.py.

What changed (motivation → approach → change)

Two files held every config rule, so neither had an owner. Each config.json domain
now has its own module, and the two old files stay as the facades callers import.

New owner Holds
config/fields.py _meta field metadata and the _safe_* value coercers every section shares. Imports nothing from kiro_crew.
config/memory_sections.py memory, knowledge, skills, session_summary, named memory stores
config/integration_sections.py mcp, mcp_gateway, instances, tunnel, publish, computer_use, app registries
config/service_sections.py taskrunner, orchestrator, messaging, cron_history, monitoring, heartbeat, watchdog
config/section_builders.py The _build_* helper of 28 sections, grouped by the module owning each section's DTO (sections with no helper stay built inline in _load_resolved or by their DTO's from_raw)
config/migration.py The write-back migration ids, the document transform, superseded-default reporting, in-memory adoption

Imports run one way — fields, then the section owners, then sections, then
section_builders and migration, then loader — and a new test pins that graph.
Every module split out logs as kiro_crew.config.loader, so a relocated warning keeps
the record name operators filter on and caplog tests select.

Each file's residual core stays where it is because something outside this package
names that file, not because it was convenient. docs/system-specs/modules/config.md
carries the same table; the short version:

Stays in Held there by
sections.py: agent, crew record, session, workspace, dashboard (+tailnet), the 9 channel DTOs, wakatime, speech-to-text, telemetry, decisions, resource limits messaging.md (channel restart flags), slack-gateway.md, crew-mode.md, history.md, stt-streaming.md, metrics.md, decisions.md, security.md, model-selection.md, model-fallback.md, subagent.md, acp-client.md, crew-log-projection.md; plus source scans that allow ResourceLimitsConfig.from_raw, _tailscale_config_from, the avatar-motion literal and the acp_backend declaration only in that file
loader.py: document I/O, write-back persistence, the unsandboxed-exec policy, the validated-document cache fingerprint, KiroCrewConfig.load/save, the security clamp, the loop-stall readers, published snapshots, agent resolution, the provider factory, the credential list and port, the agent/session/telemetry/dashboard builders The config-writer scans exempt only loader.py; code-style.md, security.md, sel.md, resource-protection.md, crew-mode.md, context-management.md, metrics.md and the feature map name it; the agent-spec read inventory, the agent-SDK edge baseline, the second-boot witness and the blocking harness-parity and memory-store review rules key to it

The one changed call shape is internal: the migration transform now takes the
adoption-ledger writer as an argument, and loader._apply_document_migrations passes
its own record_adoptions at call time, so the existing patch seam still reaches it.
loader.py also groups its residual responsibilities into commented sections instead
of interleaving them.

Backwards compatibility

Compatible: both facades re-export every name they had, as the same object, so every
existing import resolves and nothing is rejected, renamed or removed. A patch reaches
the code that looks the name up in the patched module. Names read by code that stays in
loader.py (the path helpers, the config writers, _log_config_clamp_event,
DEFAULT_POOL_SIZE, record_adoptions, each _build_* name at its call site, the
snapshot globals) stay call-time seams on the loader. A helper read inside a relocated
builder or migration rule is now patched on config.section_builders or
config.migration. A scan of every setattr/patch.object/string-path patch in
test/ and src/ finds no patch on the loader or sections facade that targets
one of those relocated names, and config.md lists both sets.

Tests

  • test/test_config_refactor_contract.py (new) pins:
    • each facade's historical name set and the identity of shared names, and every config module's logger name;
    • the monitoring runtime ceiling: field order, default, bounds, help text, warn-on-reject, and silence when unset;
    • the MCP honour_auto_approve builder/dataclass lockstep;
    • workspace_root(create=False) resolving without creating anything;
    • representative seams of each kind: ones that stay on the loader (config_path/config_dir/DEFAULT_POOL_SIZE/_log_config_clamp_event/record_adoptions/env_path/write_config_atomically) and ones that live on their owner (section_builders._resolve_stub_servers, coerce_runtime_ceiling, _validated_stt_provider; migration.superseded_default_drift);
    • the migration ids, the migrated document with its key order, the agents-seed-before-default-agent order, idempotence, and the exact backup bytes.
  • test/test_config_module_boundaries.py: extended with the owner import DAG and a leaf-purity check on config/fields.py. The scanner counts from kiro_crew.config import <submodule> as that submodule and walks module-level if/try blocks, and a self-test pins that. Its subprocess check also proves importing section_builders/migration pulls in no loader, schema or validation.
  • A BASE-vs-HEAD snapshot (public surface of all 15 config modules, every dataclass's fields/defaults/metadata/docstring, the JSON schema, the restart-path set, to_dict(), and six load scenarios with their full log output and on-disk result) compares byte-identical apart from the one added module alias.

Manual verification

N/A — unit coverage sufficient: the change moves code and the equivalence snapshot plus the owned suites cover every observable contract. config-baseline.json regenerates byte-identical, which is the operator-visible schema surface.

Related Issues

no linked issue: internal refactor with no user-visible change.

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 a review from a team as a code owner September 27, 2026 23:36
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 27, 2026
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

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

Design-Verdict: PASS

Confirm the BASE-vs-HEAD equivalence snapshot was re-run on this exact revision — it lives in the description, not CI.

[DESIGN-REVIEWED] 8e17f6c

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 8e17f6c259b8547c434c307b8db432c03d9ff06b — 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 BASE-vs-HEAD equivalence snapshot the description leans on is not shipped in the diff — confirm it ran, since behaviour identity otherwise rests on the new contract test alone.

What this change ships

Inventory (10 items) — 10 justified

Intent: make every config.json domain's rules findable by giving each a named owner module, with zero behaviour change — a MOVE (refactor), not a FIX or an ADDITION.

  1. Shared field coercers and _meta moved to a new leaf config/fields.py — justified
  2. Memory/knowledge/skills/session-summary sections moved to config/memory_sections.py — justified
  3. MCP, tunnel, publish, computer-use, instances, registries moved to config/integration_sections.py — justified
  4. Taskrunner, orchestrator, messaging, monitoring, heartbeat, watchdog moved to config/service_sections.py — justified
  5. 28 _build_* section helpers moved to config/section_builders.py — justified
  6. Migration ids and document transform moved to config/migration.py; transform now receives the adoption-ledger writer as an argument — justified
  7. sections.py and loader.py become facades re-exporting every historical name as the same object — justified
  8. Relocated modules keep logging as kiro_crew.config.loader, so operator log filters and caplog selections still match — justified
  9. New contract test and extended boundaries test pin facade name sets, the owner import DAG, seams and migration bytes — justified
  10. config.md rewritten with the owner/residual tables, same commit — justified

[FIRST-PRINCIPLES-REVIEWED] 8e17f6c

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 8e17f6c259b8547c434c307b8db432c03d9ff06b and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 8e17f6c

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

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed 8e17f6c259b8547c434c307b8db432c03d9ff06b — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 8e17f6c

Verdict parsed from the review's SHA-scoped output markers for commit 8e17f6c259b8547c434c307b8db432c03d9ff06b.

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

@bolichen97

Copy link
Copy Markdown
Contributor Author

Integration (in-process gateway) is red on this head, and it is an inherited main failure, not something this PR causes. Same test, same assertion, same line, on two consecutive main commits:

test/integration/test_route_sweep.py::test_every_parameterless_get_route_serves_on_a_fresh_home
E  AssertionError: /api/models -> 200: listed as 503 'model list returned empty output';
   got [{"model_name": "fake-model-fast", ... "description": "Fake e2e model (fast)", ...}]
test/integration/test_route_sweep.py:268: AssertionError
Where Run / job Result
main @ de25db109 job 108732071372 same assertion, test_route_sweep.py:268
main @ 61e100ded job 108735539615 same assertion, test_route_sweep.py:268
this PR @ 8c54b8c job 108733407990 same assertion, test_route_sweep.py:268

The route sweep's UNAVAILABLE_ON_A_FRESH_HOME table lists /api/models as a 503 on a fresh home, and the integration fixture's fake ACP backend now answers it with the two fake-model-* entries instead. This diff touches only src/kiro_crew/config/**, adds no route, and changes no model resolution, defaults, or serialized bytes — it cannot make a model list appear. Every other check on this head is green, including all eight Backend Tests (3.12) shards and the Windows shards.

No repair here: fixing an expectation in test/integration/test_route_sweep.py is outside this PR's goal and would edit a file it does not own. It clears once main carries the fix and this branch rebases onto it.

@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 Sep 28, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Equivalence evidence for head 8c54b8cb21d9a84c1952d5018a5bea265f0cb54d, answering the Design and First Principles note that the BASE-vs-HEAD snapshot is an author-run artifact.

It ran from the committed trees, extracted with git archive, not from a working copy. One side is this PR's base, main @ f57c1dee40ccde5753c9a304247b8984b1cb2fe6; the other is this exact head. Both ran under Python 3.12.13 with an isolated KIROCREW_HOME/HOME.

check                                        base vs head
surface: kiro_crew.config          10 names   identical
surface: config.sections          274 names   identical
surface: config.loader            496 names   identical + one added alias (_migration)
surface: config.live / paths / resolution / schema / validation / superseded_defaults
                                              identical
dataclasses (fields, types, defaults, metadata, docstrings, members, params, MRO)
                                 49 classes   identical
default repr of every defaultable DTO          identical
KiroCrewConfig().to_dict() (key order kept)    identical
JSON schema / SCHEMA_REGISTRY entries          identical
restart-path set                               identical
load: absent / empty / garbage / list / overlay / rich
      (to_dict, degraded sections, files written, config.json after, every log record)
                                               identical (rich: 26 log records, same order)
generate_config_baseline.py output             identical, == committed config-baseline.json (sha256 cbe45c7a30d4f88b...)

The "rich" document exercises clamps, fail-closed coercions, retired STT providers, the monitoring ceiling fallback, honour_auto_approve, non-bool coercions, an unknown section, the write-back migration refusal and the timezone. Each surface entry compares kind, qualname and signature, or a sorted repr for values. Nothing under __module__ is compared: it is the one thing a move changes by definition.

The same guarantees that must hold after any later edit are pinned as tests in this diff, not left to the snapshot. They cover name sets and identity, logger names, the patch seams, migration ids, order and backup bytes, and workspace_root(create=False). test_config_baseline.py also byte-compares the schema baseline on every CI run.

Snapshot script (reproducible: run from a tree extracted with `git archive <sha> src scripts/generate_config_baseline.py config-baseline.json`)
"""Behavior-equivalence snapshot of kiro_crew.config for BASE-vs-HEAD comparison.

Run from a worktree root: python equiv_snapshot.py <out.json>
Uses an isolated KIROCREW_HOME/HOME under a temp dir.
"""
import re, dataclasses, importlib, inspect, io, json, logging, os, subprocess, sys, tempfile, types
from pathlib import Path

out_path = sys.argv[1]
tmp = Path(tempfile.mkdtemp(prefix="b07eq-"))
os.environ["KIROCREW_HOME"] = str(tmp / "home")
os.environ["HOME"] = str(tmp / "userhome")
os.environ["KIRO_HOME"] = str(tmp / "kirohome")
(tmp / "userhome").mkdir()
sys.path.insert(0, str(Path.cwd() / "src"))

MODS = ["kiro_crew.config", "kiro_crew.config.sections", "kiro_crew.config.loader", "kiro_crew.config.live",
        "kiro_crew.config.paths", "kiro_crew.config.resolution", "kiro_crew.config.schema",
        "kiro_crew.config.validation", "kiro_crew.config.superseded_defaults"]
snap = {}

def describe(v):
    if isinstance(v, types.ModuleType):
        return ["module", v.__name__]
    if isinstance(v, type):
        return ["class", v.__qualname__]
    if callable(v) and hasattr(v, "__qualname__"):
        try:
            sig = re.sub(r" at 0x[0-9a-f]+", "", str(inspect.signature(v)))
        except (TypeError, ValueError):
            sig = "?"
        return ["callable", v.__qualname__, sig]
    if isinstance(v, (set, frozenset)):
        return ["value", type(v).__qualname__, repr(sorted(map(repr, v)))]
    if isinstance(v, dict) and any(isinstance(x, (set, frozenset)) for x in v.values()):
        return ["value", "dict", repr({k: sorted(map(repr, x)) if isinstance(x, (set, frozenset)) else repr(x) for k, x in v.items()})]
    try:
        r = repr(v)
    except Exception:
        r = "<unreprable>"
    if " at 0x" in r:
        r = type(v).__qualname__
    return ["value", type(v).__qualname__, r[:2000]]

for m in MODS:
    mod = importlib.import_module(m)
    snap["surface:" + m] = {n: describe(getattr(mod, n)) for n in sorted(vars(mod)) if not (n.startswith("__") and n.endswith("__"))}
    # also names reachable via package __getattr__
from kiro_crew.config import loader, sections, schema

def field_fp(cls):
    rows = []
    for f in dataclasses.fields(cls):
        if f.default is not dataclasses.MISSING:
            d = ["value", repr(f.default)]
        elif f.default_factory is not dataclasses.MISSING:
            d = ["factory", repr(f.default_factory())]
        else:
            d = ["required", ""]
        rows.append([f.name, str(f.type), d, repr(sorted(f.metadata.items())), f.init, f.repr, f.compare, f.kw_only])
    members = {}
    for n, v in vars(cls).items():
        if n.startswith("__") and n.endswith("__"):
            continue
        members[n] = describe(v)
    return {"qualname": cls.__qualname__, "doc": cls.__doc__, "fields": rows, "members": members,
            "params": repr(cls.__dataclass_params__), "mro": [c.__qualname__ for c in cls.__mro__]}

classes = {}
for m in (sections, loader):
    for v in vars(m).values():
        if isinstance(v, type) and dataclasses.is_dataclass(v):
            classes[v.__qualname__] = v
snap["dataclasses"] = {k: field_fp(classes[k]) for k in sorted(classes)}
snap["default_repr"] = {k: repr(classes[k]()) for k in sorted(classes) if all(
    f.default is not dataclasses.MISSING or f.default_factory is not dataclasses.MISSING or not f.init
    for f in dataclasses.fields(classes[k]))}
snap["to_dict_default"] = json.dumps(loader.KiroCrewConfig().to_dict())
snap["json_schema"] = json.dumps(schema.build_json_schema(loader.KiroCrewConfig), default=repr)
snap["entries"] = [json.dumps(schema.config_entry_to_dict(e), default=str) for e in schema.SCHEMA_REGISTRY]; snap["restart_paths"] = sorted(schema._RESTART_PATHS)

# baseline generator bytes
bl = tmp / "baseline.json"
env = dict(os.environ, KIROCREW_BASELINE_OUTPUT=str(bl), PYTHONPATH=str(Path.cwd() / "src"))
r = subprocess.run([sys.executable, "scripts/generate_config_baseline.py"], capture_output=True, text=True, encoding="utf-8", env=env, cwd=str(Path.cwd()), timeout=120)
snap["baseline_rc"] = r.returncode
snap["baseline_bytes_sha"] = __import__("hashlib").sha256(bl.read_bytes()).hexdigest() if bl.exists() else None
snap["committed_baseline_sha"] = __import__("hashlib").sha256(Path("config-baseline.json").read_bytes()).hexdigest()

# load scenarios with captured logs
class Cap(logging.Handler):
    def __init__(self):
        super().__init__(logging.DEBUG); self.records = []
    def emit(self, rec):
        self.records.append([rec.name, rec.levelname, rec.getMessage()[:500]])
root = logging.getLogger()
root.setLevel(logging.DEBUG)

def scenario(name, doc, local=None):
    home = Path(os.environ["KIROCREW_HOME"])
    home.mkdir(parents=True, exist_ok=True)
    for p in home.iterdir():
        if p.is_file():
            p.unlink()
    if doc is not None:
        (home / "config.json").write_text(doc if isinstance(doc, str) else json.dumps(doc), encoding="utf-8")
    if local is not None:
        (home / "config.local.json").write_text(json.dumps(local), encoding="utf-8")
    loader._invalidate_config_cache()
    h = Cap(); root.addHandler(h)
    try:
        cfg = loader.KiroCrewConfig.load()
        res = {"to_dict": json.dumps(cfg.to_dict()), "degraded": sorted(cfg.degraded_sections)}
    except Exception as e:
        res = {"error": repr(e)}
    finally:
        root.removeHandler(h)
    files = {}
    for p in sorted(home.iterdir()):
        try:
            if p.is_file() and p.suffix in (".json", ".bak", ".local"):
                files[p.name] = p.read_text(encoding="utf-8", errors="replace")
        except OSError:
            pass
    # strip timestamps in meta stamps
    res["files"] = sorted(files)
    res["config_after"] = files.get("config.json")
    res["logs"] = [r for r in h.records if r[0].startswith("kiro_crew")]
    blob = json.dumps(res)
    blob = blob.replace(str(tmp), "<TMP>")
    blob = re.sub(r'lastTouchedAt\\": \\"[^"\\]+', 'lastTouchedAt\\": \\"<TS>', blob)
    res = json.loads(blob)
    snap["load:" + name] = res

scenario("absent", None)
scenario("empty", {})
scenario("garbage", "{not json")
scenario("list", "[1,2]")
scenario("rich", {
    "agent": {"model": "auto", "sandbox": "strict", "max_subagents": 999, "subagent_max_turns": 0, "chat_turn_timeout_secs": 5,
              "tool_approval_timeout_secs": 99999, "session_control": "false", "acp_backend": "nonexistent", "role_models": {"subagent": 7},
              "yolo_duration": "bogus", "jail": "weird", "fallback_model": 12, "lane_weights": {"x": 999, "": 3}},
    "session": {"timeout_secs": -5, "autocompact_pct": 200, "pool_size": 99},
    "monitoring": {"max_runtime_secs": 0, "prefer_structured_arming": True},
    "mcp": {"honour_auto_approve": "yes", "extra_path_dirs": ["/opt/x", 3]},
    "stt": {"provider": "whisper", "model": "nope"},
    "telegram": {"enabled": True, "allowed_user_ids": ["12", 3.0, "x"]},
    "slack": {"allowed_users": ["U1"], "command": "/k"},
    "resource_limits": {"memory_mb": 512.5},
    "dashboard": {"folder_sort": "zzz", "verbosity": "concise"},
    "memory": {"embedding_provider": "none"},
    "knowledge": {"auto_ingest_doc_links": True},
    "decisions": {"enabled": True},
    "unknown_section": {"a": 1},
    "agents": {"default": {"kiro_agent": "kirocrew", "workspace": "default", "session_color": "#zzz"}},
    "workspaces": {"default": {"path": "~/w"}},
    "timezone": "Europe/Paris",
})
scenario("overlay", {"agent": {"model": "auto"}, "session": {"timeout_secs": 100}}, local={"session": {"timeout_secs": 200}, "dashboard": {"url": "http://x"}})
snap["tmp"] = str(tmp)
json.dump(snap, open(out_path, "w"), indent=1, sort_keys=True, default=str)
print("wrote", out_path, len(snap), "keys; baseline rc", snap["baseline_rc"], "match", snap["baseline_bytes_sha"] == snap["committed_baseline_sha"])

@bolichen97

bolichen97 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor Author
  • The BASE-vs-HEAD equivalence snapshot is an author-run artifact — confirm it ran against this head — rebutted (verified, no code change needed)

Re-ran the snapshot from the committed trees of base f57c1de and head 8c54b8c (extracted with git archive, Python 3.12.13).
Every compared surface is identical: 15 config modules, 49 dataclasses, to_dict(), JSON schema, restart paths, six load scenarios with logs, and the baseline generator output.
The only difference is one added module alias, loader._migration; the table and the script are in comment #issuecomment-5861161781.
The durable contracts are CI-gated tests in this diff (test_config_refactor_contract.py, test_config_module_boundaries.py), and test_config_baseline.py byte-compares the schema baseline.

@bolichen97

bolichen97 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor Author
  • The BASE-vs-HEAD equivalence snapshot is an author-run artifact — confirm it ran against this head — rebutted (verified, no code change needed)

Re-ran the snapshot from the committed trees of base f57c1de and head 8c54b8c (extracted with git archive, Python 3.12.13).
Every compared surface is identical: 15 config modules, 49 dataclasses, to_dict(), JSON schema, restart paths, six load scenarios with logs, and the baseline generator output.
The only difference is one added module alias, loader._migration; the table and the script are in comment #issuecomment-5861161781.
The durable contracts are CI-gated tests in this diff (test_config_refactor_contract.py, test_config_module_boundaries.py), and test_config_baseline.py byte-compares the schema baseline.

@bolichen97
bolichen97 enabled auto-merge (squash) September 28, 2026 00:27
@bolichen97
bolichen97 force-pushed the refactor/b07-config-composition branch from 8c54b8c to 26636fb Compare September 28, 2026 03:00
@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 Sep 28, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Infra reruns on head 26636fbbf19058fad7cdbaa87c1eb393d3dbfe86. GitHub Actions could not provision these jobs around 03:05–03:12Z, so each one ended in Set up job having run zero of its own steps:

##[error]Failed to resolve action download info.
##[error]The HTTP request timed out after 00:01:40.
Run Workflow Failed / cancelled jobs (all at "Set up job", 0 own steps)
36372007838 Fast Gate 108770133487 Focus Cue, 108770133538 Comment History, 108770133626 Decision Ledger, 108770133632 Feature Map (failure); 108770133267 Brand Name, 108770133403 Changelog History, 108770133449 Testpaths Coverage, 108770133452 Vendored Tree, 108770133533 Harness Parity, 108770133575 Loop-Bound Locks, 108770133653 Working-Directory Path (cancelled)
36372007837 Code Review 108770330221 Automated Rule Check
36372007968 Build 108770133366 Resolve desktop matrix
36372007798 PR Scope 108770132886 PR Scope

Each of these runs was rerun once with gh run rerun <id> --failed. The CI run (36372007880) failed only in Await Fast Gate because Fast Gate never completed; it gets one rerun after the rerun Fast Gate is green. No job whose own steps failed is being rerun. Every one of these checks passed on the previous head 8c54b8c, and the commit's content is unchanged apart from the rebase onto cd783d2 and the review-requested docs/test corrections.

@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 Sep 28, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • The no-behaviour-change claim rests on an off-diff snapshot; confirm config-baseline.json regenerates byte-identical before merge — rebutted (verified; CI-gated)

The byte identity is a CI gate, not a claim to take on trust: test/test_config_baseline.py runs scripts/generate_config_baseline.py and byte-compares its output with the committed config-baseline.json on every backend run. The diff does not touch config-baseline.json.
Re-ran the committed-tree snapshot at this head against its base cd783d2 under Python 3.12. The baseline generator output is identical and equal to the committed file; the 15 module surfaces, 49 dataclasses, to_dict(), the JSON schema, the restart paths and six load scenarios are identical; the only difference is the added loader._migration alias.
Method and script: #issuecomment-5861161781.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • The no-behaviour-change claim rests on an off-diff snapshot; confirm config-baseline.json regenerates byte-identical before merge — rebutted (verified; CI-gated)

The byte identity is a CI gate, not a claim to take on trust: test/test_config_baseline.py runs scripts/generate_config_baseline.py and byte-compares its output with the committed config-baseline.json on every backend run. The diff does not touch config-baseline.json.
Re-ran the committed-tree snapshot at this head against its base cd783d2 under Python 3.12. The baseline generator output is identical and equal to the committed file; the 15 module surfaces, 49 dataclasses, to_dict(), the JSON schema, the restart paths and six load scenarios are identical; the only difference is the added loader._migration alias.
Method and script: #issuecomment-5861161781.

@bolichen97
bolichen97 force-pushed the refactor/b07-config-composition branch from 26636fb to 9a76ebd Compare September 28, 2026 03:46
@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 readiness: checking Automated validation is still running labels Sep 28, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Opus 5 Review on 9a76ebdc5cb5300ff161ea4dc90f58533ed51ea1 returned no verdict, and it is not a finding. The discovery step hit its turn budget, so the gate failed closed:

##[error]Execution failed: Reached maximum number of turns (180)
##[error]Opus 5 review step did not succeed (outcome=skipped) for 9a76ebdc5cb5300ff161ea4dc90f58533ed51ea1. Failing closed.

The same lane finished with "no blocking findings" on the two previous heads of this PR, 8c54b8c and 26636fb. The only change since 26636fb is 3 files, +23/-13, and none of it is in src/. I reran that one job (108778959260) once, which is what the gate's own message asks for. Every other check on this head is green: 81 passed, including Coverage Gate and Integration (in-process gateway). Design, First Principles and GPT 5.6 have published and pass.

@bolichen97

Copy link
Copy Markdown
Contributor Author

The single rerun of Opus 5 Review (run 36375018885, attempt 2, job 108778959260) failed exactly like the first attempt. The discovery step ran out of turns before posting a verdict:

05:02:16Z ##[error]Execution failed: Reached maximum number of turns (180)
05:02:16Z ##[error]Opus 5 review step did not succeed (outcome=skipped) for 9a76ebdc5cb5300ff161ea4dc90f58533ed51ea1. Failing closed.
Head Opus 5 Review
8c54b8c completed: no blocking findings
26636fb completed: no blocking findings
9a76ebd (current) attempt 1 and attempt 2: turn budget exhausted, no verdict

Nothing in the diff is being reviewed as wrong. The delta from 26636fb is docs and tests only (3 files, +23/-13), and every other check on this head is green, including CI, Coverage Gate, the integration layer, CodeQL, Security Scope, and the Design, First Principles and GPT 5.6 lanes. I'm not rerunning again and not pushing just to re-trigger the lane. A maintainer rerun or /ai-review override fable 9a76ebdc5cb5300ff161ea4dc90f58533ed51ea1: <reason> is what's needed here.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 28, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

/ai-review override fable 9a76ebd: Opus discovery exhausted its 180-turn budget twice at this head with no verdict and no finding; the lane passed with no findings on 8c54b8c and 26636fb, and the delta since 26636fb is 23 lines of docs and tests with no src change.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@bolichen97 marked the fable AI finding as false positive, not applicable, or explicitly accepted for 9a76ebdc5cb5300ff161ea4dc90f58533ed51ea1.

Opus discovery exhausted its 180-turn budget twice at this head with no verdict and no finding; the lane passed with no findings on 8c54b8c and 26636fb, and the delta since 26636fb is 23 lines of docs and tests with no src change.

This decision applies only to this commit. A new push requires a new judgment.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Sep 28, 2026
@bolichen97
bolichen97 force-pushed the refactor/b07-config-composition branch from 9a76ebd to 4ca18a5 Compare September 28, 2026 06:20
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Sep 28, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased onto main @ dceaca3a95b6dc7ed7863261a1ca1162fa161357 because the branch had gone CONFLICTING in src/kiro_crew/config/loader.py. The conflict came from #13948 (auto-title refresh every N user turns); #14328 changed only config.md prose outside this PR's sections. New head: 4ca18a56b3c9ecf878786c6778cd31094836c6cc, still one commit.

The port. #13948 added three things. A DashboardConfig.title_refresh_every_turns field and its TITLE_REFRESH_EVERY_TURNS_MIN/MAX bounds go in sections.py, which still owns both. A _title_refresh_every_turns parser goes in loader.py, together with the new keyword on _build_dashboard_config. The dashboard builder stays in loader.py, so its parser does too: it lands right above the builder, in the same module and with the same patch reach as on main. The conflict region was main's copy of the 14 builders this PR moves to section_builders.py, which #13948 left untouched. The resolution kept the move and kept the new parser in the loader.

git range-diff cd783d2..9a76ebd dceaca3..4ca18a5, loader.py hunk (the rest is the same field and bounds in sections.py, with nothing else changed):

@@ src/kiro_crew/config/loader.py: def _build_telemetry_config(telemetry_data: dict
 -    )
 -
 -
- def _build_dashboard_config(_degraded: set[str], dashboard_data: dict) -> DashboardConfig:
-     return DashboardConfig(
-         url=dashboard_data.get("url", ""),
+ def _title_refresh_every_turns(value: object) -> int:
+     """Parse ``dashboard.title_refresh_every_turns``: 0, or MIN..MAX.

Proof that only upstream's change moved in. For every file this PR touches, the change from old head 9a76ebd to new head 4ca18a5 is byte-for-byte what main itself changed from cd783d2 to dceaca3:

src/kiro_crew/config/loader.py       identical delta (+16 lines: the parser and the builder keyword)
src/kiro_crew/config/sections.py     identical delta (the field + the two bounds)
docs/system-specs/modules/config.md  identical delta (#14328's label-guard prose)
test/test_config_baseline.py         identical delta (none)
fields.py, memory_sections.py, integration_sections.py, service_sections.py,
section_builders.py, migration.py, both contract tests                    0 changed lines

An AST check also found every one of the 78 relocated definitions byte-identical to its main version. The one intended difference is _apply_document_migrations, whose statement body is identical to migration.apply_document_migrations.

Re-gated at 4ca18a5, Python 3.12:

  • owned + oracle + feat(chat): add an opt-in auto-title refresh every N user turns #13948's own tests (test_title_refresh.py, test_messaging_auto_title.py, test_mcp_tool_titles.py, all unmodified): 5974 passed. The single failure is inherited.
  • in-process integration layer: 31 passed.
  • mypy: 1854 files clean. isort, flake8 and black pass. docs-lint passes.
  • brand, harness-parity, comment-history, memory-store, agent-sdk boundary and sync-io gates: all exit 0.
  • equivalence against dceaca3, including the new field: identical apart from the loader._migration alias. config-baseline.json regenerates byte-identical.

The failure is test_mcp_tool_titles.py::test_every_listed_tool_carries_its_declared_title[kirocrew-dashboard], and it is inherited from main. The dashboard MCP server lists session_set_model with no title. Pristine main dceaca3, run from git archive in the same venv, fails the same assertion ({'session_set_model': None}). This PR does not touch the dashboard MCP tools or that fixture.

@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Sep 28, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Status of head 4ca18a56b3c9ecf878786c6778cd31094836c6cc: 76 checks succeeded, and each of the 5 failures has a cause outside this diff.

Check Job Cause
Backend Tests (3.12, 4) 108811798070 test_mcp_tool_titles.py::test_every_listed_tool_carries_its_declared_title[kirocrew-dashboard]: the dashboard MCP tool session_set_model has no title. Pristine main dceaca3 fails it the same way. A maintainer fix is open as #14639.
Backend Tests (Windows) (4) 108811797839 The same inherited test. It is the only failure in the shard.
Coverage Gate 108816055618 Fails closed on backend-test=failure, which is the row above.
GPT 5.6 Review 108811264742 The lane produced a verdict but could not publish it: reading this PR's comments to find this lane's slot exited 1 and reported: gh: API rate limit exceeded for installation.
Opus 5 Review 108811263890 Reached maximum number of turns (180) in discovery, with no verdict. This is the same turn-budget exhaustion as on 9a76ebd.

Holding with no rerun and no push. A rerun cannot pick up #14639, and the GPT and Opus lanes run again on the one fresh push after it merges.

sections.py (8,199 lines) and loader.py (6,840) held every configuration
rule, so no group of settings had an owner and a one-setting edit sat
among forty unrelated sections. Both files are among the most-edited in
the repository, so finding the rule for one setting cost the same scroll
every time -- and these files carry the security clamps, the fail-closed
defaults, the write-back migrations and the credential list, where a
guess ships silently.

Each config.json domain now has its own module, with the two old files
kept as the facades every caller imports: config/fields.py owns the
field metadata and the shared value coercers; memory_sections,
integration_sections and service_sections own their sections' DTOs;
section_builders owns the _build_* helper of 28 sections, grouped by
the module that owns each section's DTO; migration owns the
write-back migration ids, the document transform and superseded-default
reporting. Imports run one way -- fields, the section owners, sections,
then section_builders/migration, then loader -- and a test pins that
graph. Every module split out keeps the kiro_crew.config.loader logger,
so a relocated warning keeps the name operators filter on.

Each file's residual core stays put because something outside the config
package names that file, not because it was convenient: the writer scans
exempt only loader.py, seven specs and the feature map cite it for
the clamp, credentials, port, agent resolution and telemetry parse, the
agent-spec read inventory and agent-SDK edge baseline key to it, the
second-boot witness keys the published counters to it, and the blocking
harness-parity and memory-store rules cover it; sections.py keeps the
DTOs that messaging, slack-gateway, crew-mode, history, stt-streaming,
metrics, decisions, security, model-selection, model-fallback, subagent,
acp-client and crew-log-projection name, plus the four constructs whose
source scans allow them only there. config.md carries that table.

Behaviour is unchanged: both facades re-export every historical name as
the same object, so every import still resolves, and the schema baseline
config-baseline.json regenerates byte-identical. A patch reaches the
code that looks the name up in the patched module: loader-resident seams
(the path helpers, the config writers, the clamp event,
DEFAULT_POOL_SIZE, record_adoptions, each _build_* name at its
_load_resolved call site, the snapshot globals) stay call-time seams on
the loader, while a helper read inside a relocated builder or migration
rule is patched on section_builders or migration. No test or caller that
predates this change patches one of the relocated names; config.md lists
both sets, and a contract test pins representative seams of each kind.

The one changed call shape is internal -- the migration transform takes
the adoption-ledger writer as an argument and the loader passes its own
record_adoptions at call time, preserving that patch seam.
@bolichen97
bolichen97 force-pushed the refactor/b07-config-composition branch from 4ca18a5 to 8e17f6c Compare September 28, 2026 07:17
@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 Sep 28, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Confirm the BASE-vs-HEAD equivalence snapshot was re-run on this exact revision — rebutted (verified on 8e17f6c)

Re-ran on this exact revision under Python 3.12, from committed trees extracted with git archive: base 631f8e6 against head 8e17f6c.
Identical: the 15 config module surfaces, 49 dataclasses, to_dict(), the JSON schema, the restart paths, six load scenarios with every loader log record, and the baseline generator output, which equals the committed config-baseline.json. The only addition is the loader._migration alias.
range-diff 4ca18a5 = 8e17f6c, so the patch is unchanged from the previous head. CI also byte-compares config-baseline.json in test_config_baseline.py, and 81 checks on this head are green.
Script and method: #issuecomment-5861161781.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Confirm the BASE-vs-HEAD equivalence snapshot was re-run on this exact revision — rebutted (verified on 8e17f6c)

Re-ran on this exact revision under Python 3.12, from committed trees extracted with git archive: base 631f8e6 against head 8e17f6c.
Identical: the 15 config module surfaces, 49 dataclasses, to_dict(), the JSON schema, the restart paths, six load scenarios with every loader log record, and the baseline generator output, which equals the committed config-baseline.json. The only addition is the loader._migration alias.
range-diff 4ca18a5 = 8e17f6c, so the patch is unchanged from the previous head. CI also byte-compares config-baseline.json in test_config_baseline.py, and 81 checks on this head are green.
Script and method: #issuecomment-5861161781.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Green age on head 8e17f6c259b8547c434c307b8db432c03d9ff06b. green_age.py --pr 14558 reports base +1 commit, 631f8e6d -> 35fac201, with an import overlap on test/test_remote_crew_chaining.py. That one commit is #14651, make three hop-guard cases hermetic on macOS. It changes only tests (test/test_hop_port_guard.py, test/test_remote_crew_chaining.py); this PR modifies neither file, and there is no conflict.

I checked it against this exact head without rebasing. I took an archive of 8e17f6c, overlaid main's two #14651 test files, and ran those tests with the head's src/:

test/test_remote_crew_chaining.py + test/test_hop_port_guard.py (main @ 35fac201 versions)
against src/ @ 8e17f6c: 176 passed

This head's green is kept as-is rather than re-synced. A re-sync would restart every check and review lane and change nothing that #14651 tests.

@bolichen97
bolichen97 merged commit 0c3a0eb into main Sep 28, 2026
97 checks passed
@bolichen97
bolichen97 deleted the refactor/b07-config-composition branch September 28, 2026 16:06
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 28, 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.

2 participants