From 0f9c50cd58fbf1a75c4ef4d54a234bdb7529fa07 Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Mon, 29 Dec 2025 23:58:33 +0200 Subject: [PATCH] fix: suppress logging for agent scope fetch and configuration updates --- README.md | 1 + packages/ui/src/stores/useAgentsStore.ts | 35 ++++++------------------ 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index efdf4e2d..3510e7d5 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![GitHub forks](https://img.shields.io/github/forks/btriapitsyn/openchamber?style=flat&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgZmlsbD0iI2YxZWNlYyIgdmlld0JveD0iMCAwIDI1NiAyNTYiPjxwYXRoIGQ9Ik04OCw2NEEyNCwyNCwwLDEsMSw2NCw0MCwyNCwyNCwwLDAsMSw4OCw2NFpNMTkyLDQwYTI0LDI0LDAsMSwwLDI0LDI0QTI0LDI0LDAsMCwwLDE5Miw0MFoiIG9wYWNpdHk9IjAuMiI%2BPC9wYXRoPjxwYXRoIGQ9Ik0yMjQsNjRhMzIsMzIsMCwxLDAtNDAsMzF2MTdhOCw4LDAsMCwxLTgsOEg4MGE4LDgsMCwwLDEtOC04Vjk1YTMyLDMyLDAsMSwwLTE2LDB2MTdhMjQsMjQsMCwwLDAsMjQsMjRoNDB2MjVhMzIsMzIsMCwxLDAsMTYsMFYxMzZoNDBhMjQsMjQsMCwwLDAsMjQtMjRWOTVBMzIuMDYsMzIuMDYsMCwwLDAsMjI0LDY0Wk00OCw2NEExNiwxNiwwLDEsMSw2NCw4MCwxNiwxNiwwLDAsMSw0OCw2NFptOTYsMTI4YTE2LDE2LDAsMSwxLTE2LTE2QTE2LDE2LDAsMCwxLDE0NCwxOTJaTTE5Miw4MGExNiwxNiwwLDEsMSwxNi0xNkExNiwxNiwwLDAsMSwxOTIsODBaIj48L3BhdGg%2BPC9zdmc%2B&logoColor=FFFCF0&labelColor=100F0F&color=BC5215)](https://github.com/btriapitsyn/openchamber/network/members) [![GitHub release](https://img.shields.io/github/v/release/btriapitsyn/openchamber?style=flat&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgZmlsbD0iI2YxZWNlYyIgdmlld0JveD0iMCAwIDI1NiAyNTYiPjxwYXRoIGQ9Ik0xMjgsMTI5LjA5VjIzMmE4LDgsMCwwLDEtMy44NC0xbC04OC00OC4xOGE4LDgsMCwwLDEtNC4xNi03VjgwLjE4YTgsOCwwLDAsMSwuNy0zLjI1WiIgb3BhY2l0eT0iMC4yIj48L3BhdGg%2BPHBhdGggZD0iTTIyMy42OCw2Ni4xNSwxMzUuNjgsMThhMTUuODgsMTUuODgsMCwwLDAtMTUuMzYsMGwtODgsNDguMTdhMTYsMTYsMCwwLDAtOC4zMiwxNHY5NS42NGExNiwxNiwwLDAsMCw4LjMyLDE0bDg4LDQ4LjE3YTE1Ljg4LDE1Ljg4LDAsMCwwLDE1LjM2LDBsODgtNDguMTdhMTYsMTYsMCwwLDAsOC4zMi0xNFY4MC4xOEExNiwxNiwwLDAsMCwyMjMuNjgsNjYuMTVaTTEyOCwzMmw4MC4zNCw0NC0yOS43NywxNi4zLTgwLjM1LTQ0Wk0xMjgsMTIwLDQ3LjY2LDc2bDMzLjktMTguNTYsODAuMzQsNDRaTTQwLDkwbDgwLDQzLjc4djg1Ljc5TDQwLDE3NS44MlptMTc2LDg1Ljc4aDBsLTgwLDQzLjc5VjEzMy44MmwzMi0xNy41MVYxNTJhOCw4LDAsMCwwLDE2LDBWMTA3LjU1TDIxNiw5MHY4NS43N1oiPjwvcGF0aD48L3N2Zz4%3D&logoColor=FFFCF0&labelColor=100F0F&color=205EA6)](https://github.com/btriapitsyn/openchamber/releases/latest) [![Created with OpenCode](docs/references/badges/created-with-opencode.svg)](https://opencode.ai) +[![Ask Zread](https://img.shields.io/badge/Ask_Zread-_.svg?style=flat&labelColor=100F0F&color=3AA99F&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTQuOTYxNTYgMS42MDAxSDIuMjQxNTZDMS44ODgxIDEuNjAwMSAxLjYwMTU2IDEuODg2NjQgMS42MDE1NiAyLjI0MDFWNC45NjAxQzEuNjAxNTYgNS4zMTM1NiAxLjg4ODEgNS42MDAxIDIuMjQxNTYgNS42MDAxSDQuOTYxNTZDNS4zMTUwMiA1LjYwMDEgNS42MDE1NiA1LjMxMzU2IDUuNjAxNTYgNC45NjAxVjIuMjQwMUM1LjYwMTU2IDEuODg2NjQgNS4zMTUwMiAxLjYwMDEgNC45NjE1NiAxLjYwMDFaIiBmaWxsPSIjZmZmIi8%2BCjxwYXRoIGQ9Ik00Ljk2MTU2IDEwLjM5OTlIMi4yNDE1NkMxLjg4ODEgMTAuMzk5OSAxLjYwMTU2IDEwLjY4NjQgMS42MDE1NiAxMS4wMzk5VjEzLjc1OTlDMS42MDE1NiAxNC4xMTM0IDEuODg4MSAxNC4zOTk5IDIuMjQxNTYgMTQuMzk5OUg0Ljk2MTU2QzUuMzE1MDIgMTQuMzk5OSA1LjYwMTU2IDE0LjExMzQgNS42MDE1NiAxMy43NTk5VjExLjAzOTlDNS42MDE1NiAxMC42ODY0IDUuMzE1MDIgMTAuMzk5OSA0Ljk2MTU2IDEwLjM5OTlaIiBmaWxsPSIjZmZmIi8%2BCjxwYXRoIGQ9Ik0xMy43NTg0IDEuNjAwMUgxMS4wMzg0QzEwLjY4NSAxLjYwMDEgMTAuMzk4NCAxLjg4NjY0IDEwLjM5ODQgMi4yNDAxVjQuOTYwMUMxMC4zOTg0IDUuMzEzNTYgMTAuNjg1IDUuNjAwMSAxMS4wMzg0IDUuNjAwMUgxMy43NTg0QzE0LjExMTkgNS42MDAxIDE0LjM5ODQgNS4zMTM1NiAxNC4zOTg0IDQuOTYwMVYyLjI0MDFDMTQuMzk4NCAxLjg4NjY0IDE0LjExMTkgMS42MDAxIDEzLjc1ODQgMS42MDAxWiIgZmlsbD0iI2ZmZiIvPgo8cGF0aCBkPSJNNCAxMkwxMiA0TDQgMTJaIiBmaWxsPSIjZmZmIi8%2BCjxwYXRoIGQ9Ik00IDEyTDEyIDQiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPgo8L3N2Zz4K&logoColor=FFFCF0)](https://zread.ai/btriapitsyn/openchamber) Web and desktop interface for the [OpenCode](https://opencode.ai) AI coding agent. Works alongside the OpenCode TUI. diff --git a/packages/ui/src/stores/useAgentsStore.ts b/packages/ui/src/stores/useAgentsStore.ts index 0aa7e9ee..a0a7e764 100644 --- a/packages/ui/src/stores/useAgentsStore.ts +++ b/packages/ui/src/stores/useAgentsStore.ts @@ -171,8 +171,8 @@ export const useAgentsStore = create()( const scope = data.scope ?? data.sources?.md?.scope ?? data.sources?.json?.scope; return { ...agent, scope: scope as AgentScope | undefined }; } - } catch (err) { - console.error(`[AgentsStore] Failed to fetch scope for agent "${agent.name}":`, err); + } catch { + // Ignore scope fetch errors and fall back to agent defaults } return agent; }) @@ -196,8 +196,6 @@ export const useAgentsStore = create()( startConfigUpdate("Creating agent configuration…"); let requiresReload = false; try { - console.log('[AgentsStore] Creating agent:', config.name); - const agentConfig: Record = { mode: config.mode || "subagent", }; @@ -212,8 +210,6 @@ export const useAgentsStore = create()( if (config.disable !== undefined) agentConfig.disable = config.disable; if (config.scope) agentConfig.scope = config.scope; - console.log('[AgentsStore] Agent config to save:', agentConfig); - // Get current directory for project-level agent support const currentDirectory = getCurrentDirectory(); const queryParams = currentDirectory ? `?directory=${encodeURIComponent(currentDirectory)}` : ''; @@ -230,8 +226,6 @@ export const useAgentsStore = create()( throw new Error(message); } - console.log('[AgentsStore] Agent created successfully'); - const needsReload = payload?.requiresReload ?? true; if (needsReload) { requiresReload = true; @@ -247,8 +241,7 @@ export const useAgentsStore = create()( emitConfigChange("agents", { source: CONFIG_EVENT_SOURCE }); } return loaded; - } catch (error) { - console.error("[AgentsStore] Failed to create agent:", error); + } catch { return false; } finally { if (!requiresReload) { @@ -261,9 +254,6 @@ export const useAgentsStore = create()( startConfigUpdate("Updating agent configuration…"); let requiresReload = false; try { - console.log('[AgentsStore] Updating agent:', name); - console.log('[AgentsStore] Config received:', config); - const agentConfig: Record = {}; if (config.mode !== undefined) agentConfig.mode = config.mode; @@ -276,8 +266,6 @@ export const useAgentsStore = create()( if (config.permission !== undefined) agentConfig.permission = config.permission; if (config.disable !== undefined) agentConfig.disable = config.disable; - console.log('[AgentsStore] Agent config to update:', agentConfig); - // Get current directory for project-level agent support const currentDirectory = getCurrentDirectory(); const queryParams = currentDirectory ? `?directory=${encodeURIComponent(currentDirectory)}` : ''; @@ -294,8 +282,6 @@ export const useAgentsStore = create()( throw new Error(message); } - console.log('[AgentsStore] Agent updated successfully'); - const needsReload = payload?.requiresReload ?? true; if (needsReload) { requiresReload = true; @@ -311,8 +297,7 @@ export const useAgentsStore = create()( emitConfigChange("agents", { source: CONFIG_EVENT_SOURCE }); } return loaded; - } catch (error) { - console.error("[AgentsStore] Failed to update agent:", error); + } catch { return false; } finally { if (!requiresReload) { @@ -339,8 +324,6 @@ export const useAgentsStore = create()( throw new Error(message); } - console.log('[AgentsStore] Agent deleted successfully'); - const needsReload = payload?.requiresReload ?? true; if (needsReload) { requiresReload = true; @@ -361,8 +344,7 @@ export const useAgentsStore = create()( } return loaded; - } catch (error) { - console.error("Failed to delete agent:", error); + } catch { return false; } finally { if (!requiresReload) { @@ -452,8 +434,8 @@ async function performFullConfigRefresh(options: { message?: string; delayMs?: n window.localStorage.removeItem("agents-store"); window.localStorage.removeItem("config-store"); } - } catch (error) { - console.warn("[AgentsStore] Failed to prepare config refresh:", error); + } catch { + // Ignore local storage cleanup errors } try { @@ -469,8 +451,7 @@ async function performFullConfigRefresh(options: { message?: string; delayMs?: n ]); emitConfigChange("agents", { source: CONFIG_EVENT_SOURCE }); - } catch (error) { - console.error("[AgentsStore] Failed to refresh configuration after OpenCode restart:", error); + } catch { updateConfigUpdateMessage("OpenCode reload failed. Please retry refreshing configuration manually."); await sleep(1500); } finally {