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: deliver maintenance fixes through pull requests

[._.]/ Adam Eivyecc4967defcb
diff --git a/client/src/lib/quotaBurnTasks.test.js b/client/src/lib/quotaBurnTasks.test.js
index 220cbe3739..f25dc18667 100644
--- a/client/src/lib/quotaBurnTasks.test.js
+++ b/client/src/lib/quotaBurnTasks.test.js
@@ -231,7 +231,7 @@ it('populates the canonical audit ladder with perpetual drains and refuses incom
expect(jobs.filter(job => job.drain)).toHaveLength(6);
expect(jobs.every(job => job.runOnce && job.taskRef.appId === 'app1')).toBe(true);
expect(jobs[0].overrides.params).toEqual({ fileIssues: true });
- expect(jobs.at(-1).overrides.params).toEqual({ fileIssues: false });
+ expect(jobs.at(-1).overrides.params).toEqual({ fileIssues: false, useWorktree: true, openPR: true });
expect(maintenanceSequence(groups, 'app2', 'sequence')).toBeNull();
tasks['claim-issue'].perpetual = false;
expect(maintenanceSequence(buildQuotaBurnTaskCatalog({ schedule: { tasks } }), 'app1', 'sequence')).toBeNull();
diff --git a/server/lib/maintenanceSequence.js b/server/lib/maintenanceSequence.js
index ced281199b..f798f92c43 100644
--- a/server/lib/maintenanceSequence.js
+++ b/server/lib/maintenanceSequence.js
@@ -36,12 +36,16 @@ export const MAINTENANCE_SEQUENCE_TYPES = Object.freeze(MAINTENANCE_TASK_ORDER.f
/**
* The run params an audit step pins. The first six audits explicitly FILE
* issues (which the drain then claims); documentation explicitly does the work.
- * Fix mode runs audits directly and drains once at the end.
+ * Fix mode runs audits directly and drains once at the end. Code-producing
+ * steps explicitly request PR delivery so issue-only schedule defaults cannot
+ * turn their completion into a local-only merge. Review policy still inherits.
* A drain pins nothing — it inherits the app's saved claim filters.
*/
export const maintenanceStepParams = (taskType, mode = 'file-issues') => (taskType === MAINTENANCE_DRAIN_TASK
? {}
- : { fileIssues: mode !== 'fix' && taskType !== 'documentation' });
+ : mode !== 'fix' && taskType !== 'documentation'
+ ? { fileIssues: true }
+ : { fileIssues: false, useWorktree: true, openPR: true });
/**
* Build the ladder as run-once steps targeting `appId`, every one pinned to the
diff --git a/server/services/cosTaskGenerator.auditMode.test.js b/server/services/cosTaskGenerator.auditMode.test.js
index fc46cf067d..106b37f5bf 100644
--- a/server/services/cosTaskGenerator.auditMode.test.js
+++ b/server/services/cosTaskGenerator.auditMode.test.js
@@ -105,6 +105,8 @@ import {
} from '../lib/auditCatalog.js';
import { isProgrammaticScheduledTaskType, PROGRAMMATIC_SCHEDULED_TASK_TYPES } from '../lib/taskTargetScope.js';
+import { buildMaintenanceSteps } from '../lib/maintenanceSequence.js';
+
const AUDIT_TYPES = [...AUDIT_TASK_TYPES];
const WORKSPACE = '/tmp/example-repo';
@@ -315,6 +317,25 @@ describe('mode is honored identically from schedule, manual run, and quota burn'
expect(task.description).toContain('Mode: implement the highest-value fix');
});
+ it('maintenance fixes override issue-only PR defaults through the final Codex prompt', async () => {
+ const { getTaskInterval } = await import('./taskSchedule.js');
+ getTaskInterval.mockResolvedValue({ type: 'weekly', taskMetadata: {
+ fileIssues: true, useWorktree: false, openPR: false,
+ } });
+ const [step] = buildMaintenanceSteps({ appId: 'app-1', idPrefix: 'maintenance', mode: 'fix' });
+ const task = await generate(step.taskRef.taskType, {
+ skipPreconditions: true, runOverrides: step.overrides.params,
+ });
+ expect(task.metadata).toMatchObject({ fileIssues: false, useWorktree: true, openPR: true });
+ const prompt = buildLightContextPrompt(task, WORKSPACE, {
+ branch: 'cos/example', worktreePath: WORKSPACE,
+ }, isTruthyMeta, { isTui: true, providerId: 'codex-tui', providerCommand: 'codex' });
+ expect(prompt).toContain('gh pr create');
+ expect(prompt).toContain('## Merge Gate');
+ expect(prompt).toContain('--merge --delete-branch');
+ expect(prompt).not.toContain('PortOS will merge it back after completion');
+ });
+
it('run overrides pass the same allowlist a stored override does', async () => {
const { getTaskInterval } = await import('./taskSchedule.js');
getTaskInterval.mockResolvedValue({ type: 'weekly', taskMetadata: { fileIssues: true } });
diff --git a/server/services/maintenanceRun.test.js b/server/services/maintenanceRun.test.js
index 04ede744cd..e5e00c31a5 100644
--- a/server/services/maintenanceRun.test.js
+++ b/server/services/maintenanceRun.test.js
@@ -189,7 +189,7 @@ it('runs fixes consecutively and drains remaining issues only after documentatio
const { run } = await startMaintenanceRun({ appId: 'app-1', providerId: 'codex', model: 'gpt-5', mode: 'fix' });
expect(run.steps.map(step => step.taskRef.taskType)).toEqual([...MAINTENANCE_TASK_ORDER, 'claim-issue']);
for (let index = 0; index < MAINTENANCE_TASK_ORDER.length; index++) {
- expect(state.invoked.at(-1).step.overrides.params).toEqual({ fileIssues: false });
+ expect(state.invoked.at(-1).step.overrides.params).toEqual({ fileIssues: false, useWorktree: true, openPR: true });
await __onMaintenanceAgentCompleted(agentFor(run, index));
}
expect(dispatchedTypes()).toEqual([...MAINTENANCE_TASK_ORDER, 'claim-issue']);