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 a stale taskSchedule mock and two doc-drift comments from the drain refactor

[._.]/ Adam Eivye9544dfa5a10
diff --git a/server/services/branchReconcile.js b/server/services/branchReconcile.js
index 9e547b5084..f19ed04f8f 100644
--- a/server/services/branchReconcile.js
+++ b/server/services/branchReconcile.js
@@ -109,7 +109,7 @@ const PR_LIST_LIMIT = 200;
* CONFLICTED — open PR with merge conflicts → agent resolves
* IN_REVIEW — open PR, otherwise → agent drives to merge
* NEEDS_PR — pushed, not merged, no PR, clean → agent verifies + opens PR
- * WIP — local-only, dirty, or LIVE-owned → skip + report (never touch)
+ * WIP — local-only, dirty, or LIVE-owned → skip + report (never touch)
*
* @param {{ hasUpstream:boolean, isMerged:boolean, worktreeDirty:boolean, abandonedAgentWorktree?:boolean, liveOwnerReason?:string|null, openPr:({mergeable?:string}|null), prStateUnavailable?:boolean }} input
* `prStateUnavailable` means the forge could not be READ this cycle — distinct
diff --git a/server/services/branchReconcile.test.js b/server/services/branchReconcile.test.js
index 95953677c6..d9387ca64a 100644
--- a/server/services/branchReconcile.test.js
+++ b/server/services/branchReconcile.test.js
@@ -648,7 +648,7 @@ describe('reconcile', () => {
// The overnight re-dispatch loop's other half: a RUNNING agent's branch, clean
// and with an open PR, classified IN_REVIEW and was handed to the coordinator —
// which then raced the live session's pushes, each of which re-advanced the
- // drain's progress signature. It belongs in heldLive, not inFlight.
+ // drain's progress signature. It belongs in wip (with a liveOwnerReason), not inFlight.
it('holds a LIVE agent\'s branch out of the in-flight set even with an open PR', async () => {
git.getBranches.mockResolvedValue([
{ name: 'cos/task-y/agent-live1234', isDefault: false, current: false, tracking: 'origin/cos/task-y/agent-live1234', merged: false }
diff --git a/server/services/cosTaskGenerator.referenceWatch.test.js b/server/services/cosTaskGenerator.referenceWatch.test.js
index 744136c1c4..5f08de7a46 100644
--- a/server/services/cosTaskGenerator.referenceWatch.test.js
+++ b/server/services/cosTaskGenerator.referenceWatch.test.js
@@ -47,8 +47,13 @@ vi.mock('./taskSchedule.js', () => ({
recordExecution: vi.fn(async () => {}),
clearPerpetualPark: vi.fn(async () => {}),
parkPerpetual: vi.fn(async () => {}),
- getPerpetualSignature: vi.fn(async () => null),
- setPerpetualSignature: vi.fn(async () => {}),
+ // This is a FULL-REPLACEMENT mock (no importActual spread), so it is the entire
+ // taskSchedule surface this suite sees — it has to track the real module's drain
+ // API or a future test here that reaches the reconcile gate gets
+ // "not a function" instead of a stub.
+ PERPETUAL_DRAIN_DISPATCH_CAP: 5,
+ getPerpetualDrainState: vi.fn(async () => ({ signature: null, dispatchCount: 0 })),
+ recordPerpetualDispatch: vi.fn(async () => 1),
}));
vi.mock('./appActivity.js', async (importActual) => ({