Skip to content

fix(config): refuse unknown keys on config set --local - #21794

Merged
iamwhatever merged 1 commit into
mainfrom
fix/9909-config-set-local-unknown-key
Oct 21, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/9909-config-set-local-unknown-key

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: kirocrew config set --local refuses a key nothing reads, the same way plain kirocrew config set already does, so a pinned setting cannot silently do nothing.

kirocrew config set --local memory.enabled false prints ✅ memory.enabled = false (saved to config.local.json) and exits 0. No code reads memory.enabled, so the setting has no effect. The same command without --local answers ❌ Unknown key: memory.enabled and exits 1. The --local path only warned when the top-level section was unknown (bogus.key), and wrote the key anyway.

Why it matters

config.local.json is the overlay that wins over config.json, so a user reaches for --local exactly when they want a setting to stick. A typo or a guessed key there looks pinned, prints a success line, and changes nothing. The issue reporter hit this with memory.enabled while trying to turn off memory injection; the real keys are memory.inject_memory and memory.inject_lessons.

Not a goal

  • The size caps for the lessons and memory context blocks asked for in Expose memory and lessons context blocks to config: disable toggles and size caps #9909. They still need a maintainer ruling on whether to expose them at all, and this PR does not touch them.
  • Changing what plain config set accepts. Its key check is unchanged; this PR moves it so both paths run it.
  • Validating keys that other writers (the dashboard, the capability writer) put into config.local.json.

What changed (motivation → approach → change)

Symptom: config set --local stores any dotted key. Cause: the key check (_dict_set on the loaded config, then _declared_entry plus the first-write type check) lived only in the non-local branch, after the local/base split. Change: that check moves unchanged into _refuse_unknown_key in cli_config.py, called once before the split, so --local refuses the keys plain config set refuses, with the same ❌ Unknown key: <key> and exit 1, writing nothing. On --local only, the check also accepts a key to_dict() writes from outside its section (_SECTION_KEYS_EMITTED_ELSEWHERE in config/resolution.py, such as slack.dm_activation), because the loader reads it there even when the loaded document omits it. Its value is still checked: against the registry row for the field it comes from (slack_dm_activation, observe_max_messages, slack.trusted_bot_ids), and for slack.dm_activation against the activation modes, using the loader's own _validate_activation. The old section-only warning is removed, since the check covers it. Keys the loaded config already holds still work on --local, including an edition section stored only in config.json or only in config.local.json. The config and cli specs describe the check and that extra --local set.

Backwards compatibility

Breaking: config set --local <key> now exits 1 for any key plain config set refuses (a key the loaded config does not hold and the schema does not declare); before, it wrote the key with at most a warning. That includes keys the loader does read but the check cannot see: a field of a map member that is not stored yet (agent.role_models.subagent on an empty map, agents.<new>.model) and per-channel keys under slack.channels.<id>. The slack keys to_dict() writes from outside the section (slack.dm_activation, slack.observe_max_messages, ...) stay accepted on --local. Plain config set is unchanged. Writer sweep on origin/main @ 7bc2f37: no code in src/, scripts/, website/src/ or .github/ runs kirocrew config set --local; the other "--local" argv hits are git clone --local and git config --local. The documented examples all name keys the check accepts: agent.log_level (docs/system-specs/modules/config.md), agent.model (src/kiro_crew/docs/configuration.md), dashboard.tailscale.enabled (cli_commands.py message), agents.<name>.model for an existing crewmate (crewmate_prune_migration.py, crew-mode.md), and registries (cli_commands.py comment).

Known follow-up (not in this PR): the schema registry declares no member names for fixed-member maps (agent.role_models) and spells the per-channel slack keys by dataclass field name (slack_channels.*), so the shared check refuses new agent.role_models.<role> and slack.channels.<id>.* leaves on both paths. Teaching the registry those names would let both paths accept them.

Known gap (not in this PR): #22755. config set --local <section> '<object>' replaces the whole overlay section and drops the keys it already held. That write behaviour is the same on main and is unchanged here.

Reader: src/kiro_crew/config/loader_pipeline.py:load -- chat|cron|subagent|app|crew page|release -- it reads config.local.json as before; unknown keys already on disk are still merged and preserved (_extra_keys / _extra_sections), only new CLI writes of unknown keys are refused.
Reader: src/kiro_crew/crewmate_prune_migration.py:overlay agents check -- release -- reads agents.<name> from the overlay; config set --local agents.<name>.model still writes for a crewmate that exists, and config set --local agents '{"<name>": {...}}' works for a new one.
Reader: test/test_config_overlay.py::TestCliConfigSetLocal -- release -- the overlay tests now write agent.streaming, a real key, in place of the unread agent.yolo.

Tests

test/test_config_overlay.py::TestCliConfigSetLocal:

  • test_local_set_unknown_key_refused[bogus.key] and [memory.enabled]: an unknown section and an unknown leaf in a known section each exit 1 with Unknown key, and an existing config.local.json stays byte-for-byte unchanged.
  • test_local_set_refuses_what_plain_set_refuses[...]: agent.role_models.subagent, agent.role_models.subagnet, agents.newname.model, telegram.accounts.b1.bot_token, agent.apps_trusted.foo and registries.foo.name exit 1 on --local with nothing written, as they do on plain config set.
  • test_local_set_emitted_elsewhere_key_keeps_overlay_siblings: with the overlay holding slack.open_channels, config set --local slack.dm_activation mention writes the leaf, keeps open_channels, and the loader reads dm_activation as mention.
  • test_plain_set_emitted_elsewhere_key_still_refused: plain config set slack.dm_activation mention still exits 1 with Unknown key.
  • test_local_set_emitted_elsewhere_bad_value_refused[...]: slack.dm_activation bogus, slack.dm_activation 5 and slack.observe_max_messages lots exit 1 on --local with nothing written.
  • test_local_set_real_memory_toggle_still_written: memory.inject_lessons false still lands in config.local.json.
  • test_local_set_with_corrupt_base_writes_overlay_only: a malformed config.json does not block --local and stays byte-for-byte unchanged.
  • The write, corrupt-overlay and non-dict-overlay tests now use agent.streaming, because agent.yolo is not a config key and is now refused.

Determinism: TestCliConfigSetLocal passed 20/20 runs at -n0 and 10/10 at -n 4 --dist loadgroup beside test/test_cli_config_set_lists.py and test/test_cli_config_defaults.py; all 64 ids of test/test_config_overlay.py passed in a shuffled order (seed 11483). prove.py reports PROVEN: reverting the production change turns the new tests red.

Manual verification

On a scratch KIROCREW_HOME:

  • kirocrew config set --local memory.enabled false prints ❌ Unknown key: memory.enabled, exits 1, and leaves config.local.json as it was.
  • kirocrew config set --local agent.streaming false over a corrupt config.local.json still resets it and writes {"agent": {"streaming": false}}.
  • With {"foo": {"bar": 1}} in config.json, or only in config.local.json (an edition section), config set --local foo.bar 3 still writes.

Related Issues

Part of #9909

Pattern harvest

Not generalizable: the one other config set destination (--file) installs a whole document rather than a dotted key, so there is no second per-key write path that could skip this check.

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

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

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

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 18, 2026
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks. The PR moves the existing key check so both config set paths run it, and it names the one break, new map-member leaves now refused on --local, as Breaking:.

Notes

  • --local now refuses new agent.role_models.<role> and slack.channels.<id>.* leaves, which the loader does read. The fix is the registry follow-up the PR describes (declaring member names), so land it before users hit this through --local.

[DESIGN-REVIEWED] fcadeef

Description read

[DESCRIPTION-READ] f676ffd31113570c543a470a007360202e804fd227a434f961499c7cbc0b60a9

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of fcadeefbe435c4c2bea1681f10a07f4af548688b — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

The fix reuses the existing key check and _SECTION_KEYS_EMITTED_ELSEWHERE instead of adding a second mechanism. The spec sentence it reverses only described the old behaviour and gave no reason for it, and #9909 shows that behaviour hurt a user.

Notes

  • Item 5 — rides along: if key == "slack.dm_activation" and _validate_activation(str(parsed)) != parsed adds a new refusal that is not part of the Goal ("refuses a key nothing reads"). Before this change, the loader quietly turned a bad value into mention. Subtraction: delete the slack.dm_activation enum branch in _refuse_emitted_elsewhere_value and keep only the registry type check.

What this change ships

Inventory (6 items) — 5 justified

Intent: a user pinning a setting with config set --local should be told when the key does nothing, instead of seeing a false success. FIX.

  1. config set --local <unknown key> now exits 1 with Unknown key and writes nothing — justified
  2. --local now type-checks a declared leaf the first time it is written, as plain set already did — justified
  3. The old "not a recognized config section" warning is gone — justified
  4. --local still accepts the slack keys to_dict() writes from outside the section (slack.dm_activation, …), with their values type-checked — justified
  5. --local slack.dm_activation <bad mode> is now refused instead of being degraded to mention — rides along
  6. New map-member keys (agent.role_models.subagent, agents.<new>.model) are now refused on --local too, and the config/cli specs are updated — justified

[FIRST-PRINCIPLES-REVIEWED] fcadeef

Description read

[DESCRIPTION-READ] 01315b7b475d1bf02ee0553d5aac782051357af4e084847b3418d31e4ae5f58d

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] fcadeef

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

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

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] fcadeef

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

@iamwhatever
iamwhatever force-pushed the fix/9909-config-set-local-unknown-key branch from c374cbc to d3f8a98 Compare October 18, 2026 07:38
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 18, 2026
@iamwhatever
iamwhatever force-pushed the fix/9909-config-set-local-unknown-key branch from d3f8a98 to 8ec4780 Compare October 18, 2026 08:13
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 18, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: top-level-section guard on wildcard map acceptance

  • span=a1c24af5df65 fixed in 8ec4780: slack_channels.<id>.activation was accepted but nothing reads it

Fixed. _refuse_unknown_key consults _declared_map_entry only when the key's first segment is a top-level key of the loaded document.
slack_channels is the dataclass field name in SCHEMA_REGISTRY; build_config reads Slack channels from slack.channels, so slack_channels.C0123.activation now exits 1 with Unknown key.
agent.role_models.<role>, agents.<new>.model and telegram.accounts.<new>.bot_token stay accepted. Of the 54 map-wildcard rows, only slack_channels.* has a first segment absent from the loaded document.
The slack_channels example is gone from the docs and the docstrings; test_name_under_unsupported_wildcard_refused[slack_channels.C0123.activation] pins the refusal.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 18, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: fewest-wildcards tie-break in _declared_map_entry

  • span=c91d2490b212 fixed in 8ec4780: the tie-break never fires

Removed. _declared_map_entry returns the first qualifying registry row; the docstring sentence about the tie-break is gone.
A verifier checked every pair of the 54 qualifying wildcard rows: no two can match one key, so behaviour is unchanged.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: second segment-by-segment registry matcher

  • span=bc4a367adc22 fixed in 8ec4780: _declared_map_entry duplicated _is_list_key's matcher

Fixed. One helper, _path_matches(pattern_parts, parts), does the length check and the per-segment *-or-equal comparison; _is_list_key and _declared_map_entry both call it.
_is_list_key results are unchanged (still True for agent.apps_trusted and telegram.accounts.<id>.allowed_user_ids).

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Design punchline: does config set --local still work when config.json is malformed? rebutted

Yes. KiroCrewConfig.load() logs the parse error and falls back to defaults; a declared key is accepted and only config.local.json is written.
The malformed config.json is left byte-for-byte unchanged (the loader skips write-back on a degraded load).
Pinned by test_local_set_with_corrupt_base_writes_overlay_only in 8ec4780, which points the loader at the malformed temp base.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Design punchline: are keys of an extra section stored only in config.local.json still accepted? rebutted

Yes. KiroCrewConfig.load() merges the overlay before to_dict(), and unknown sections and keys are carried in _extra_sections / _extra_keys, so _dict_set finds them.
Checked on a scratch home with only config.local.json = {"foo": {"bar": 1}, "memory": {"zzz": 2}}: config set --local foo.bar 3 and config set --local memory.zzz 3 both succeed and write 3.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • First Principles punchline: plain config set now accepts new map members, and an unquoted number for a string map member is refused rebutted

Both are intended and stated in the PR body. Both destinations share one key check, so plain config set gains new members of declared map fields (agents.<new>.model), type-checked against the registry row.
agent.env.PORT 8080 is refused with expected string, got int because the loader expects a string there; the quoted form '"8080"' works. The missing retry hint is recorded under Backwards compatibility as a known follow-up, out of this PR's goal.

@iamwhatever
iamwhatever force-pushed the fix/9909-config-set-local-unknown-key branch from 8ec4780 to f4be1d8 Compare October 18, 2026 08:47
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 18, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • span=6a96966538cb rebutted (cli_config.py:695): --local slack.dm_activation / slack.channels.<id>.activation refused

Not a defect against this PR's goal: plain config set on origin/main refuses both keys with the same Unknown key, because SCHEMA_REGISTRY spells them slack_dm_activation / slack_channels.* and to_dict() omits them at their defaults.
The goal is parity with plain config set; f4be1d8 keeps origin/main's plain check unchanged and runs it on both paths.
A working --local form exists: config set --local slack '{"dm_activation":"mention"}' deep-merges over config.json (test_local_set_parent_object_deep_merges).
The registry spelling is recorded in the PR body as a known follow-up, out of this PR's goal.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: wildcard map-member acceptance (_declared_map_entry, _path_matches, top-level guard)

  • span=6a96966538cb fixed (cli_config.py:770): plain config set agent.role_models.subagnet accepted, then dropped on load

Fixed in f4be1d8 by removing the mechanism: the retrospective ruled it beyond the goal, since it widened plain config set and accepted keys nothing reads.
_declared_map_entry, _path_matches and the top-level guard are gone; _is_list_key is byte-identical to origin/main.
agent.role_models.subagnet exits 1 on both paths again (test_local_set_refuses_what_plain_set_refuses).

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Design punchline: does the parent-object --local form for agent.role_models deep-merge and keep base keys? rebutted

Yes. Scratch home with config.json = {"agent": {"streaming": false, "role_models": {"background": "base-bg"}}}.
config set --local agent.role_models.subagent local-sub exits 1 (Unknown key), the same as plain config set on origin/main; config set --local agent.role_models '{"subagent": "local-sub"}' exits 0.
KiroCrewConfig.load() then reads role_models = {'background': 'base-bg', 'subagent': 'local-sub'} and streaming = False: the overlay deep-merges and keeps the base keys.
AGENTS.md names agent.role_models.<role> as the setting, not a config set command, so it stays accurate; the parent-object form is in the config spec.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • First Principles punchline: --local agent.role_models.<role> on an empty map exits 1, while AGENTS.md names that setting rebutted

Intended parity: plain config set agent.role_models.subagent x on origin/main exits 1 the same way, because the stored map is empty and the registry declares only agent.role_models.*.
AGENTS.md names the setting, not a config set command, so it stays accurate. The --local form that works is the parent object: config set --local agent.role_models '{"subagent": "m"}', which deep-merges (checked on a scratch home: base background kept, subagent added).
Teaching the registry the fixed role names is the known follow-up recorded in the PR body, outside this PR's goal.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 18, 2026
@iamwhatever
iamwhatever force-pushed the fix/9909-config-set-local-unknown-key branch from c58e5a0 to 9759851 Compare October 21, 2026 07:14
@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 Oct 21, 2026
@iamwhatever
iamwhatever force-pushed the fix/9909-config-set-local-unknown-key branch from 9759851 to b031427 Compare October 21, 2026 10:45
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased onto main ef0ec3d, which carries the CI skip fix (#22717, for #22697) that made Coverage Gate fail closed. No conflict and no change to this PR's diff; CI re-running.

@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 Oct 21, 2026
@iamwhatever
iamwhatever force-pushed the fix/9909-config-set-local-unknown-key branch from b031427 to 5d1a6e7 Compare October 21, 2026 11:15
@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • span=28c494760b7a fixed in 5d1a6e7: --local slack.dm_activation was refused, and the documented whole-object workaround dropped overlay siblings

Fixed. With --local, _refuse_unknown_key also accepts <section>.<name> keys listed in config/resolution.py:_SECTION_KEYS_EMITTED_ELSEWHERE (exact two-segment match, set read from that dict), so config set --local slack.dm_activation mention writes the leaf and keeps the overlay's other slack keys.
The whole-object config set --local slack '{...}' advice is removed from config.md and from the PR body; test_local_set_parent_object_deep_merges is gone.
Plain config set is unchanged (test_plain_set_emitted_elsewhere_key_still_refused). test_local_set_emitted_elsewhere_key_keeps_overlay_siblings pins the sibling-keeping write.
The object-value replace in _mutate_local_overlay is the same on main and is unchanged here; it is filed as #22755 and linked from the PR body as a known gap.

@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • span=2057aee8f94a rebutted (cli_config.py:722): first writes of map leaves (slack.channels.<id>.activation, agent.role_models.<role>) are refused on --local

Not a defect in this PR's goal: plain config set on origin/main refuses these exact leaves the same way while the map is empty, because SCHEMA_REGISTRY declares them only as wildcard rows (slack_channels.*, agent.role_models.*). This PR makes --local run that same check.
Accepting them needs per-map member validation (fixed role names, channel fields). That is the registry fix recorded as option B and as the PR body's known follow-up. The owner ruled option A for this PR, and that ruling stands.
Earlier rounds of this PR tried CLI-side wildcard matching for these keys. Each variant accepted keys nothing reads (agent.role_models.subagnet, slack_channels.*), which is the defect this PR removes.
Not security, data-loss or corruption: a refused write changes nothing on disk and exits 1 with Unknown key.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt 5d1a6e7: agent: span 2057aee8f94a matches plain config set's refusal on main and is the owner-ruled option A tradeoff (registry fix deferred), not a defect in this PR's goal; rebuttal in issuecomment-6314941152.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@iamwhatever marked the gpt AI finding as false positive, not applicable, or explicitly accepted for 5d1a6e7a106c595bffde8d97196c660aa1647bf7.

agent: span 2057aee8f94a matches plain config set's refusal on main and is the owner-ruled option A tradeoff (registry fix deferred), not a defect in this PR's goal; rebuttal in issuecomment-6314941152.

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

@iamwhatever

iamwhatever commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Review-ready at 5d1a6e7a10 (one commit on main f6521469aa, mergeable, not a draft). This replaces the earlier review-ready notes.

  • PR Readiness passed: 104 checks, 0 failing; label readiness: passed. The CI skip fix (ci: keep one-surface PRs' test shards running behind the lint gate #22717) is in the base, and the backend test matrix ran.
  • Opus BLOCKING 28c494760b7a is fixed: --local also accepts the slack keys in _SECTION_KEYS_EMITTED_ELSEWHERE (e.g. slack.dm_activation), keeps the overlay's other keys, and the whole-object advice is gone. Plain config set is unchanged.
  • GPT BLOCKING 2057aee8f94a (first writes of map leaves such as agent.role_models.<role>) is rebutted as the owner-ruled option A tradeoff and overridden at this head (agent override, reason on the PR). Design and First Principles passed.
  • Known gap filed as config set --local <section> '<object>' replaces the whole overlay section and drops existing keys #22755: config set --local <section> '<object>' replaces the whole overlay section. That write behaviour is the same on main and unchanged here.
  • Left for a maintainer: option A vs B, approval and merge. Part of #9909; the size-cap question there stays open.

No merge, approval or auto-merge from this side.

@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 21, 2026
@iamwhatever
iamwhatever force-pushed the fix/9909-config-set-local-unknown-key branch from 5d1a6e7 to fcadeef Compare October 21, 2026 12:35
@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: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Oct 21, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Review-ready at fcadeefbe4 (one commit on main 7bc2f37760, mergeable, not a draft). This replaces the earlier review-ready notes.

  • PR Readiness passed: 104 checks, 0 failing; label readiness: passed. The backend test matrix ran.
  • New on this head: on --local, the slack keys in _SECTION_KEYS_EMITTED_ELSEWHERE are value-checked with the existing validators (_declared_type_error on the field's registry row, _validate_activation for slack.dm_activation), so slack.dm_activation bogus exits 1 with nothing written.
  • GPT and Opus reviewed this head with no blocking findings; Design and First Principles passed.
  • The /ai-review override gpt on the earlier head 5d1a6e7a10 was posted by this session's agent, not by a maintainer. It is on hold pending the owner's ruling on option A and does not apply to this head.
  • Known gap: config set --local <section> '<object>' replaces the whole overlay section and drops existing keys #22755 (--local <section> '<object>' replaces the overlay section; same on main).
  • Left for a maintainer: option A vs B on single map keys, approval and merge. Part of #9909.

No merge, approval or auto-merge from this side.

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

Reviewed at fcadeef.

Approve. On main, config set --local only warned about an unknown top-level section and wrote any leaf into config.local.json, which outranks config.json, so a key nothing reads looked pinned. The existing key check now runs for both destinations before any write (cli_config.py:306), after the enum, beacon and tailnet gates, with the same Unknown key text and exit 1 that plain config set already used.

Confirmed from the CLI against temporary homes: on the merge base, set --local memory.enabled false, bogus.x 2 and agents.nobody.model m all write; on this head all three exit 1 with Unknown key, while set --local agent.log_level debug still stores DEBUG. An overlay that already holds unknown keys still loads, and config get and set --local of a real key keep working; the loader is unchanged. The slack keys that to_dict writes from outside the section are accepted on --local and their values are checked: a wrong type and an activation outside the selectable values are both refused.

Ran test_config_overlay, test_cli_config_set_lists and test_cli_config_defaults (147 passed). Mutations: running the check only on plain set, dropping the overlay flag, skipping the value check, skipping the activation check, skipping the type check, and applying the exemption to plain set each turn a test red. There is no MCP config-set tool and the dashboard PATCH already refuses unknown keys, so there is no parity gap. The spec change is in the same commit.

Follow-up, not blocking: the loader keeps unknown keys on round-trip, so a key that is already stored counts as held. An overlay pinned with memory.enabled before this fix still accepts set --local memory.enabled true, and the same holds for any stale unknown key on plain set. A note in config.md, or a check against the schema rather than the loaded document for keys that only the round-trip preserves, would close it.

@iamwhatever
iamwhatever merged commit b34f145 into main Oct 21, 2026
105 checks passed
@iamwhatever
iamwhatever deleted the fix/9909-config-set-local-unknown-key branch October 21, 2026 18:55
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 21, 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