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: do not carry the eligibility gate's provider/model into an unpinned review stage

[._.]/ Adam Eivy95809f1b88c0
diff --git a/server/services/agentCompletionCleanup.js b/server/services/agentCompletionCleanup.js
index d78f08d1af..1e3d7278d2 100644
--- a/server/services/agentCompletionCleanup.js
+++ b/server/services/agentCompletionCleanup.js
@@ -30,7 +30,7 @@ import { resolveReviewLoopOptions } from './codeReview.js';
import { cleanupAgentWorktree, spawnMergeRecoveryTask, releaseRetryHold } from './agentWorktreeCleanup.js';
import { resolvePrCompletion, resolvePrCreation } from '../lib/prDisposition.js';
import { resolveOwnsPrWorkflow } from '../lib/slashdoInvocation.js';
-import { isPublicReviewRestrictedProfile } from '../lib/agentExecutionProfiles.js';
+import { isPublicReviewRestrictedProfile, publicReviewPostureForProfile } from '../lib/agentExecutionProfiles.js';
const ROOT_DIR = PATHS.root;
@@ -139,6 +139,16 @@ export async function handlePipelineProgression(task, agentId, success) {
// without its own pin inherits the value carried in `...task.metadata` — either
// the task-level pin (interval config) or the prior stage's. Clearing an unset
// stage's effort here would wipe a task-level effort from stage 1+.
+ //
+ // A public-review stage is the exception: its provider is resolved against
+ // the posture it declares, and the stages have different postures — the
+ // eligibility gate is typically pinned to a small tool-free local model that
+ // must never be inherited by the sandboxed review stage. An unpinned
+ // public-review stage means "first eligible provider on this install" (what
+ // the schedule UI promises), so the previous stage's pins are dropped here.
+ if (publicReviewPostureForProfile(nextStage.executionProfile)) {
+ for (const key of ['provider', 'providerId', 'model', 'effort']) delete nextTask.metadata[key];
+ }
if (nextStage.model) nextTask.metadata.model = nextStage.model;
if (nextStage.providerId) {
nextTask.metadata.provider = nextStage.providerId;
diff --git a/server/services/agentCompletionCleanup.test.js b/server/services/agentCompletionCleanup.test.js
index 850213b899..c4a548ce88 100644
--- a/server/services/agentCompletionCleanup.test.js
+++ b/server/services/agentCompletionCleanup.test.js
@@ -181,6 +181,52 @@ describe('handlePipelineProgression — execution profile hand-off', () => {
await handlePipelineProgression(task, 'agent-1', true);
expect(addTask.mock.calls[0][0].metadata.executionProfile).toBeNull();
});
+
+ // The gate is pinned to a tool-free local model; the sandboxed review stage
+ // must not inherit it. An unpinned public-review stage resolves to the first
+ // eligible provider for ITS posture, so the previous stage's pins are dropped.
+ it('does not carry the previous stage\'s provider/model/effort into an unpinned public-review stage', async () => {
+ const task = {
+ id: 't',
+ taskType: 'user',
+ metadata: {
+ executionProfile: 'public-review-gate',
+ provider: 'claude-ollama',
+ providerId: 'claude-ollama',
+ model: 'gemma3:27b',
+ effort: 'medium',
+ pipeline: publicReviewPipeline([
+ { name: 'Eligibility Gate', executionProfile: 'public-review-gate', providerId: 'claude-ollama', model: 'gemma3:27b', effort: 'medium' },
+ { name: 'Code Review & Actions', executionProfile: 'public-review-actions' },
+ ]),
+ },
+ };
+ await handlePipelineProgression(task, 'agent-1', true);
+ const next = addTask.mock.calls[0][0].metadata;
+ expect(next.executionProfile).toBe('public-review-actions');
+ expect(next).not.toHaveProperty('provider');
+ expect(next).not.toHaveProperty('providerId');
+ expect(next).not.toHaveProperty('model');
+ expect(next).not.toHaveProperty('effort');
+ });
+
+ it('applies a public-review stage\'s own pins', async () => {
+ const task = {
+ id: 't',
+ taskType: 'user',
+ metadata: {
+ executionProfile: 'public-review-gate',
+ provider: 'claude-ollama',
+ model: 'gemma3:27b',
+ pipeline: publicReviewPipeline([
+ { name: 'Eligibility Gate', executionProfile: 'public-review-gate' },
+ { name: 'Code Review & Actions', executionProfile: 'public-review-actions', providerId: 'codex-tui', model: 'gpt-5.6', effort: 'high' },
+ ]),
+ },
+ };
+ await handlePipelineProgression(task, 'agent-1', true);
+ expect(addTask.mock.calls[0][0].metadata).toMatchObject({ provider: 'codex-tui', providerId: 'codex-tui', model: 'gpt-5.6', effort: 'high' });
+ });
});
describe('runAgentCompletionCleanup — agentOwnsPR mirrors the prompt gate', () => {