fix: suppress logging for agent scope fetch and configuration updates

This commit is contained in:
Bohdan Triapitsyn
2025-12-29 23:58:33 +02:00
parent c4b9c18c24
commit 0f9c50cd58
2 changed files with 9 additions and 27 deletions
+1
View File
@@ -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%3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S42MDAxIDE0LjM5ODQgNS4zMTM1NiAxNC4zOTg0IDQuOTYwMVYyLjI0MDFDMTQuMzk4NCAxLjg4NjY0IDE0LjExMTkgMS42MDAxIDEzLjc1ODQgMS42MDAxWiIgZmlsbD0iI2ZmZiIvPgo8cGF0aCBkPSJNNCAxMkwxMiA0TDQgMTJaIiBmaWxsPSIjZmZmIi8%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.
+8 -27
View File
@@ -171,8 +171,8 @@ export const useAgentsStore = create<AgentsStore>()(
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<AgentsStore>()(
startConfigUpdate("Creating agent configuration…");
let requiresReload = false;
try {
console.log('[AgentsStore] Creating agent:', config.name);
const agentConfig: Record<string, unknown> = {
mode: config.mode || "subagent",
};
@@ -212,8 +210,6 @@ export const useAgentsStore = create<AgentsStore>()(
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<AgentsStore>()(
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<AgentsStore>()(
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<AgentsStore>()(
startConfigUpdate("Updating agent configuration…");
let requiresReload = false;
try {
console.log('[AgentsStore] Updating agent:', name);
console.log('[AgentsStore] Config received:', config);
const agentConfig: Record<string, unknown> = {};
if (config.mode !== undefined) agentConfig.mode = config.mode;
@@ -276,8 +266,6 @@ export const useAgentsStore = create<AgentsStore>()(
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<AgentsStore>()(
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<AgentsStore>()(
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<AgentsStore>()(
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<AgentsStore>()(
}
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 {