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
fix: report re-proposed already-tracked PLAN slug as duplicate, preserve outcome (#2435)
Adam Eivyd9f4be986645
diff --git a/server/services/autonomousJobs/layeredIntelligenceHooks.js b/server/services/autonomousJobs/layeredIntelligenceHooks.jsindex bb75753fab..02a5557952 100644--- a/server/services/autonomousJobs/layeredIntelligenceHooks.js+++ b/server/services/autonomousJobs/layeredIntelligenceHooks.js@@ -260,7 +260,11 @@ async function fileProposal({ filer, forgeCli, cwd, app, proposal, jira }) {}if (filer === 'plan' && cwd) {const res = await appendProposalToPlan({ repoPath: cwd, appName: app.name, slug: proposal.slug, title: proposal.title, body: proposal.body })- return { success: res.success, number: null }+ // Propagate `duplicate`: appendProposalToPlan dedups on the raw `[lil-<slug>]`+ // tag regardless of checkbox, so a CHECKED item the reasoner re-proposed (now+ // out of the dedup window, #2435) writes nothing and returns duplicate. The+ // caller must NOT treat that as a fresh file — see processTaskOutput.+ return { success: res.success, number: null, duplicate: res.duplicate }}return { success: false, error: `filer "${filer}" not implemented` }}@@ -364,7 +368,16 @@ export async function processTaskOutput({ appId, success, payload, agentId } = {reason = 'semantic-duplicate'} else {const filed = await fileProposal({ filer, forgeCli, cwd, app, proposal, jira })- if (filed.success) {+ if (filed.success && filed.duplicate) {+ // The tracker already carries this slug's tag (a checked PLAN item the+ // reasoner re-proposed): appendProposalToPlan wrote nothing. Report a+ // duplicate and leave any recorded outcome untouched — reporting `filed`+ // here would clear the merged outcome and let the still-checked item+ // reconcile as a false fresh merge on the next run (#2435).+ filedAction = 'duplicate'+ reason = 'duplicate'+ console.log(`♻️ Layered Intelligence: ${app.name} proposal "${proposal.slug}" already tracked in PLAN.md — suppressed`)+ } else if (filed.success) {filedNumber = filed.number ?? nullfiledKey = filed.key ?? nullfiledAction = 'filed'diff --git a/server/services/autonomousJobs/layeredIntelligenceHooks.test.js b/server/services/autonomousJobs/layeredIntelligenceHooks.test.jsindex 9bac94896b..091f2b06eb 100644--- a/server/services/autonomousJobs/layeredIntelligenceHooks.test.js+++ b/server/services/autonomousJobs/layeredIntelligenceHooks.test.js@@ -254,6 +254,23 @@ describe('processTaskOutput', () => {}));});+ it('reports a re-proposed already-tracked PLAN slug as duplicate without resetting its outcome (#2435)', async () => {+ // A checked `- [x]` item passes the dedup guard (re-proposable), but+ // appendProposalToPlan writes nothing (tag already present) and returns+ // duplicate — the hook must NOT report `filed` or record a fresh outcome.+ resolveAppWorkTracker.mockResolvedValue({ resolved: 'plan', forge: null });+ li.validateReasonerResponse.mockReturnValue({+ proposal: { scope: 'app-improvement', slug: 'add-metrics', title: 'Add metrics', body: 'do it' },+ pause: null+ });+ li.isProposalDuplicate.mockReturnValue(false); // out of dedup window (checked, no closedAt)+ li.appendProposalToPlan.mockResolvedValue({ success: true, duplicate: true });+ li.getEffectiveConfig.mockReturnValue({ allowedScopes: ['app-improvement'], sources: { outcomes: true } });+ const out = await processTaskOutput({ appId: 'app-1', success: true, payload: { proposal: {} } });+ expect(out).toMatchObject({ action: 'duplicate', reason: 'duplicate' });+ expect(recordFiledProposal).not.toHaveBeenCalled();+ });+it('suppresses an exact-duplicate proposal without filing', async () => {li.validateReasonerResponse.mockReturnValue({proposal: { scope: 'app-improvement', slug: 'dup', title: 'Dup', body: 'x' },