Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: address PR review feedback (round 7)

Adam Eivy1c1c967a013e
diff --git a/client/src/components/cos/tabs/ScheduleTab.jsx b/client/src/components/cos/tabs/ScheduleTab.jsx
index c8f0221773..c1c715af50 100644
--- a/client/src/components/cos/tabs/ScheduleTab.jsx
+++ b/client/src/components/cos/tabs/ScheduleTab.jsx
@@ -42,6 +42,17 @@ function TaskTypeRow({ taskType, config, onUpdate, onTrigger, onReset, category,
const [editingPrompt, setEditingPrompt] = useState(false);
const [promptValue, setPromptValue] = useState(config.prompt || '');
+ // Keep local selections in sync with external config updates
+ useEffect(() => {
+ setSelectedType(config.type);
+ setSelectedProviderId(config.providerId || '');
+ setSelectedModel(config.model || '');
+ // Only overwrite the prompt when the user is not actively editing it
+ if (!editingPrompt) {
+ setPromptValue(config.prompt || '');
+ }
+ }, [config.type, config.providerId, config.model, config.prompt, editingPrompt]);
+
const handleTypeChange = async (newType) => {
setUpdating(true);
setSelectedType(newType);
diff --git a/server/lib/fileUtils.js b/server/lib/fileUtils.js
index 3b00aba925..e65a08bcc2 100644
--- a/server/lib/fileUtils.js
+++ b/server/lib/fileUtils.js
@@ -136,7 +136,7 @@ export function isValidJSON(str, { allowArray = true } = {}) {
export function safeJSONParse(str, defaultValue = null, { allowArray = true, logError = false, context = '' } = {}) {
if (!isValidJSON(str, { allowArray })) {
if (logError && str) {
- console.log(`⚠️ Invalid JSON${context ? ` in ${context}` : ''}: empty or malformed content`);
+ console.warn(`Invalid JSON${context ? ` in ${context}` : ''}: empty or malformed content`);
}
return defaultValue;
}
@@ -147,7 +147,7 @@ export function safeJSONParse(str, defaultValue = null, { allowArray = true, log
return JSON.parse(str);
} catch (err) {
if (logError) {
- console.error(`⚠️ Failed to parse JSON${context ? ` in ${context}` : ''}: ${err.message}`);
+ console.warn(`Failed to parse JSON${context ? ` in ${context}` : ''}: ${err.message}`);
}
return defaultValue;
}
@@ -179,7 +179,7 @@ export async function readJSONFile(filePath, defaultValue = null, { allowArray =
}
// Log other I/O errors if requested
if (logError) {
- console.error(`⚠️ Failed to read file ${filePath}: ${err.message}`);
+ console.warn(`Failed to read file ${filePath}: ${err.message}`);
}
return defaultValue;
}
@@ -242,7 +242,7 @@ export async function readJSONLFile(filePath, { logErrors = false } = {}) {
}
// Log other I/O errors if requested
if (logErrors) {
- console.error(`⚠️ Failed to read file ${filePath}: ${err.message}`);
+ console.warn(`Failed to read file ${filePath}: ${err.message}`);
}
return [];
}
diff --git a/server/lib/fileUtils.test.js b/server/lib/fileUtils.test.js
index 5e737ee764..19147c5219 100644
--- a/server/lib/fileUtils.test.js
+++ b/server/lib/fileUtils.test.js
@@ -107,22 +107,22 @@ describe('fileUtils', () => {
expect(result).toEqual({});
});
- it('should log error when logError is true', () => {
- const consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
+ it('should log warning when logError is true', () => {
+ const consoleSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
safeJSONParse('invalid', {}, { logError: true });
expect(consoleSpy).toHaveBeenCalled();
consoleSpy.mockRestore();
});
it('should include context in log message', () => {
- const consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
+ const consoleSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
safeJSONParse('invalid', {}, { logError: true, context: 'test-file.json' });
expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('test-file.json'));
consoleSpy.mockRestore();
});
it('should not log for empty input even with logError true', () => {
- const consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
+ const consoleSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
safeJSONParse('', {}, { logError: true });
expect(consoleSpy).not.toHaveBeenCalled();
consoleSpy.mockRestore();
@@ -130,11 +130,11 @@ describe('fileUtils', () => {
it('should handle syntax error in structurally valid JSON', () => {
// Passes structural check but fails JSON.parse
- const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
+ const consoleWarnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
const result = safeJSONParse('{"key": undefined}', { fallback: true }, { logError: true });
expect(result).toEqual({ fallback: true });
- expect(consoleErrorSpy).toHaveBeenCalled();
- consoleErrorSpy.mockRestore();
+ expect(consoleWarnSpy).toHaveBeenCalled();
+ consoleWarnSpy.mockRestore();
});
});