fix: harden getSettings() channels — type guard and deduplication - #150
Merged
Conversation
nox-0x
approved these changes
Apr 15, 2026
nox-0x
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. The Array.isArray guard correctly prevents a real TypeError crash when channels is malformed (e.g. a string or boolean from hand-edited JSON), and the Set deduplication is a clean, zero-overhead hardening. Tests cover both cases well. One non-blocking observation: the length > 0 guard before Set creation is technically redundant (spreading an empty Set produces [] with zero cost), but it is harmlessly defensive and documents intent.
Add Array.isArray guard to prevent crash when channels is a non-array value in settings.json (e.g. a string). Add Set-based deduplication to prevent duplicate channel entries from propagating to CLI flags. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
aterrylu
force-pushed
the
terry/fix-channel-duplication
branch
from
April 15, 2026 06:52
be47585 to
079a6eb
Compare
aterrylu
marked this pull request as ready for review
April 15, 2026 06:52
aterrylu
enabled auto-merge (squash)
April 15, 2026 06:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Array.isArrayguard togetSettings()— prevents crash whenchannelsis a non-array value insettings.json(e.g. hand-edited to a string)Set-based deduplication to prevent duplicate channel entries from propagating to--dangerously-load-development-channelsCLI flagsbuildArgs()noting dedup happens at the source (getSettings())Context
Investigated a reported 5x channel duplication in spawned CC sessions. The duplication was not reproducible with CC 2.1.109 — both manual PTY tests and server-spawned sessions show exactly one
server:autonomosentry. The issue may have been a transient CC bug in an earlier version.The "no MCP server configured with that name" warning is a known CC-side issue related to internal MCP config partitioning — cannot be fixed from autonomOS.
These changes are defensive hardening of the settings layer:
Array.isArrayguard prevents a realTypeErrorcrash ifchannelsis malformedSetdedup is a no-op on the normal path but catches edge casesTest plan
getSettings()returns defaults when channels is a stringgetSettings()deduplicates channels arraymake checkpasses (biome + tsc + all tests)🤖 Generated with Claude Code