Repository navigation
fix(setup): replace every spelling of a Slack name the setup wizard writes - #28557
cruisercohen wants to merge 1 commit into
Conversation
827c60f to
619c707
Compare
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the fix reuses the existing [DESIGN-REVIEWED] 901c9ee Description read[DESCRIPTION-READ] 9fce4835044b8b8be0276fa63a01997ebd9c86d62958301fc3c40a328c9c62e0 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The fix is aimed at the mechanism (the literal-name merge in the setup wizard's only What this change shipsInventory (4 items) — 4 justifiedIntent: On Windows, a re-run of the Slack setup step must leave the newly typed tokens in force, not the old lowercase lines. This is a FIX (#23768).
[FIRST-PRINCIPLES-REVIEWED] 901c9ee Description read[DESCRIPTION-READ] e811851eaba86fec589a2ca0c1cbee62a8c843f883b584fc1cb9cce5655bd28c That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
619c707 to
0c5d339
Compare
|
GPT 6.1 finding (cli_setup.py, preserve the first nonempty saved owner value): confirmed and fixed in 0c5d339. _pop_env_entry now returns the first NON-EMPTY spelling, matching boot's propagation (loader_config skips empty values; _effective_entry_values uses the same rule), while still removing every spelling. New tests: test_the_live_value_is_the_first_non_empty_spelling (helper) and test_a_rejected_member_id_keeps_the_saved_owner_behind_an_empty_spelling (end to end on the Windows key rule: empty lowercase owner line, populated canonical line, typed member ID rejected, saved owner kept). Both fail without the change; prove.py PROVEN. |
0c5d339 to
901c9ee
Compare
|
[operator: bolichen97] Continuing this in #32379; thanks for the start. |
…32379) On Windows os.environ is case-insensitive and boot keeps the first non-empty spelling of a name in .env. The setup step read and merged .env by literal name, so an older slack_bot_token line stayed ahead of the new SLACK_BOT_TOKEN line and kept the old token in force. The step folds every spelling of the app token, bot token and owner ID into the canonical name, matched with _env_name_key and carrying the value in force, so the prompt shows that value and the save replaces it. On POSIX the names are separate variables and nothing changes. Builds on #28557. Closes #23768
…32379) On Windows os.environ is case-insensitive and boot keeps the first non-empty spelling of a name in .env. The setup step read and merged .env by literal name, so an older slack_bot_token line stayed ahead of the new SLACK_BOT_TOKEN line and kept the old token in force. The step folds every spelling of the app token, bot token and owner ID into the canonical name, matched with _env_name_key and carrying the value in force, so the prompt shows that value and the save replaces it. On POSIX the names are separate variables and nothing changes. Builds on #28557. Closes #23768 (cherry picked from commit eae2b50)
|
Thanks, @cruisercohen. Closing this as superseded: #23768 was fixed by #32379 ("fix: let new setup --slack tokens replace older lowercase .env lines", merged 2026-11-07). Main now folds every spelling of each Slack name in |
Problem / Motivation
Goal: On Windows, new Slack credentials saved by the setup wizard's Slack step are the ones the gateway uses.
On Windows os.environ is case-insensitive, and boot propagates .env with setdefault in file order. The wizard merged .env by literal name, so an older lowercase bot line (slack_bot_token=) stayed ahead of the new SLACK_BOT_TOKEN= line and kept the old value in force, with no error shown.
Why it matters
A Windows operator who re-runs the Slack step to replace a revoked or wrong value sees a success message, but the gateway and every child keep the old value, so Slack stays broken with no clue why.
Not a goal
What changed (motivation → approach → change)
Symptom: old value still in force after setup on Windows → cause: the merge dict in src/kiro_crew/cli_setup.py is keyed by literal name, so a differently-cased line survives ahead of the new one → change: a new _pop_env_entry helper removes every spelling of an entry, matched with _env_name_key (the helper #23836 used for the dashboard and Weixin writers), before the app, bot and owner ID entries are written. For the owner ID the live value (the first non-empty spelling, as boot propagates it) is carried over under the canonical name, so the existing keep/drop logic for a rejected member ID still sees it. On POSIX _env_name_key is the literal name, so behavior there is unchanged.
Backwards compatibility
Compatible: on Windows the lowercase lines it drops were the same os.environ entry as the canonical ones it writes; on POSIX nothing changes.
Removes nothing: the only lines dropped are other spellings of an entry that is rewritten in the same save, so no value a reader could see is lost.
Tests
Proof: PROVEN test/test_cli_setup_slack.py::TestOtherSpellingsOfASavedName::test_on_windows_the_new_values_replace_every_spelling, test/test_cli_setup_slack.py::TestOtherSpellingsOfASavedName::test_a_rejected_member_id_keeps_the_saved_owner_behind_an_empty_spelling (head 901c9ee)
Manual verification
Not run on a Windows host. The issue thread has a Windows reproduction of the failure on main; the unit test reproduces the same merge with the Windows key rule.
Related Issues
Fixes #23768
Sibling sweep
Swept: git grep -nE 'partition("=")' -- src/ and git grep -n _env_name_key -- src/
Sibling: src/kiro_crew/dashboard/handlers/weixin_qr.py -- not affected -- already matches lines by _env_name_key
Sibling: src/kiro_crew/dashboard/messaging_api/channel_config_writes.py -- not affected -- already matches lines by _env_name_key
Pattern harvest
Rule candidate: review-prompt
Pattern: a .env writer that merges lines by literal name instead of _env_name_key
Checklist
Contribution License Agreement
Contributed under the project's Apache-2.0 license.