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: manual issue claims no longer blocked by a running claim-issue drain

[._.]/ Adam Eivy79fe2af18a47
diff --git a/server/services/cosTaskStore.js b/server/services/cosTaskStore.js
index 17fbac878e..17c432fdef 100644
--- a/server/services/cosTaskStore.js
+++ b/server/services/cosTaskStore.js
@@ -356,11 +356,18 @@ export async function addTask(taskData, taskType = 'user', { raw = false, ignore
// One state lock covers BOTH task files: manual and autonomous producers
// must acquire the same durable work identity even with different titles.
- if (developmentWorkIdentity(taskData)) {
+ const newWorkIdentity = developmentWorkIdentity(taskData);
+ if (newWorkIdentity) {
const otherPath = join(ROOT_DIR, taskType === 'user' ? state.config.cosTasksFile : state.config.userTasksFile);
const other = existsSync(otherPath) ? await readTaskFile(otherPath) : [];
const owner = [...tasks, ...other].find(task => task.id !== ignoreTaskId
- && DEVELOPMENT_ACTIVE_STATUSES.has(task.status) && sameDevelopmentWork(task, taskData));
+ && DEVELOPMENT_ACTIVE_STATUSES.has(task.status) && sameDevelopmentWork(task, taskData)
+ // A pinned claim of one specific issue is not a duplicate of an already-running
+ // unpinned (wildcard) claim-issue drain for the same app: the drain works the
+ // backlog in bulk, but the operator must still be able to hand-pick a specific
+ // issue while it runs. Two pinned claims for the same issue, or two unpinned
+ // drains for the same app, remain duplicates.
+ && !(newWorkIdentity.kind === 'issue' && newWorkIdentity.key !== '*' && developmentWorkIdentity(task)?.key === '*'));
if (owner) return { ...owner, duplicate: true };
}
diff --git a/server/services/cosTaskStore.test.js b/server/services/cosTaskStore.test.js
index 3a27e8b383..7a6e48ec5e 100644
--- a/server/services/cosTaskStore.test.js
+++ b/server/services/cosTaskStore.test.js
@@ -2345,9 +2345,17 @@ describe('shared development work admission', () => {
await updateTask(manual.id, { status: 'completed' }, 'user');
expect((await addTask({ description: 'New evidence', metadata }, 'internal')).duplicate).not.toBe(true);
});
- it('reserves untargeted claims against targeted work while preserving independent apps', async () => {
+ it('lets a manual pinned claim proceed alongside a running untargeted drain, but still blocks true duplicates', async () => {
const claim = await addTask({ description: 'Claim next', app: 'example', claimFlow: true }, 'internal');
- expect(await addTask({ description: 'Claim 42', app: 'example', claimFlow: true, claimTarget: '42' }, 'user'))
+ // A manual claim of a specific issue is not a duplicate of the app's running
+ // unpinned batch drain — the operator can hand-pick an issue while it runs.
+ const targeted = await addTask({ description: 'Claim 42', app: 'example', claimFlow: true, claimTarget: '42' }, 'user');
+ expect(targeted.duplicate).not.toBe(true);
+ // But a second manual claim of the SAME issue is still a duplicate...
+ expect(await addTask({ description: 'Claim 42 again', app: 'example', claimFlow: true, claimTarget: '42' }, 'user'))
+ .toMatchObject({ id: targeted.id, duplicate: true });
+ // ...and a second untargeted drain for the same app is still a duplicate too.
+ expect(await addTask({ description: 'Claim next again', app: 'example', claimFlow: true }, 'internal'))
.toMatchObject({ id: claim.id, duplicate: true });
expect((await addTask({ description: 'Claim 42', app: 'different', claimFlow: true, claimTarget: '42' }, 'user')).duplicate).not.toBe(true);
});