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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (local gate): pin the reviewerApplies=false rule on the resolver, the dispatch's prCompletion and noChangesToShip hand-offs, and finalize's prExpected
[._.]/ Adam Eivy95bbe5458a22
diff --git a/server/services/agentCliSpawning.test.js b/server/services/agentCliSpawning.test.jsindex 6c2d328188..a89f46d843 100644--- a/server/services/agentCliSpawning.test.js+++ b/server/services/agentCliSpawning.test.js@@ -1252,6 +1252,8 @@ describe('stream error containment', () => {});it('hands a slashdo-capable harness to the dispatch as owning its PR, with the claim expected', async () => {+ const { finalizeAgent } = await import('./agentFinalization.js');+ finalizeAgent.mockClear();const task = {id: 'task-rv',description: 'do stuff',@@ -1277,6 +1279,8 @@ describe('stream error containment', () => {prOwnership: { taskOpenPR: true, agentOwnsPR: true, prClaimExpected: true },prClaimVerified: false,}));+ // The claim predicate, not the ownership one, is what finalize verifies (#3358).+ expect(finalizeAgent).toHaveBeenCalledWith(expect.objectContaining({ prExpected: true }));});// The dispatch releases the retry hold with this verdict (#3368 — its orderingdiff --git a/server/services/agentCompletionCleanup.js b/server/services/agentCompletionCleanup.jsindex 2c117509b6..c5940eb575 100644--- a/server/services/agentCompletionCleanup.js+++ b/server/services/agentCompletionCleanup.js@@ -18,8 +18,8 @@** Both hand `cleanupAgentWorktree` the options `resolveWorktreeCleanupOptions`* builds, so the PR-disposition shape has one owner. `handlePipelineProgression`- * lives here too — it's only invoked from these cleanup flows (agentLifecycle.js- * re-exports it for subAgentSpawner).+ * lives here too — it's only invoked from these cleanup flows (exported for its+ * unit tests).** This module imports the worktree-cleanup leaf (agentWorktreeCleanup.js)* directly; it must NOT import from agentLifecycle.js, which imports thisdiff --git a/server/services/agentCompletionCleanup.test.js b/server/services/agentCompletionCleanup.test.jsindex 14e7997090..8b9f4dbab1 100644--- a/server/services/agentCompletionCleanup.test.js+++ b/server/services/agentCompletionCleanup.test.js@@ -437,14 +437,32 @@ describe('runSpawnerCompletionCleanup — the in-process spawners\' dispatch', (expect(releaseRetryHold).toHaveBeenCalledWith({ agentId: 'a1', task, success: true });});- it('threads the resolved reviewer options through to the worktree cleanup', async () => {+ it('threads the resolved reviewer options and the task\'s PR completion through to the worktree cleanup', async () => {resolveReviewLoopOptions.mockResolvedValueOnce({ reviewers: ['codex', 'antigravity'], reviewStopMode: 'on-clean', reviewerApplies: false });+ const task = { id: 't', taskType: 'user', description: 'do it', metadata: { openPR: true, prCompletion: 'review-then-merge' } };- await runSpawnerCompletionCleanup(spawnerArgs());+ await runSpawnerCompletionCleanup(spawnerArgs({ task }));expect(cleanupAgentWorktree).toHaveBeenCalledWith('a1', true, expect.objectContaining({- prCreation: 'always', reviewers: ['codex', 'antigravity'], reviewStopMode: 'on-clean', reviewerApplies: false,+ prCreation: 'always',+ prCompletion: 'review-then-merge',+ reviewers: ['codex', 'antigravity'],+ reviewStopMode: 'on-clean',+ reviewerApplies: false,}));+ // No pipeline on this task: progression is a no-op, not a stray task write.+ expect(updateTask).not.toHaveBeenCalled();+ expect(addTask).not.toHaveBeenCalled();+ });++ // A non-owning run whose no-change audit finalize verified: there is nothing+ // to ship, so no PR is opened for an empty branch and no reviewer defaults+ // are read for a follow-up that will never spawn.+ it('never opens a PR when finalize proved there was nothing to ship', async () => {+ await runSpawnerCompletionCleanup(spawnerArgs({ noChangesToShip: true }));++ expect(cleanupAgentWorktree).toHaveBeenCalledWith('a1', true, expect.objectContaining({ prCreation: 'never' }));+ expect(resolveReviewLoopOptions).not.toHaveBeenCalled();});// The hardening the TUI copy had and the CLI copy lacked: a reviewer-defaultsdiff --git a/server/services/agentTuiSpawning.test.js b/server/services/agentTuiSpawning.test.jsindex 39108712b1..cf905626b2 100644--- a/server/services/agentTuiSpawning.test.js+++ b/server/services/agentTuiSpawning.test.js@@ -968,6 +968,9 @@ describe('spawnTuiAgent runtime', () => {prOwnership: { taskOpenPR: true, agentOwnsPR: true, prClaimExpected: false },prClaimVerified: false,}));+ // …and finalize was told not to verify a claim this session cannot make —+ // failing it there would pre-empt the backstop cleanup is about to run.+ expect(agentLifecycle.finalizeAgent).toHaveBeenCalledWith(expect.objectContaining({ prExpected: false }));});it('a lean --bare TUI still hands its PR to PortOS outright', async () => {@@ -1036,6 +1039,7 @@ describe('spawnTuiAgent runtime', () => {prOwnership: { taskOpenPR: true, agentOwnsPR: true, prClaimExpected: true },prClaimVerified: true,}));+ expect(agentLifecycle.finalizeAgent).toHaveBeenCalledWith(expect.objectContaining({ prExpected: true }));});// The dispatch releases the retry hold with this verdict (#3368 — its orderingdiff --git a/server/services/agentWorktreeCleanup.js b/server/services/agentWorktreeCleanup.jsindex a29adefc15..e751f923a5 100644--- a/server/services/agentWorktreeCleanup.js+++ b/server/services/agentWorktreeCleanup.js@@ -6,12 +6,9 @@* recovery tasks when a merge or PR creation fails. Extracted from* agentLifecycle.js as a self-contained leaf so the completion-cleanup* orchestrator (agentCompletionCleanup.js) can import it without a circular- * dependency back into agentLifecycle.js.- *- * agentLifecycle.js re-exports these three functions for backward- * compatibility (agentManagement.js and subAgentSpawner.js import- * `cleanupAgentWorktree` / `spawnMergeRecoveryTask` / `spawnReviewLoopFollowUp`- * from there).+ * dependency back into agentLifecycle.js. Consumers import these functions from+ * here directly — the agentLifecycle.js pass-through re-exports were retired+ * with the subAgentSpawner barrel (#3450).*/import { existsSync } from 'fs';diff --git a/server/services/codeReview.test.js b/server/services/codeReview.test.jsindex dafcdded91..fd498821c5 100644--- a/server/services/codeReview.test.js+++ b/server/services/codeReview.test.js@@ -260,6 +260,16 @@ describe('codeReview helpers', () => {})describe('resolveReviewLoopOptions', () => {+ // Reviewers inspecting public PR content are advisory only — the follow-up+ // must never hand an untrusted diff to a second process with write authority.+ // Pinned on the resolver itself because this is the one place the rule lives:+ // a task pin and a saved default that both ask for it are still refused.+ it('forces reviewerApplies off no matter what the task or the defaults ask for', async () => {+ mockedSettings.current = { codeReview: { reviewers: ['codex'], reviewerApplies: true } }+ const out = await resolveReviewLoopOptions({ reviewerApplies: true }, testDeps)+ expect(out.reviewerApplies).toBe(false)+ })+it('assembles a reviewer-keyed model map from the per-CLI-reviewer scalars', async () => {mockedSettings.current = {codeReview: {