Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(platforms): derive primary from enabled set; never resurrect a removed platform
cyh8f62f4dc31e1
diff --git a/config/v2_config.py b/config/v2_config.pyindex bfac09534..a1b223436 100644--- a/config/v2_config.py+++ b/config/v2_config.py@@ -324,7 +324,12 @@ class PlatformsConfig:supported_text = "', '".join(supported_platform_ids())raise ValueError(f"Config 'platforms.primary' must be one of: '{supported_text}'")elif self.primary not in normalized:- normalized.insert(0, self.primary)+ # ``enabled`` is the source of truth and ``primary`` is now an+ # internal default with no user-facing control. A primary that is+ # not in the enabled set (e.g. a stale value surviving a deep config+ # merge after the platform was disabled) must FOLLOW enabled, not+ # resurrect a removed platform by forcing itself back into the list.+ self.primary = normalized[0]self.enabled = normalizeddiff --git a/tests/test_v2_config_platform_registry.py b/tests/test_v2_config_platform_registry.pyindex b2a9a203b..51e07249c 100644--- a/tests/test_v2_config_platform_registry.py+++ b/tests/test_v2_config_platform_registry.py@@ -134,6 +134,31 @@ def test_validate_strips_workbench_and_retargets_primary() -> None:assert workbench.primary == "avibe"+def test_validate_derives_primary_from_enabled_without_resurrecting() -> None:+ # ``enabled`` is the source of truth; ``primary`` is an internal default with+ # no user-facing control. A stale primary that is NOT in the enabled set+ # (e.g. surviving a deep config merge after the platform was disabled) must+ # FOLLOW enabled — retarget to the first enabled platform — instead of+ # forcing the removed platform back into ``enabled``. This is what lets the+ # UI persist an enabled-set change by sending only ``platforms.enabled``.+ stale = PlatformsConfig(enabled=["discord"], primary="slack")+ stale.validate()+ assert stale.enabled == ["discord"]+ assert stale.primary == "discord"++ # Order preserved; primary tracks the first enabled platform.+ multi = PlatformsConfig(enabled=["telegram", "discord"], primary="slack")+ multi.validate()+ assert multi.enabled == ["telegram", "discord"]+ assert multi.primary == "telegram"++ # A primary still present in enabled is left untouched.+ kept = PlatformsConfig(enabled=["slack", "discord"], primary="discord")+ kept.validate()+ assert kept.enabled == ["slack", "discord"]+ assert kept.primary == "discord"++def test_config_payload_includes_platform_catalog_and_setup_state() -> None:config = _base_config(platforms=PlatformsConfig(enabled=["slack", "discord", "telegram", "lark", "wechat"], primary="slack"),@@ -178,14 +203,16 @@ def test_platforms_validate_allows_empty_enabled_and_anchors_avibe() -> None:def test_platforms_validate_keeps_non_empty_enabled_unchanged() -> None:- # Has-IM behavior is untouched: the primary is still force-inserted into a- # non-empty enabled list at the front.+ # ``enabled`` is the source of truth: a stale primary not in the enabled set+ # retargets to the first enabled platform; the enabled list is NOT grown to+ # resurrect the removed platform (see+ # test_validate_derives_primary_from_enabled_without_resurrecting).platforms = PlatformsConfig(enabled=["discord"], primary="slack")platforms.validate()- assert platforms.primary == "slack"- assert platforms.enabled == ["slack", "discord"]+ assert platforms.primary == "discord"+ assert platforms.enabled == ["discord"]def test_workbench_only_config_round_trips_with_avibe_primary() -> None:diff --git a/ui/src/components/steps/PlatformSelection.tsx b/ui/src/components/steps/PlatformSelection.tsxindex c8ed353ae..07e4d21e8 100644--- a/ui/src/components/steps/PlatformSelection.tsx+++ b/ui/src/components/steps/PlatformSelection.tsx@@ -76,9 +76,13 @@ export const PlatformSelection: React.FC<PlatformSelectionProps> = ({ data, onNe// setup).const initialPlatforms = useMemo(() => getEnabledPlatforms(data), [data]);const platformCatalog = useMemo(() => getPlatformCatalog(data), [data]);+ // The credential-tab fallback must be a configurable IM platform — never the+ // always-on workbench (which has no credentials and isn't in the selectable+ // grid), so default to the first IM platform rather than the full catalog.+ const defaultCredentialPlatform = useMemo(() => getImPlatforms(data)[0]?.id || 'slack', [data]);const [selected, setSelected] = useState<string[]>(initialPlatforms);const [activeCredentialPlatform, setActiveCredentialPlatform] = useState<string>(- initialPlatforms[0] || platformCatalog[0]?.id || 'slack'+ initialPlatforms[0] || defaultCredentialPlatform);const [credentialDraft, setCredentialDraft] = useState<Record<string, any>>(() => buildInitialCredentialDraft(data));const [validating, setValidating] = useState(false);@@ -86,9 +90,9 @@ export const PlatformSelection: React.FC<PlatformSelectionProps> = ({ data, onNeuseEffect(() => {if (!selected.includes(activeCredentialPlatform)) {- setActiveCredentialPlatform(selected[0] || platformCatalog[0]?.id || 'slack');+ setActiveCredentialPlatform(selected[0] || defaultCredentialPlatform);}- }, [activeCredentialPlatform, platformCatalog, selected]);+ }, [activeCredentialPlatform, defaultCredentialPlatform, selected]);const togglePlatform = (platform: string) => {setSelected((current) => {