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

address review (claude): finish the #2620 comment sweep — abandoned is auto-derived, checked-item re-proposal is a guard-miss backstop

[._.]/ Adam Eivy81335a6b8adb
diff --git a/server/services/autonomousJobs/layeredIntelligenceHooks.js b/server/services/autonomousJobs/layeredIntelligenceHooks.js
index 02ae0b534c..96244c6397 100644
--- a/server/services/autonomousJobs/layeredIntelligenceHooks.js
+++ b/server/services/autonomousJobs/layeredIntelligenceHooks.js
@@ -339,8 +339,9 @@ 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 })
// 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
+ // tag regardless of checkbox. Since #2620 a CHECKED item stays within the
+ // dedup window, so a re-proposal normally never reaches here; should the
+ // guard ever miss, this backstop 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 }
}
@@ -448,10 +449,12 @@ export async function processTaskOutput({ appId, success, payload, agentId } = {
const filed = await fileProposal({ filer, forgeCli, cwd, app, proposal, jira })
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).
+ // reasoner re-proposed — normally caught by the dedup guard since #2620,
+ // so this is the guard-miss backstop): 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`)
diff --git a/server/services/layeredIntelligence.js b/server/services/layeredIntelligence.js
index 610204baaf..c1a6ca498c 100644
--- a/server/services/layeredIntelligence.js
+++ b/server/services/layeredIntelligence.js
@@ -83,9 +83,11 @@ export const PROPOSAL_COMPLEXITIES = ['trivial', 'moderate', 'complex'];
export const HANDOFF_COMPLEXITY = 'trivial';
// The resolved outcomes a filed proposal can reach (the feedback loop, #2428).
-// A record with a null outcome is still open/unresolved. `abandoned` is reserved
-// for a superseded proposal — auto-derivation only distinguishes merged/rejected
-// from the tracker's closed state; `abandoned` is set by a user/future path.
+// A record with a null outcome is still open/unresolved. All three are
+// auto-derived from the tracker's closed state by deriveOutcome: completed →
+// merged, not_planned → rejected, and any other PRESENT close reason
+// (duplicate/stale/etc.) → abandoned (#2620); a reason-less close falls back
+// to merged for trackers that report no stateReason.
export const PROPOSAL_OUTCOMES = ['merged', 'rejected', 'abandoned'];
/**
diff --git a/server/services/layeredIntelligenceOutcomes.js b/server/services/layeredIntelligenceOutcomes.js
index 4c8ca13054..7a0966c87d 100644
--- a/server/services/layeredIntelligenceOutcomes.js
+++ b/server/services/layeredIntelligenceOutcomes.js
@@ -154,7 +154,7 @@ export async function listOutcomes({ appId, now = Date.now() } = {}, store = out
* Reconcile still-unresolved outcome records against a FRESH tracker read. For
* each stored record whose outcome is null, find the matching existing issue (by
* slug) and, when the tracker now reports it closed, persist the derived outcome
- * (`merged` / `rejected`). Open issues stay unresolved. Returns the number of
+ * (`merged` / `rejected` / `abandoned`). Open issues stay unresolved. Returns the number of
* records updated. Never throws — a per-record write failure is swallowed so one
* bad row can't abort the whole reconciliation.
*/