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

docs: pin the label-only-closure gap on reason-less trackers as a known limitation (#2689)

[._.]/ Adam Eivy422d283ffd66
diff --git a/server/services/layeredIntelligenceOutcomes.test.js b/server/services/layeredIntelligenceOutcomes.test.js
index 59aac47408..92e3d9c1ac 100644
--- a/server/services/layeredIntelligenceOutcomes.test.js
+++ b/server/services/layeredIntelligenceOutcomes.test.js
@@ -287,6 +287,24 @@ describe('reconcileOutcomes', () => {
expect((await rowsBySlug())['mystery'].rejectionReason).toBe('duplicate');
});
+ it('leaves a label-only closure on a reason-less tracker unclassified (known limitation)', async () => {
+ // glab/jira never report a stateReason, so deriveOutcome reads a bare close as
+ // `merged` and classification never runs — the `wontfix` signal is wasted.
+ // Pinned so the gap is explicit, not accidental. Letting labels override the
+ // merged fallback is NOT a safe fix: a stale `blocked` label on a genuinely
+ // completed issue would flip it to rejected and corrupt the merge rate the
+ // other way. Needs a disposition/state label split + a deriveOutcome change
+ // (#2620's semantics) — see the module header.
+ await recordFiledProposal({ appId: 'app-1', slug: 'glab-wontfix' }, store);
+ await reconcileOutcomes({
+ appId: 'app-1',
+ existingIssues: [{ slug: 'glab-wontfix', state: 'closed', stateReason: null, labels: ['wontfix'], closedAt: '2026-07-01T00:00:00Z' }]
+ }, store);
+ const row = (await rowsBySlug())['glab-wontfix'];
+ expect(row.outcome).toBe('merged');
+ expect(row.rejectionReason).toBeNull();
+ });
+
it('clears a stale rejection reason when a proposal is reopened and then merged', async () => {
// rejected → reopened → closed completed. The write side must drop the old
// diagnosis, not just rely on the sanitizer stripping it on read.
diff --git a/server/services/layeredIntelligenceRejections.js b/server/services/layeredIntelligenceRejections.js
index 910ae816dd..a567d2fa86 100644
--- a/server/services/layeredIntelligenceRejections.js
+++ b/server/services/layeredIntelligenceRejections.js
@@ -18,6 +18,24 @@
* `layeredIntelligence.js` (which formats the reports) and
* `layeredIntelligenceOutcomes.js` (which persists the classification) can use it
* without an import cycle.
+ *
+ * KNOWN LIMITATION — label-only closures on trackers with no close reason.
+ * Classification runs only on an outcome `deriveOutcome` already called non-merged,
+ * and that fallback maps a closed issue with NO `stateReason` to `merged` (glab and
+ * jira never report one, and their ordinary close IS a merge). So a GitLab issue
+ * closed with a bare `wontfix` label reads as merged and is never classified — its
+ * label signal is wasted, and it inflates the merge rate.
+ *
+ * Fixing it is NOT as simple as letting labels override the merged fallback: the
+ * map below mixes labels that state a FINAL DISPOSITION (`wontfix`, `duplicate`,
+ * `declined`, `out-of-scope` — the issue is over, and this is why) with labels that
+ * describe a STATE THE ISSUE PASSED THROUGH (`blocked`, `needs-input`, `invalid`,
+ * `conflict`). Only the first group can justify overriding `merged`; a stale
+ * `blocked` label left on a genuinely completed GitLab issue would otherwise flip it
+ * to rejected and corrupt the merge rate in the opposite direction — worse than the
+ * gap it closes. The fix therefore needs a disposition/state split here plus a
+ * change to `deriveOutcome`'s merge-rate semantics (#2620's territory), so it is
+ * deliberately left to a follow-up rather than bolted on. Tracked on #2689.
*/
// The rejection-reason vocabulary. Stored on the outcome record and rendered into