Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix: blank chat panel, empty allowmode and stale comment

Chadpiha5d7062e0a959
diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsx
index 8af14bd9c..43392ea65 100644
--- a/src/components/ControlPanel.tsx
+++ b/src/components/ControlPanel.tsx
@@ -185,6 +185,11 @@ export default function ControlPanel({ initialSettingsSection }: ControlPanelPro
const agentAllowedByPolicy = usePolicyStore((s) =>
isAgentAllowed({ managed: s.managed, policy: s.policy })
);
+ // The sidebar hides the chat item when the policy disallows the agent, but
+ // the user may already be on the chat view when the policy arrives.
+ useEffect(() => {
+ if (!agentAllowedByPolicy && activeView === "chat") setActiveView("home");
+ }, [agentAllowedByPolicy, activeView]);
const [appVersion, setAppVersion] = useState<string | null>(null);
useEffect(() => {
if (!policyMinAppVersion) return;
diff --git a/src/components/ControlPanelSidebar.tsx b/src/components/ControlPanelSidebar.tsx
index cbe6cf18e..661e6a81d 100644
--- a/src/components/ControlPanelSidebar.tsx
+++ b/src/components/ControlPanelSidebar.tsx
@@ -84,7 +84,9 @@ export default function ControlPanelSidebar({
icon: React.ComponentType<{ size?: number; className?: string }>;
}[] = [
{ id: "home", label: t("sidebar.home"), icon: Home },
- ...(agentAllowed ? [{ id: "chat" as const, label: t("sidebar.chat"), icon: MessageSquare }] : []),
+ ...(agentAllowed
+ ? [{ id: "chat" as const, label: t("sidebar.chat"), icon: MessageSquare }]
+ : []),
{ id: "personal-notes", label: t("sidebar.notes"), icon: NotebookPen },
{ id: "upload", label: t("sidebar.upload"), icon: Upload },
{ id: "dictionary", label: t("sidebar.dictionary"), icon: BookOpen },
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx
index b6e211446..61953eaeb 100644
--- a/src/components/SettingsPage.tsx
+++ b/src/components/SettingsPage.tsx
@@ -311,7 +311,7 @@ function TranscriptionSection({
],
"transcription",
{ managed: policyManaged, policy: policyDoc },
- t("common.managedByOrg"),
+ t("common.managedByOrg")
);
const handleTranscriptionModeSelect = (mode: InferenceMode) => {
diff --git a/src/components/TranscriptionModelPicker.tsx b/src/components/TranscriptionModelPicker.tsx
index dbde45583..21e863e6a 100644
--- a/src/components/TranscriptionModelPicker.tsx
+++ b/src/components/TranscriptionModelPicker.tsx
@@ -662,7 +662,13 @@ export default function TranscriptionModelPicker({
}
}
},
- [cloudProviders, onCloudProviderSelect, onCloudModelSelect, setCloudTranscriptionBaseUrl, providerAllowed]
+ [
+ cloudProviders,
+ onCloudProviderSelect,
+ onCloudModelSelect,
+ setCloudTranscriptionBaseUrl,
+ providerAllowed,
+ ]
);
const handleLocalProviderChange = useCallback(
diff --git a/src/components/notes/ShareNoteDialog.tsx b/src/components/notes/ShareNoteDialog.tsx
index a63cf35ee..030104e4b 100644
--- a/src/components/notes/ShareNoteDialog.tsx
+++ b/src/components/notes/ShareNoteDialog.tsx
@@ -778,7 +778,8 @@ export default function ShareNoteDialog({ open, onOpenChange, note }: ShareNoteD
space &&
!(access?.grants ?? []).some(
(grant) =>
- grant.principal.type === "team" && space.teams.some((team) => team.id === grant.principal.id)
+ grant.principal.type === "team" &&
+ space.teams.some((team) => team.id === grant.principal.id)
) && (
<MemberRow
leading={<AudienceIcon />}
diff --git a/src/helpers/policyValidation.js b/src/helpers/policyValidation.js
index 856d65a00..a2736856b 100644
--- a/src/helpers/policyValidation.js
+++ b/src/helpers/policyValidation.js
@@ -13,7 +13,11 @@ function isValidPolicyShape(policy) {
typeof policy === "object" &&
POLICY_SCOPES.every(
(scope) =>
+ // The canonical schema enforces min-1 allowedModes ("enable at least
+ // one mode"), and reconciliation relies on allowedModes[0] existing to
+ // move users off a disallowed mode — an empty list is malformed.
Array.isArray(policy[scope]?.allowedModes) &&
+ policy[scope].allowedModes.length > 0 &&
Array.isArray(policy[scope]?.allowedByokProviders)
) &&
Array.isArray(policy.llm?.allowedEnterpriseProviders) &&
diff --git a/src/stores/policyStore.ts b/src/stores/policyStore.ts
index 861ef03fe..4828d2538 100644
--- a/src/stores/policyStore.ts
+++ b/src/stores/policyStore.ts
@@ -1,10 +1,6 @@
import { create } from "zustand";
import logger from "../utils/logger";
-import {
- useSettingsStore,
- selectResolvedLLMConfig,
- setResolvedLLMConfig,
-} from "./settingsStore";
+import { useSettingsStore, selectResolvedLLMConfig, setResolvedLLMConfig } from "./settingsStore";
import { INFERENCE_SCOPES, type InferenceScope } from "../config/inferenceScopes";
import {
isProviderValidForMode,
@@ -201,8 +197,10 @@ function reconcileModes(policy: OrgPolicy): void {
}
}
-// Providers are only reconciled for the mode that actually uses them; stale
-// values behind an inactive mode are filtered by the pickers when re-entered.
+// The transcription provider is a single store field, so it is reconciled
+// unconditionally. LLM providers are per-scope and only reconciled for the
+// mode that actually uses them; stale values behind an inactive mode are
+// filtered by the pickers when re-entered.
function reconcileProviders(policy: OrgPolicy): void {
const settings = useSettingsStore.getState();
diff --git a/test/helpers/policyValidation.test.js b/test/helpers/policyValidation.test.js
index acf8d49c6..fa84f0008 100644
--- a/test/helpers/policyValidation.test.js
+++ b/test/helpers/policyValidation.test.js
@@ -28,14 +28,22 @@ test("accepts a well-formed policy", () => {
assert.equal(isValidPolicyShape(validPolicy()), true);
});
-test("accepts empty allowlists", () => {
+test("accepts empty provider allowlists", () => {
const policy = validPolicy();
- policy.transcription.allowedModes = [];
- policy.llm.allowedModes = [];
+ policy.transcription.allowedByokProviders = [];
+ policy.llm.allowedByokProviders = [];
policy.llm.allowedEnterpriseProviders = [];
assert.equal(isValidPolicyShape(policy), true);
});
+test("rejects empty allowedModes (canonical schema enforces min 1)", () => {
+ for (const scope of ["transcription", "llm"]) {
+ const policy = validPolicy();
+ policy[scope].allowedModes = [];
+ assert.equal(isValidPolicyShape(policy), false, `${scope}.allowedModes empty`);
+ }
+});
+
test("rejects a missing or non-object policy", () => {
assert.equal(isValidPolicyShape(undefined), false);
assert.equal(isValidPolicyShape(null), false);