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: expose review fallback assignments and apply pins only to safe inputs

[._.]/ Adam Eivyaa82950145cf
diff --git a/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx b/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx
index 13f39efef1..b4f53fe91d 100644
--- a/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx
+++ b/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx
@@ -229,6 +229,9 @@ export default function PipelineStageConfig({ taskType, config, providers, provi
size="sm"
/>
<p className="text-xs text-gray-400 mt-2">Larger-model fallback for oversized linked issues. Choose a provider and a model with enough context for the complete PR and issues. Issues over 8,000 characters (up to 65,536 each) use this selection for the eligibility gate and final review. Security screening still runs on all content; flagged or incomplete input stays blocked.</p>
+ {stage.largeInputFallback && eligibleProviders?.length === 0 && (
+ <p className="text-xs text-port-warning mt-2">No enabled tool-free provider is available for the fallback. Oversized linked issues will block the run until one is configured.</p>
+ )}
{stage.largeInputFallback && (!selection.providerId || !selection.model) && (
<p className="text-xs text-port-warning mt-2">Select both a provider and a model to enable fallback runs.</p>
)}
@@ -254,7 +257,7 @@ export default function PipelineStageConfig({ taskType, config, providers, provi
disabled={updating}
/>
)}
- {posture && eligibleProviders?.length === 0 && (
+ {posture && !isSecurityStage && eligibleProviders?.length === 0 && (
<p className="text-xs text-port-warning mt-2">
No enabled AI provider on this install can enforce the{' '}
{isActionsStage ? 'sandboxed-actions' : 'tool-free'} posture, so this stage will not run.
diff --git a/server/services/aiAssignments.js b/server/services/aiAssignments.js
index 7c9d63246b..4ffb8d05f0 100644
--- a/server/services/aiAssignments.js
+++ b/server/services/aiAssignments.js
@@ -376,6 +376,24 @@ const addRecordEntries = async (entries) => {
link: '/cos/config',
}));
}
+ const fallback = stage?.largeInputFallback;
+ if (fallback?.providerId || fallback?.model || fallback?.effort) {
+ entries.push(makeEntry({
+ id: `cos.taskStageFallback.${taskType}.${index}`,
+ area: 'Chief of Staff',
+ assignmentType: 'Scheduled tasks',
+ label: `${taskType} stage: ${stage.name || index + 1} (large-input fallback)`,
+ source: `cos task ${taskType}.taskMetadata.pipeline.stages[${index}].largeInputFallback`,
+ providerId: fallback.providerId,
+ model: fallback.model,
+ effort: fallback.effort,
+ effortEditable: true,
+ providerTypes: cliProviderTypes,
+ scope: 'record',
+ notes: 'Requires a tool-free public-review provider and a model with enough context for the complete input. Configure eligible choices in the scheduled task options.',
+ link: '/cos/config',
+ }));
+ }
}
}
@@ -597,13 +615,22 @@ export async function updateAiAssignment(id, payload = {}) {
return getAiAssignments();
}
- if (id.startsWith('cos.taskStage.')) {
+ if (id.startsWith('cos.taskStage.') || id.startsWith('cos.taskStageFallback.')) {
const [, , taskType, indexRaw] = id.split('.');
const index = Number(indexRaw);
const task = await taskScheduleService.getTaskInterval(taskType);
const stages = [...(task.taskMetadata?.pipeline?.stages || [])];
if (!stages[index]) throw new ServerError(`Stage not found: ${id}`, { status: 404, code: 'NOT_FOUND' });
- stages[index] = { ...stages[index], providerId: nextProviderId, model: nextModel, ...effortPatch };
+ if (id.startsWith('cos.taskStageFallback.')) {
+ if (!isPlainObject(stages[index].largeInputFallback)) throw new ServerError(`Fallback not found: ${id}`, { status: 404, code: 'NOT_FOUND' });
+ const fallback = { ...stages[index].largeInputFallback, providerId: nextProviderId, model: nextModel, ...effortPatch };
+ for (const key of ['providerId', 'model', 'effort']) {
+ if (fallback[key] == null) delete fallback[key];
+ }
+ stages[index] = { ...stages[index], largeInputFallback: fallback };
+ } else {
+ stages[index] = { ...stages[index], providerId: nextProviderId, model: nextModel, ...effortPatch };
+ }
await taskScheduleService.updateTaskInterval(taskType, {
taskMetadata: { ...(task.taskMetadata || {}), pipeline: { ...(task.taskMetadata?.pipeline || {}), stages } },
});
diff --git a/server/services/aiAssignments.test.js b/server/services/aiAssignments.test.js
index 727dbb3303..b6eb6a88e6 100644
--- a/server/services/aiAssignments.test.js
+++ b/server/services/aiAssignments.test.js
@@ -235,6 +235,23 @@ describe('updateAiAssignment routing', () => {
expect(mocks.updateSettings).not.toHaveBeenCalled();
});
+ it('inventories and updates the fallback without changing primary stage pins', async () => {
+ const stage = { name: 'Security Scan', providerId: 'primary', model: 'small', largeInputFallback: { providerId: 'large-provider', model: 'large-model', effort: 'high' } };
+ const task = { taskMetadata: { pipeline: { stages: [stage] } } };
+ mocks.getScheduleStatus.mockResolvedValue({ tasks: { 'pr-reviewer': task } });
+ mocks.getTaskInterval.mockResolvedValue(task);
+ const id = 'cos.taskStageFallback.pr-reviewer.0';
+ expect((await getAiAssignments()).assignments.find(a => a.id === id)).toMatchObject({
+ ...stage.largeInputFallback, needsTools: false, effortEditable: true,
+ });
+ await updateAiAssignment(id, { providerId: 'replacement', model: 'larger-model', effort: null });
+ expect(mocks.updateTaskInterval).toHaveBeenCalledWith('pr-reviewer', { taskMetadata: { pipeline: { stages: [
+ { ...stage, largeInputFallback: { providerId: 'replacement', model: 'larger-model' } },
+ ] } } });
+ mocks.getTaskInterval.mockResolvedValue({ taskMetadata: { pipeline: { stages: [{ name: 'Security Scan' }] } } });
+ await expect(updateAiAssignment(id, { providerId: 'replacement', model: 'larger-model' })).rejects.toMatchObject({ status: 404 });
+ });
+
it('cos.task.<existing> updates the schedule interval', async () => {
await updateAiAssignment('cos.task.morning-brief', { providerId: 'claude', model: 'opus', effort: 'high' });
expect(mocks.updateTaskInterval).toHaveBeenCalledWith('morning-brief', { providerId: 'claude', model: 'opus', effort: 'high' });
diff --git a/server/services/prReviewerSecurity.js b/server/services/prReviewerSecurity.js
index c39e37ee3f..f944ee6369 100644
--- a/server/services/prReviewerSecurity.js
+++ b/server/services/prReviewerSecurity.js
@@ -304,7 +304,7 @@ export async function runPrReviewerSecurityScan({ app, target = null, largeInput
const requiresLargeInputFallback = resolvedTarget.prs.some(pr =>
pr.linkedIssues?.some(issue => issue.body.length > LINKED_ISSUE_STANDARD_BODY_MAX_CHARS));
if (requiresLargeInputFallback && (!largeInputFallback?.providerId || !largeInputFallback?.model)) {
- return failure('security-scan-linked-issue-too-large', { scanKey });
+ return failure(largeInputFallback ? 'security-scan-large-input-fallback-unconfigured' : 'security-scan-linked-issue-too-large', { scanKey });
}
const reviewedPrs = [];
@@ -380,7 +380,8 @@ export async function runPrReviewerSecurityScan({ app, target = null, largeInput
reviewedPrs,
reports: reviewedPrs,
reviewInputs,
- usedLargeInputFallback: requiresLargeInputFallback,
+ usedLargeInputFallback: reviewInputs.some(input =>
+ input.linkedIssues.some(issue => issue.body.length > LINKED_ISSUE_STANDARD_BODY_MAX_CHARS)),
};
}
diff --git a/server/services/prReviewerSecurity.test.js b/server/services/prReviewerSecurity.test.js
index c52257703d..12161c3926 100644
--- a/server/services/prReviewerSecurity.test.js
+++ b/server/services/prReviewerSecurity.test.js
@@ -118,11 +118,12 @@ describe('pr-reviewer model-abuse preflight', () => {
expect(result.reviewInputs[0].linkedIssues[0].body).toBe(body)
runModelAbuseScanMock.mockResolvedValue(guardVerdict(false))
const blocked = await runPrReviewerSecurityScan({ target, largeInputFallback: { providerId: 'large-provider', model: 'large-model' } })
- expect(blocked).toMatchObject({ ok: true, passed: false, reviewInputs: [] })
+ expect(blocked).toMatchObject({ ok: true, passed: false, reviewInputs: [], usedLargeInputFallback: false })
+ expect(await runPrReviewerSecurityScan({ target, largeInputFallback: {} })).toMatchObject({ ok: false, code: 'security-scan-large-input-fallback-unconfigured' })
})
it('refuses linked requirements that were clipped before screening', async () => {
- const result = await runPrReviewerSecurityScan({ app, target: {
+ const result = await runPrReviewerSecurityScan({ app, largeInputFallback: { providerId: 'large-provider', model: 'large-model' }, target: {
ok: true, repoFullName: 'example/repo', repoSpec: 'github.com/example/repo', defaultBranch: 'main',
prs: [{ number: 12, authorLogin: 'external', headRefOid: 'a'.repeat(40), inputComplete: false }],
} })