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 review (codex): preserve CoS config compatibility

[._.]/ Adam Eivy533a19a5edf5
diff --git a/server/routes/cos.test.js b/server/routes/cos.test.js
index 54016bd9a6..3b0f226591 100644
--- a/server/routes/cos.test.js
+++ b/server/routes/cos.test.js
@@ -254,13 +254,14 @@ describe('CoS Routes', () => {
['autonomyLevel', 'manager'],
['comprehensiveAppImprovement', true],
['immediateExecution', true],
- ])('rejects the retired %s config field', async (field, value) => {
+ ])('accepts but ignores the retired %s config field for older clients', async (field, value) => {
+ cos.updateConfig.mockResolvedValue({ maxConcurrentAgents: 5 });
const response = await request(app)
.put('/api/cos/config')
- .send({ [field]: value });
+ .send({ [field]: value, maxConcurrentAgents: 5 });
- expect(response.status).toBe(400);
- expect(cos.updateConfig).not.toHaveBeenCalled();
+ expect(response.status).toBe(200);
+ expect(cos.updateConfig).toHaveBeenCalledWith({ maxConcurrentAgents: 5 });
});
});
diff --git a/server/routes/cosStatusRoutes.js b/server/routes/cosStatusRoutes.js
index 6b3981b4a1..e7bdd670b1 100644
--- a/server/routes/cosStatusRoutes.js
+++ b/server/routes/cosStatusRoutes.js
@@ -46,8 +46,13 @@ export const cosConfigSchema = z.object({
appReviewCooldownMs: z.number().int().min(0).optional(),
idleReviewEnabled: z.boolean().optional(),
idleReviewPriority: z.enum(['LOW', 'MEDIUM', 'HIGH', 'CRITICAL']).optional(),
+ // Accept retired fields from cached/older clients, then discard them in the
+ // transform below so they cannot be re-persisted.
+ comprehensiveAppImprovement: z.boolean().optional(),
+ immediateExecution: z.boolean().optional(),
proactiveMode: z.boolean().optional(),
autonomousJobsEnabled: z.boolean().optional(),
+ autonomyLevel: z.enum(['standby', 'assistant', 'manager', 'yolo']).optional(),
autoApproveInvestigations: z.boolean().optional(),
// A durable reasoning route for the persistent mind. It is separate from
// `alwaysOn`: saving or enabling this profile never starts background work.
@@ -87,7 +92,13 @@ export const cosConfigSchema = z.object({
enabled: z.boolean().optional(),
alwaysApproveKinds: z.array(z.string()).optional()
}).strict().optional()
-}).strict();
+}).strict().transform((config) => {
+ const supportedConfig = { ...config };
+ delete supportedConfig.autonomyLevel;
+ delete supportedConfig.comprehensiveAppImprovement;
+ delete supportedConfig.immediateExecution;
+ return supportedConfig;
+});
// GET /api/cos - Get CoS status
router.get('/', asyncHandler(async (req, res) => {
diff --git a/server/services/agentCompletion.js b/server/services/agentCompletion.js
index e472a66212..1a44a72ae4 100644
--- a/server/services/agentCompletion.js
+++ b/server/services/agentCompletion.js
@@ -63,7 +63,7 @@ export async function processAgentCompletion(agentId, task, success, outputBuffe
}
const config = await getConfig();
- const cooldownMs = config.appReviewCooldownMs || 3600000;
+ const cooldownMs = config.appReviewCooldownMs ?? 3600000;
const issuesFound = success ? 1 : 0;
const issuesFixed = success ? 1 : 0;
diff --git a/server/services/agentCompletion.test.js b/server/services/agentCompletion.test.js
index 5f5b60e602..97ac4a4a6e 100644
--- a/server/services/agentCompletion.test.js
+++ b/server/services/agentCompletion.test.js
@@ -29,6 +29,7 @@ vi.mock('./malwareScanReports.js', () => ({
import { processAgentCompletion } from './agentCompletion.js';
import * as appActivity from './appActivity.js';
+import { getConfig } from './cosState.js';
describe('processAgentCompletion - cooldown handling for recovery tasks', () => {
beforeEach(() => {
@@ -47,6 +48,19 @@ describe('processAgentCompletion - cooldown handling for recovery tasks', () =>
expect(appActivity.startAppCooldown).toHaveBeenCalledWith('portos-default', 1800000);
});
+ it('preserves an explicit zero app review cooldown', async () => {
+ getConfig.mockResolvedValueOnce({ appReviewCooldownMs: 0 });
+ const task = {
+ id: 'sys-zero-cooldown',
+ description: '[App Improvement: Example App] Code Quality Review',
+ metadata: { app: 'example-app' }
+ };
+
+ await processAgentCompletion('agent-zero', task, true, 'output');
+
+ expect(appActivity.startAppCooldown).toHaveBeenCalledWith('example-app', 0);
+ });
+
it('does NOT bump cooldown when task.metadata.isRecovery is true', async () => {
const task = {
id: 'task-xyz',