Skip to content

refactor: split config/loader.py into loader_* owners behind a facade - #20550

Merged
bolichen97 merged 1 commit into
mainfrom
refactor/linecap-s17-loader
Oct 17, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
refactor/linecap-s17-loader

Conversation

@bolichen97

@bolichen97 bolichen97 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: src/kiro_crew/config/loader.py drops from 7,958 lines to 904, under the 2,000-line cap. No behaviour changes, and every import path and patch target keeps working.

config/loader.py was the largest hand-written module in the config package and changed most weeks. A reviewer could not hold it in view, and the line-cap guard (scripts/check_file_line_cap.py) lists it as one of the files that must shrink.

Why it matters

Every config change, from the chat, cron, crew and app paths, edits this file. While it stays at 7,958 lines, each of those changes reaches review as a diff inside a file nobody can read whole. It also keeps the repository over the 2,000-line rule the maintainers set for the campaign (#20192).

Not a goal

  • No behaviour change: no new config key, default, validation, write path or log text.
  • No change to config/sections.py or the other config owners. They are other scopes.
  • No migration of callers off kiro_crew.config.loader. It stays the import path and the patch seam.
  • No rework of the code that moved. It moved verbatim, apart from the edits listed under "Move audit".

What changed (motivation → approach → change)

loader.py is now a facade over nine sibling owners, one responsibility each. It is built on kiro_crew._facade_mirror (#20337), so the patches the suite makes on kiro_crew.config.loader keep reaching the moved code: 71 names, with config_path and config_dir patched at hundreds of sites. A write or delete through the facade lands in every owner that binds the name. The code moved verbatim. The few edits are listed under "Move audit".

Owner Responsibility
config/loader.py The facade: the historical import block, the effective-model resolvers (resolve_effective_model, resolve_app_spawn_model, app_model_pin, the kiro-agent reference check), build_provider_factory, and the mirror glue
config/loader_credentials.py Credential keys, the .env reader and decoder, the dashboard port
config/loader_locations.py Data-home and workspace paths derived from config_dir()
config/loader_document.py config.json reads, the locked writers, the meta stamp, the validated-document cache keys
config/loader_builders.py Load-time field readers, the security clamp, the agent/session/telemetry/dashboard builders
config/loader_snapshots.py The published snapshots (materialized agents, alias table, compaction threshold, timezone) and their resolvers. Each rebound global has its one home here
config/loader_agents.py Crew identity and agent bindings
config/loader_writeback.py The migration write-back
config/loader_config.py KiroCrewConfig, whole
config/loader_pipeline.py The load pipeline and the one-call loaders built on the class
agent_sdk/acp_provider_class.py acp_provider_class(). It returns kiro_crew.providers.acp.AcpProvider, read at call time, so no config module imports the ACP layer

Two call cycles cross the owners. Each one is broken by a function-local import of the higher owner, the package's existing idiom for circular imports: the default-agent healer imports KiroCrewConfig, and KiroCrewConfig._load_resolved imports the pipeline. The owning spec, docs/system-specs/modules/config.md, is updated, and so are the docs and comments that name where moved code lives. Code is untouched outside the loader family except:

  • security_posture.py, which re-keys its redactor-registry row to config/loader_locations.py;
  • comment-only path fixes in docker/entrypoint.sh, apps/routes.py, the apps/builtins/aws_control supervisor backend.py, atomic_write.py, cli_commands.py, cli_help.py, context_management.py, dashboard/handlers/core.py, instances/registry.py, mcp_gateway/manager.py, messaging/registry.py, dashboard/messaging_api (feishu and imessage settings), platform_owner_compat.py, pod/runtime.py, pod/runtime_boot.py, sandbox_argv.py, security/exfil.py and windows_acl.py, plus the .kiro/specs/agent-workspace-bindings requirements status line.

Backwards compatibility

Compatible: every name kiro_crew.config.loader bound before still resolves on it, to the same object, and a patch through it still reaches the code that reads the name.

Reader: src/kiro_crew/config/loader.py:vault_channel_env_value -- chat -- served from config/loader_credentials.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:normalize_jira_host -- chat -- served from config/loader_credentials.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:jira_host_token_name -- chat -- served from config/loader_credentials.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:jira_global_token_applicable -- chat -- served from config/loader_credentials.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:env_path -- chat -- served from config/loader_credentials.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:env_bom_prefix -- chat -- served from config/loader_credentials.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:decode_env_bytes -- chat -- served from config/loader_credentials.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:read_env_file -- chat -- served from config/loader_credentials.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:read_env_text -- chat -- served from config/loader_credentials.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:undecodable_env_message -- chat -- served from config/loader_credentials.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:warn_undecodable_env -- chat -- served from config/loader_credentials.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:read_env_file_credential -- chat -- served from config/loader_credentials.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:resolve_env_credentials -- chat -- served from config/loader_credentials.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:resolve_env_credential -- chat -- served from config/loader_credentials.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:inject_kiro_cli_api_key -- chat -- served from config/loader_credentials.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:strip_kiro_cli_api_key -- chat -- served from config/loader_credentials.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:normalize_workspace_path -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:workspace_root -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:outbox_dir -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:config_path -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:read_config_text -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:overlay_pins -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:config_local_path -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:denied_commands_path -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:registry_trust_path -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:computer_use_state_path -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:oauth_endpoints_path -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:aws_consent_path -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:decisions_consent_path -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:file_delivery_consent_path -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:credential_redaction_path -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:ssh_auth_sock_consent_path -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:read_local_secret -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:materialize_workspace_dir -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:workspace_dir_for -- chat -- served from config/loader_pipeline.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:workspace_dir_from_entry -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:default_project_dir -- chat -- served from config/loader_pipeline.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:resolve_agent_config_path -- chat -- served from config/loader_locations.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:unsandboxed_exec_platform_default -- chat -- served from config/loader_document.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:unsandboxed_exec_declared -- chat -- served from config/loader_document.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:read_config_for_update -- chat -- served from config/loader_document.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:write_config_atomically -- chat -- served from config/loader_document.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:coerce_dict_section -- chat -- served from config/loader_document.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:coerce_config_field -- chat -- served from config/loader_document.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:update_config_locked -- chat -- served from config/loader_document.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:stamp_config_meta -- chat -- served from config/loader_document.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:refresh_config_meta_stamp -- chat -- served from config/loader_document.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:config_content_stamp -- chat -- served from config/loader_document.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:load_config_with_content_stamp -- chat -- served from config/loader_pipeline.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:resolve_loop_stall_exit_after -- release -- served from config/loader_builders.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:consume_managed_service_launch_environment -- release -- served from config/loader_builders.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:launched_as_managed_service -- release -- served from config/loader_builders.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:load_loop_stall_exit_after -- release -- served from config/loader_pipeline.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:read_config_document -- chat -- served from config/loader_pipeline.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:build_config -- chat -- served from config/loader_pipeline.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:persist_write_back -- chat -- served from config/loader_pipeline.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:refresh_materialized_agents -- app -- served from config/loader_snapshots.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:reset_dangling_default_agent -- chat -- served from config/loader_snapshots.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:publish_materialized_agents -- app -- served from config/loader_snapshots.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:schedule_materialized_agents_refresh -- app -- served from config/loader_snapshots.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:dispatch_kiro_agent -- app -- served from config/loader_snapshots.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:member_template_id -- crew page -- served from config/loader_snapshots.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:publish_agent_alias_snapshot -- chat -- served from config/loader_snapshots.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:agent_alias_snapshot -- chat -- served from config/loader_snapshots.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:next_config_load_ticket -- chat -- served from config/loader_snapshots.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:publish_autocompact_pct -- chat -- served from config/loader_snapshots.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:published_autocompact_pct -- chat -- served from config/loader_snapshots.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:publish_config_timezone -- cron -- served from config/loader_snapshots.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:published_config_timezone -- cron -- served from config/loader_snapshots.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:resolve_effective_agent -- crew page -- served from config/loader_snapshots.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:crew_autocompact_pct -- crew page -- served from config/loader_agents.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:resolve_crew_identity -- crew page -- served from config/loader_agents.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:default_template -- crew page -- served from config/loader_snapshots.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:resolve_agent_identity -- subagent -- served from config/loader_agents.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces
Reader: src/kiro_crew/config/loader.py:resolve_agent_bindings -- subagent -- served from config/loader_agents.py as the same object through the facade mirror; test_config_refactor_contract.py::TestFacadeNamespaces

Move audit

python3 move_audit.py --origin src/kiro_crew/config/loader.py (base = merge-base):

src/kiro_crew/config/loader.py: 8100 -> 914 lines; moved 92.85% (python-ast)
   changed: KiroCrewConfig.create_provider_factory [FunctionDef] 228 lines
   changed: reset_dangling_default_agent [FunctionDef] 95 lines
   changed: _materialized_kiro_agent [FunctionDef] 81 lines
   changed: resolve_effective_agent [FunctionDef] 54 lines
   changed: _locked_workspace_dir [FunctionDef] 22 lines
   changed: KiroCrewConfig._load_resolved [FunctionDef] 15 lines

295 of 301 units moved byte-for-byte in AST. In the 6 changed units, about 16 lines changed and nothing else:

Unit The only lines that changed Why
create_provider_factory from kiro_crew.providers.acp import (AcpProvider, ...) becomes a function-local from kiro_crew.agent_sdk.acp_provider_class import acp_provider_class and AcpProvider = acp_provider_class(). The nested -> AcpProvider annotation gets # type: ignore[valid-type]. Two prose "KiroCrew" become "Kiro Crew" The agent-SDK boundary gate fails an ACP-layer import on an added line, and a moved line is an added line. agent_sdk/acp_provider_class.py returns the class read at call time, so a patch of kiro_crew.providers.acp.AcpProvider still reaches the factory. Brand gate
KiroCrewConfig._load_resolved +1 function-local import of the pipeline The pipeline binds the class at import (_TOP_LEVEL_DEFAULTS, build_config's default), so it sits above the class's owner
reset_dangling_default_agent, _locked_workspace_dir +1 function-local from kiro_crew.config.loader_config import KiroCrewConfig each The healer and KiroCrewConfig call each other
_materialized_kiro_agent docstring "KiroCrew alias" becomes "Kiro Crew alias" Brand gate
resolve_effective_agent docstring "see the note in chat_handlers" becomes "see the note in chat_api/slot_create" The note moved there in #20521; a moved docstring line is an added line, so it names the note's current home

New files, with lines: loader_credentials.py 531, loader_locations.py 590, loader_document.py 1,137, loader_builders.py 1,107, loader_snapshots.py 1,214, loader_agents.py 258, loader_writeback.py 290, loader_config.py 1,464, loader_pipeline.py 1,393, agent_sdk/acp_provider_class.py 27. acp_provider_class.py is small on purpose: agent_sdk/ is the one tree the boundary lets import the ACP layer, so the accessor is a module of its own. loader_agents.py holds the agent-binding resolvers the healer does not need.

Diff shape (L36): git diff and git diff --minimal add the same lines in every changed file, for example loader.py +362 / +362. Whole diff: 938,195 bytes. L27 exception granted (refresh growth from doc unions).

Tests

  • New test/test_loader_owners_contract.py:
    • pins the owner list and order, an empty mirror exclusion set and divergent() == ();
    • shows a patch of kiro_crew.providers.acp.AcpProvider reaches the factory, and that no loader*.py imports the ACP layer;
    • shows each function-local cycle break is the only one and that a patch made through the facade reaches it;
    • for each of the 12 globals loader_snapshots rebinds: a write through the facade is what the owner's code reads, an owner rebind is what config.loader.<name> reads, and the facade binds no copy.
  • A facade inventory, read by test_campaign_facades_base_public_names, is added: test/campaign_facade_inventories/kiro_crew.config.loader.json holds the 303 base public project names and the 190 the facade binds by import, each with its home. The name set equals the public names the base module bound. The shared test file is not edited.
  • Row and key re-points in source-reading tests, each with a mutation that makes it fail. These are the composition-contract rows in test_config_refactor_contract, test_config_module_boundaries and test_cli_doctor_refactor_facade, the second-boot table in test/integration/test_boot_smoke.py, and the path-keyed inventories in test_agent_spec_hardened_reads, link_screen_sites, test_config_rmw_preserves_settings, test_instance_credential_pairing, test_agent_sdk_capabilities, test_argv_floor_inline_and_brace_scope and test_subagent_shared_scratch. No assertion is relaxed.
  • test_facade_mirror_guards.py (from refactor: add a mirror-aware facade helper for module splits #20337) now covers this facade. Every name the test trees patch through kiro_crew.config.loader reaches every owner that binds it.
  • Local runs:
    • every test file that imports or patches the loader: 860 files, 62,244 passed;
    • the tree-scan and agent-SDK suites: 225 files, 12,551 passed;
    • on base b6e801b6e3, under env -i: every test main changed since the last published base that touches the loader, the config sections or the source providers, plus the config, harness, facade, contract, guard and pin suites, 154 files, 13,395 passed. test_boot_smoke.py with test_campaign_facades_base_public_names.py: 74 passed, and adding a name the facade lacks to kiro_crew.config.loader.json turns the inventory test red;
    • test/integration under KIROCREW_INTEGRATION=1: 62 passed. The one failure, test_owner_only_boot, also fails on the base on this host. The second-boot witness keys its five snapshot counters to kiro_crew.config.loader_snapshots;
    • mypy over src/kiro_crew;
    • flake8, isort and black on the changed files;
    • the comment-history, brand, agent-SDK boundary, subprocess-encoding, harness-parity, memory-store-seam, sync-io, black and line-cap gates;
    • docs_lint.py, the flake-pattern ratchet, CI's semgrep configs (0 findings) and an installed-wheel import smoke.
  • local-gate.py --dry-run selects 2,988 backend and 1,201 frontend related files. That is over the 600-file bound, so the floor above ran instead and CI runs the full matrix.

Manual verification

N/A. This is a structural move. The suites that load, save and patch the config through kiro_crew.config.loader (860 files, below) exercise every moved path, and an installed-wheel smoke imports every new module.

Related Issues

Part of #20192

Follow-up: #21468 (an agent_sdk-level provider factory, so config stops reading the raw AcpProvider class and agent_sdk/acp_provider_class.py can go)

CI path references

None in .github/workflows/**. AUTOSDE.yaml adds src/kiro_crew/config/loader_*.py beside src/kiro_crew/config/loader.py in the harness-parity and memory-store-seam rules.

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 15, 2026 00:16
@bolichen97

bolichen97 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head: c776d25

  • What rule changed: No rule changed. Two sensitive files get path-only edits: one row in security_posture.NON_EGRESS_REDACTION_MODULES is re-keyed from config/loader.py to config/loader_locations.py, and a docstring in security/exfil.py names the two loader owners that import security symbols function-locally.
  • Before -> after: The census exempted the credential-redaction switch reader at config/loader.py; it now exempts the same unchanged code at its new home config/loader_locations.py. The exfil docstring change is prose only, with no code edit.
  • Worst case if wrong: The posture drift guard would report the moved switch reader as an unregistered redaction site, which fails CI loudly; nothing at runtime reads this row to permit or deny anything.
  • Evidence checked: test/test_security_posture.py passes on this head; breaking the credential_redaction_path( reader in config/loader_locations.py makes it fail on the now-stale row, so the re-keyed row is live (mutation M8 in the split's guard sweep). The moved function body is byte-identical per the move audit.
  • Tools still work: Yes, every tool path is unchanged; the loader facade keeps every name, patch target and import path, and the moved code runs the same bytes.
  • Backward compatible: Yes. kiro_crew.config.loader still binds every BASE public name to the same object, pinned by test_campaign_facades_base_public_names.py.
  • Existing tests: test_security_posture.py, test_facade_mirror_guards.py, test_loader_owners_contract.py and the config suites pass unmodified apart from path-row re-points.
  • How to undo: Revert this single commit; the facade and owners return to the one config/loader.py file and the row returns with it.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/sandbox_argv.py

  • src/kiro_crew/security/exfil.py

  • src/kiro_crew/security_posture.py

  • @bolichen97 posted a complete reasoning template for 3bcd620.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 15, 2026
@bolichen97
bolichen97 enabled auto-merge (squash) October 15, 2026 00:35
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 3bcd620de4bd71a87b99155981877e5f1fba9791 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 15, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 3bcd620de4bd71a87b99155981877e5f1fba9791 — 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 every edit listed under "Move audit" leaves behaviour unchanged. The description was cut off at 8000 bytes before that list.

What this change ships

Inventory (7 items) — 7 justified

Intent: keep the config loader readable and under the 2,000-line cap the maintainers set, with no behaviour change. This is a refactor, neither a FIX nor an ADDITION.

  1. config/loader.py is split into nine loader_* owner modules behind a _facade_mirror facade, the mechanism 40 modules already use; every import path and patch target still resolves — justified
  2. A new agent_sdk/acp_provider_class.py gives the provider factory the ACP class without the config package importing providers — justified
  3. The two AUTOSDE.yaml review rules now also cover config/loader_*.py — justified
  4. The security_posture non-egress redaction row is re-keyed to config/loader_locations.py — justified
  5. The config/loader.py rows are dropped from the line-cap, agent-sdk-boundary and docs-lint baselines — justified
  6. The spec, RFC, docs and comments now name the new owner files — justified
  7. Tests are re-pointed to the owners, plus a new owners-contract test and a facade inventory — justified

[FIRST-PRINCIPLES-REVIEWED] 3bcd620

Description read

[DESCRIPTION-READ] 8d9d9783c53e71accbda8e90ca0cbc7cfff035332855cc53ecc128075b272f39

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

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

One thing to check: guards that scan source by path, such as test_env_file_bom.py's loader.py exemption, now apply to the loader_* owners and need to pass for the right reason.

[DESIGN-REVIEWED] 3bcd620

Description read

[DESCRIPTION-READ] 4eaa2098490cec188c4a671c4f4f2c2dc9e27f6cd41041d62fdfdb28ea5635ff

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 3bcd620de4bd71a87b99155981877e5f1fba9791 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 3bcd620

Verdict parsed from the review's SHA-scoped output markers for commit 3bcd620de4bd71a87b99155981877e5f1fba9791.

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

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 3bcd620de4bd71a87b99155981877e5f1fba9791 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 3bcd620

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

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Full CI suite at this head proves the facade's patch seams

Disposition: rebutted (verified; no change needed).
All suites at c776d25 are green: Backend Tests 3.12 shards 1-8, Windows shards 1-8, IPv6, namespace sandbox, crew container, Kernel Lock Owner, Integration, and the four E2E lanes.
Those suites carry every kiro_crew.config.loader patch target in the repo, all unmodified apart from path-row re-points.
test_facade_mirror_guards.py derives patch reach from that corpus, and test_loader_owners_contract.py pins both write directions for every rebound snapshot global.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • The three seams the facade no longer serves have no non-test caller

Disposition: rebutted (verified on this head; no change needed).
Dunder patches: git grep over src/ finds no read or setattr of config.loader.__version__ or any other loader dunder. The meta stamp reads loader_document's own binding.
get_type_hints: the only src/ callers are config/schema.py (config DTO classes) and dashboard_templates/parity.py (template contracts). Neither targets the seven owner functions.
importlib.reload: the only src/ caller is apps/backend.py, which reloads its own owners and never config.loader.
The seams are recorded in docs/system-specs/modules/config.md, "The loader owners".

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

Which legitimate operations does 3bcd620de4bd71a87b99155981877e5f1fba9791 newly refuse? Updated in place on each push. A script-confirmed regression blocks; the model proposes candidates and never decides a refusal.

Verdict basis: adjudicated, zero confirmed regressions.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 11 classified, 0 newly refused, 11 still allowed.
  • ubuntu-latest (platform posix): 11 classified, 0 newly refused, 11 still allowed.
  • windows-latest (platform windows): 11 classified, 0 newly refused, 11 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: PASS

TIGHTENING: none -- this PR splits the 7958-line src/kiro_crew/config/loader.py into loader_agents.py, loader_builders.py, loader_config.py, loader_credentials.py, loader_document.py, loader_locations.py, loader_pipeline.py, loader_snapshots.py and loader_writeback.py, with config/loader.py kept as a re-export facade. Every other change outside that split is a docstring, doc or baseline edit. The pieces the deny composite and its guards read moved unchanged: oauth_endpoints_path(), which security/exfil.py _load_operator_oauth_endpoints calls through the facade (+ oauth_endpoints_path, in the facade re-exports, body copied as-is into loader_locations.py); denied_commands_path(), which feeds the sensitive-tier opt-out state; and workspace_root(). The hunk in security/exfil.py changes only a docstring (- module's import graph independent of the loader's: ``config/loader.py``` → + ... ``config/loader_snapshots.py```). No hunk touches hooks.py, `SHELL_DENY_TIERS`, a sensitive-command argv floor, an exfil shape, or the deny-rule catalog.

ADJUDICATED: 15 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE: The diff adds no new path, separator, interpreter or env-var assumption. The moved workspace_root, config_dir-relative keystone paths and the Windows DACL branch of write_config_atomically are carried over unchanged. Candidates still probe both spellings of the operations in the touched area:

  • posix: a config-scoped git diff, a grep for stale config/loader.py references, the package listing, and the env-scrubbed .venv/bin/python -m pytest run of the new owner-contract and module-boundary tests.
  • windows: the same diff with \ separators, Select-String and Get-ChildItem over loader_*.py, and .venv\Scripts\python.exe -m pytest over the split-loader tests. That includes the RMW test that exercises the Windows owner-DACL branch.
  • any: the boundary, line-cap and memory-store-seam gates whose baselines and AUTOSDE globs this PR edits, kirocrew config set/get writes and reads, and a check that the facade still re-exports oauth_endpoints_path, the function the exfil tier reads.

No platform the diff assumes is left unprobed.

[SCOPE-REVIEWED] 3bcd620

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision labels Oct 15, 2026
@bolichen97
bolichen97 force-pushed the refactor/linecap-s17-loader branch from c776d25 to c3d748e Compare October 15, 2026 04:19
@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head commit: c3d748e

  • What rule changed: No rule changed. Two sensitive files get path-only edits: one row in security_posture.NON_EGRESS_REDACTION_MODULES is re-keyed from config/loader.py to config/loader_locations.py, and a docstring in security/exfil.py names the two loader owners that import security symbols function-locally.
  • Before -> after: The census exempted the credential-redaction switch reader at config/loader.py; it now exempts the same unchanged code at its new home config/loader_locations.py. The exfil docstring change is prose only, with no code edit.
  • Worst case if wrong: The posture drift guard would report the moved switch reader as an unregistered redaction site, which fails CI loudly; nothing at runtime reads this row to permit or deny anything.
  • Evidence checked: test/test_security_posture.py passes on this head (rebased onto main be55864, the sensitive-file edits unchanged); breaking the credential_redaction_path( reader in config/loader_locations.py makes it fail on the now-stale row, so the re-keyed row is live (mutation M8 in the split's guard sweep). The moved function body is byte-identical per the move audit.
  • Tools still work: Yes, every tool path is unchanged; the loader facade keeps every name, patch target and import path, and the moved code runs the same bytes.
  • Backward compatible: Yes. kiro_crew.config.loader still binds every BASE public name to the same object, pinned by test_campaign_facades_base_public_names.py.
  • Existing tests: test_security_posture.py, test_facade_mirror_guards.py, test_loader_owners_contract.py and the config suites pass unmodified apart from path-row re-points.
  • How to undo: Revert this single commit; the facade and owners return to the one config/loader.py file and the row returns with it.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Non-verbatim edits in the moved code, listed where a reader sees them

Disposition: rebutted (answered here; no code change). These 6 units are the only ones move_audit.py reports changed; 285 of 291 moved byte-for-byte.
KiroCrewConfig.create_provider_factory: from kiro_crew.providers.acp import AcpProvider becomes AcpProvider = acp_provider_class(), -> AcpProvider gets # type: ignore[valid-type], and "KiroCrew" becomes "Kiro Crew" twice.
KiroCrewConfig._load_resolved: adds a function-local import of build_config, persist_write_back, read_config_document from loader_pipeline.
reset_dangling_default_agent, _locked_workspace_dir: each adds a function-local from kiro_crew.config.loader_config import KiroCrewConfig.
_materialized_kiro_agent: "KiroCrew alias" becomes "Kiro Crew alias". resolve_effective_agent: the docstring cites chat_api/slot_create in place of chat_handlers.
To reproduce: git diff --minimal origin/main...c3d748e746eda78e90e38733399b20f2f2d2b202 -- src/kiro_crew/config/. test_loader_owners_contract.py pins each cycle-breaking import and the provider seam.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • restored_state writes and restores loader_snapshots' own binding

Disposition: rebutted (verified on this head; no change needed).
setattr(loader, name, v) goes through _facade_mirror.MirroredModule.__setattr__, which writes every owner that binds the same object, here loader_snapshots. monkeypatch.undo() restores through that same path.
On this head I ran the fixture's steps under pytest.MonkeyPatch for all 14 snapshot names. The dict copies and a sentinel write reached vars(loader_snapshots), undo() restored every original object there, and the facade bound no copy.
The test pins it too: test_a_facade_write_is_what_the_owner_code_reads asserts vars(loader_snapshots)[name] is sentinel and name not in vars(loader).

@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 15, 2026
@bolichen97
bolichen97 force-pushed the refactor/linecap-s17-loader branch from c3d748e to fd774f9 Compare October 15, 2026 06:39
@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head commit: fd774f9

  • What rule changed: No rule changed. Two sensitive files get path-only edits: one row in security_posture.NON_EGRESS_REDACTION_MODULES is re-keyed from config/loader.py to config/loader_locations.py, and a docstring in security/exfil.py names the two loader owners that import security symbols function-locally.
  • Before -> after: The census exempted the credential-redaction switch reader at config/loader.py; it now exempts the same unchanged code at its new home config/loader_locations.py. The exfil docstring change is prose only, with no code edit.
  • Worst case if wrong: The posture drift guard would report the moved switch reader as an unregistered redaction site, which fails CI loudly; nothing at runtime reads this row to permit or deny anything.
  • Evidence checked: test/test_security_posture.py passes with this patch (run on base fec3e98; the rebases since, up to main 740bf62, leave the patch byte-identical per git range-diff); breaking the credential_redaction_path( reader in config/loader_locations.py makes it fail on the now-stale row, so the re-keyed row is live (mutation M8 in the split's guard sweep). The moved function body is byte-identical per the move audit.
  • Tools still work: Yes, every tool path is unchanged; the loader facade keeps every name, patch target and import path, and the moved code runs the same bytes.
  • Backward compatible: Yes. kiro_crew.config.loader still binds every BASE public name to the same object, pinned by test_campaign_facades_base_public_names.py.
  • Existing tests: test_security_posture.py, test_facade_mirror_guards.py, test_loader_owners_contract.py and the config suites pass unmodified apart from path-row re-points.
  • How to undo: Revert this single commit; the facade and owners return to the one config/loader.py file and the row returns with it.

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

Copy link
Copy Markdown
Contributor Author
  • span=69ca22358eca Split the acp_provider_class extraction and its baseline change into their own PR

Disposition: rebutted (disproportionate).
Landed before this move, the accessor would be dead code: config/loader.py would still import the provider class itself, and the baseline row could not change.
Landed after this move, it is too late, because the moved create_provider_factory needs the accessor to pass the boundary gate in the same commit.
It is one 27-line module whose only caller is this move. The move audit lists the one-line call site as a justified edit, so the moved lines can still be checked by diff.

@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 16, 2026

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

REQUEST_CHANGES at f200791. The split itself looks sound.

A read-only AST audit against merge-base b00e744 finds every moved unit identical once docstrings are set aside, with none missing. The only residual edits are the listed function-local cycle-break imports and the AcpProvider accessor in create_provider_factory (loader_config.py L1237-L1246). CI is green.

What to change: your Design disposition agrees that the boundary row goes while config still depends on the raw AcpProvider (acp_provider_class.py L17-L27). It says the agent_sdk-level factory "is logged as a maintainer follow-up", but no issue is linked. Please open one issue for that follow-up and link it in the PR description.

This also needs a human reviewer by policy, even after that. The diff moves the credential and .env handling into config/loader_credentials.py and edits security_posture.py. I did not run the tests locally.

— crew-pr-reviewer (r107)

@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: passed Eligible automated validation passed for the current revision labels Oct 16, 2026
config/loader.py (7,958 lines) becomes a 904-line facade over nine
sibling owners, one responsibility each: credentials, locations,
document I/O, builders, published snapshots, agent resolution, the
migration write-back, KiroCrewConfig, and the load pipeline. The
facade keeps its whole import block, the effective-model resolvers
and build_provider_factory, and installs kiro_crew._facade_mirror, so
every name callers and tests import or patch on
kiro_crew.config.loader resolves to the same object and a patch
reaches every owner that reads it.

Code moves verbatim. KiroCrewConfig.create_provider_factory reaches
AcpProvider through the new agent_sdk.acp_provider_class, read at
call time, so no config module imports the ACP layer and loader.py
leaves the agent-SDK boundary baseline. Two call cycles between
owners are broken by function-local imports, and three moved prose
lines spell the product name "Kiro Crew".

Specs, docs, comments and path-keyed test rows that name where the
moved code lives are updated in place. test_loader_owners_contract.py
pins the owner list, the provider route, the cycle breaks and the one
home of each rebound snapshot global.

Part of #20192
@bolichen97
bolichen97 force-pushed the refactor/linecap-s17-loader branch from f200791 to 3bcd620 Compare October 17, 2026 04:18
@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 17, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Refreshed onto main 23affa7e78. This head, 3bcd620de4, replaces f20079172b.

Main grew config/loader.py again, so the split now takes it from 8,100 lines to 914. Every owner is still under 1,600 lines; the largest is loader_config.py at 1,464.

Changes since f20079172b:

Change What
Port of #20946 into moved code _build_dashboard_config, now in config/loader_builders.py, binds github_hosts before the DashboardConfig(...) call, passes github_hosts=github_hosts, and adds the new bitbucket_server_hosts=_sections._coerce_bitbucket_server_hosts(...) argument. The unit is AST-identical to main's loader.py. move_audit.py still lists only the six edits named under Move audit.
Port of #21352 into moved code _session_sort_from moves to config/loader_builders.py, beside _folder_sort_from, and _build_dashboard_config gains session_sort=section.read("session_sort", _session_sort_from). Both units are AST-identical to main's loader.py, and the facade still serves _session_sort_from.
messaging/registry.py docstring Main re-pointed the Slack hoist to slack/gateway_runtime/channel_boot.py on the line next to this PR's config/loader_config.py re-point. The merged docstring keeps both.

Local evidence, all under an isolated HOME. The suites ran on main b6e801b6e3. The rebase onto 23affa7e78 at push time left this commit's own lines unchanged (git range-diff, context only). The 24 commits in between touch nothing under config/, and on the pushed head the static gates plus test_security_posture.py, the facade-inventory, loader-owner and config-refactor contract tests pass again (264 passed).

  • the static gates, the line cap, L36 (default and --minimal diffs add the same lines) and mypy all pass. The diff is 938,195 bytes, under a one-off L27 exception for refresh growth from doc unions;
  • 154 test files, 13,395 passed;
  • test_boot_smoke.py with test_campaign_facades_base_public_names.py: 74 passed.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head commit: 3bcd620

  • What rule changed: No rule changed. Three sensitive files get path-only edits. One row in security_posture.NON_EGRESS_REDACTION_MODULES is re-keyed from config/loader.py to config/loader_locations.py. A docstring in security/exfil.py names the loader owners that import security symbols function-locally. A comment in sandbox_argv.py now names config/loader_config.py as the module that seeds the scrubbed credential keys into os.environ.
  • Before -> after: The census exempted the credential-redaction switch reader at config/loader.py and now exempts the same unchanged code at config/loader_locations.py. The exfil.py and sandbox_argv.py edits are comment text only, with no code change.
  • Worst case if wrong: The posture drift guard would report the moved switch reader as an unregistered redaction site and fail CI loudly. No runtime path reads this row, or either comment, to permit or deny anything.
  • Evidence checked: test/test_security_posture.py passes on this head (main 23affa7), and the three sensitive-file hunks are byte-identical to those reviewed on f200791. Breaking the credential_redaction_path( reader in config/loader_locations.py makes the census fail on the stale row, so the re-keyed row is live (mutation M8 in the guard sweep). The moved function body is byte-identical per the move audit.
  • Tools still work: Yes. Every tool path is unchanged: the loader facade keeps every name, patch target and import path, and the moved code runs the same bytes.
  • Backward compatible: Yes. kiro_crew.config.loader still binds every base public name to the same object, pinned by test/campaign_facade_inventories/kiro_crew.config.loader.json through test_campaign_facades_base_public_names.py.
  • Existing tests: test_security_posture.py, test_facade_mirror_guards.py, test_loader_owners_contract.py and the config suites pass unmodified, apart from path-row re-points; 147 files and 12,652 tests ran under an isolated HOME.
  • How to undo: Revert this single commit. The facade and owners go back to the one config/loader.py file, and the row and both comments go back with it.

@bolichen97

Copy link
Copy Markdown
Contributor Author

@iamwhatever, on review 5550752443 (crew-pr-reviewer r107, REQUEST_CHANGES at f20079172b):

Re-requesting your review at 3bcd620de4.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • The path-keyed .env reader guard scans the loader_ owners, and they pass because they call the decoder*

Disposition: checked on this head; no change needed.
test_env_file_bom.py::TestEveryReaderUsesTheLoaderDecoder exempts only config/loader.py. That file is now the facade, with no .env reader. The owners are not exempt, so every moved reader is scanned.
The scan reaches loader_credentials.read_env_file_credential and KiroCrewConfig.load_credentials in loader_config.py. Both call read_env_text. It also reaches env_path and resolve_env_credentials, which read nothing from the file. It finds no bare reader.
Mutation: in memory, replace the one read_env_text( call in either owner with Path.read_text(. The scan then names loader_credentials.py:327 read_env_file_credential and loader_config.py:1131 load_credentials, so the guard is live on the owners.
The other source-reading tests whose rows or keys name the loader are re-pointed, each with a mutation that makes it fail (Tests section).

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Each edit under Move audit leaves behaviour unchanged

Disposition: checked on this head; no change needed.
move_audit.py against the merge-base finds 295 of 301 units byte-identical in AST. The six changed units carry about 16 changed lines.
create_provider_factory: it gets the same kiro_crew.providers.acp.AcpProvider class object through agent_sdk.acp_provider_class() at call time, which is why a patch of that attribute still reaches the factory (test_loader_owners_contract.py). The # type: ignore[valid-type] changes typing only.
_load_resolved, reset_dangling_default_agent, _locked_workspace_dir: each gains one function-local import of an owner. The name binds to the same object the one-module file bound, and it runs only when the function runs.
_materialized_kiro_agent and resolve_effective_agent: docstring wording only (the brand spelling and the note's current file). The code is unchanged.

@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 17, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at 3bcd620 for human review by policy. The split itself looks sound.

My r107 request is resolved: the AcpProvider follow-up is now tracked in #21468, whose body covers the accessor removal, and the description links it. I re-ran a read-only AST audit against merge-base 23affa7. All 228 units of the old config/loader.py are present, and 225 are identical once docstrings are set aside. The remaining three differ only by the listed function-local imports and the acp_provider_class() accessor in create_provider_factory. The Design and First Principles punchlines on this head have answers, GPT and Opus report no findings, and CI is green.

This still needs a human reviewer. The diff moves the credential and .env handling into config/loader_credentials.py and edits security_posture.py, security/exfil.py and sandbox_argv.py. Those edits are path and comment text only. A human approval clears this hold. I did not run the tests locally.

— crew-pr-reviewer (r108)

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.

3 participants