/auto-mode-setup writes duplicate/contradictory entries to settings.json on re-run
/auto-mode-setup writes duplicate/contradictory entries to settings.json on re-run
What happened:
Ran /auto-mode-setup once, it proposed and applied an autoMode.environment block (some facts "not queryable," e.g. repo visibility, because gh wasn't authenticated yet). Authenticated gh, re-ran the wizard, it correctly resolved some of the previously-unknown facts (e.g. repo visibility went from "not queryable, assume private" to the actual value "private"). Applied that proposal too.
Result: settings.json now has both the old and new versions of the same fact as separate list items in autoMode.environment — e.g. two different "Repository visibility" lines that directly contradict each other, plus duplicated "Sensitive data locations" and "Trusted repo" entries with slightly different wording. The apply step reported "environmentEntriesPreserved": 24 — it's preserving old entries rather than superseding them when a newer proposal re-covers the same fact.
Expected: re-running the wizard (or at least re-applying a proposal that covers the same named fact, e.g. "Repository visibility") should replace the stale line, not append a second contradictory one. Over repeated runs this will only get messier — worth deduping by fact/heading, or having apply diff against existing entries by their leading **Label**: key.
Secondary issue, same session: the wizard form has an "Also scan your other repos" checkbox. Checked it on a re-run expecting org-wide repo survey to populate (visibility split across repos, branch protection, etc.) — the applied proposal still came back with the sibling-repo-related fields at "None configured" / "not gathered," same as when the box was unchecked. Not able to tell from the client side whether the scan ran and found nothing actionable, or didn't run at all — the proposal's notes array said "Sibling repo docs via gh were NOT GATHERED" without explaining why given the checkbox was on.
Environment: macOS, Claude Code CLI session, gh v2.97.0 freshly authenticated via gh auth login (SSH protocol) mid-session.