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 (codex): exclude the unknown-reason sentinel from suppressed-proposal annotations

[._.]/ Adam Eivyfc2567da4c95
diff --git a/server/services/layeredIntelligence.js b/server/services/layeredIntelligence.js
index 57395f00cb..f88344a44c 100644
--- a/server/services/layeredIntelligence.js
+++ b/server/services/layeredIntelligence.js
@@ -30,7 +30,7 @@ import { validateCommand } from '../lib/commandSecurity.js';
import { getSettings } from './settings.js';
import { createTicket, searchIssues, addLabels, escapeJql } from './jira.js';
import { computeWindowedStats, computeEffectiveSuccessRate, extractTaskType } from './taskLearning/store.js';
-import { formatRejectionReasons, formatRejectionReason } from './layeredIntelligenceRejections.js';
+import { formatRejectionReasons, formatRejectionReason, REJECTION_REASONS } from './layeredIntelligenceRejections.js';
// Tracker labels + slug marker. The slug is the stable dedup key the reasoner
// chooses; it is embedded in each filed issue body so a later run (or the
@@ -674,15 +674,22 @@ export function suppressedIssueSlug(issue) {
* to avoid but WHY each was closed — the feedback loop of #2689 (ask #4), closing
* the loop with the taxonomy #2735 already persists rather than any new signal.
*
- * Only a RESOLVED non-merged record carries a diagnosis: a merged, unresolved, or
- * still-unclassified (`rejectionReason == null`) record contributes nothing, so the
- * annotation appears only where there is a real failure pattern to learn from.
- * First diagnosed record per slug wins (records arrive newest-filed-first). Pure.
+ * Only a RESOLVED non-merged record carries a diagnosis, and only a REAL taxonomy
+ * token (a member of REJECTION_REASONS) counts: a merged, unresolved, or
+ * still-unclassified (`rejectionReason == null`) record contributes nothing, and so
+ * does the `unknown-reason` SENTINEL — it means "we looked and found no signal",
+ * which is not an actionable failure pattern to route around, so annotating a
+ * suppressed proposal with "closed with no recorded reason" would add noise the
+ * reasoner can't act on (and would contradict the promise that undiagnosed closures
+ * stay unannotated). The annotation therefore appears only where a concrete reason
+ * explains the closure. First diagnosed record per slug wins (records arrive
+ * newest-filed-first). Pure.
*/
export function rejectionReasonBySlug(outcomes = []) {
const map = new Map();
for (const o of Array.isArray(outcomes) ? outcomes : []) {
- if (!o || (o.outcome !== 'rejected' && o.outcome !== 'abandoned') || !o.rejectionReason) continue;
+ if (!o || (o.outcome !== 'rejected' && o.outcome !== 'abandoned')) continue;
+ if (!REJECTION_REASONS.includes(o.rejectionReason)) continue;
const slug = normalizeSlug(o.slug);
if (slug && !map.has(slug)) map.set(slug, o.rejectionReason);
}
diff --git a/server/services/layeredIntelligence.test.js b/server/services/layeredIntelligence.test.js
index 50d514c005..34adec7f54 100644
--- a/server/services/layeredIntelligence.test.js
+++ b/server/services/layeredIntelligence.test.js
@@ -694,16 +694,18 @@ describe('suppressedIssueSlug + rejectionReasonBySlug (#2689 feedback loop)', ()
expect(suppressedIssueSlug({})).toBe(null);
});
- it('indexes only resolved, diagnosed, non-merged records — merged/unclassified contribute nothing', () => {
+ it('indexes only resolved records diagnosed with a REAL taxonomy reason', () => {
const map = rejectionReasonBySlug([
{ slug: 'a', outcome: 'rejected', rejectionReason: 'scope-mismatch' },
- { slug: 'b', outcome: 'abandoned', rejectionReason: 'unknown-reason' },
- { slug: 'c', outcome: 'merged', rejectionReason: 'scope-mismatch' }, // merged: not a rejection
- { slug: 'd', outcome: 'rejected', rejectionReason: null }, // unclassified: nothing to say
- { slug: 'e', outcome: null, rejectionReason: 'duplicate' } // unresolved
+ { slug: 'b', outcome: 'abandoned', rejectionReason: 'unknown-reason' }, // sentinel: not an actionable pattern
+ { slug: 'c', outcome: 'merged', rejectionReason: 'scope-mismatch' }, // merged: not a rejection
+ { slug: 'd', outcome: 'rejected', rejectionReason: null }, // unclassified: nothing to say
+ { slug: 'e', outcome: null, rejectionReason: 'duplicate' } // unresolved
]);
expect(map.get('a')).toBe('scope-mismatch');
- expect(map.get('b')).toBe('unknown-reason');
+ // The `unknown-reason` sentinel is deliberately excluded — it is the absence of a
+ // diagnosis, not a failure pattern the reasoner can route around.
+ expect(map.has('b')).toBe(false);
expect(map.has('c')).toBe(false);
expect(map.has('d')).toBe(false);
expect(map.has('e')).toBe(false);
@@ -856,6 +858,22 @@ describe('computeSelfEvalSummary (#2700)', () => {
expect(report).not.toContain('previously closed:');
});
+ it('does not annotate a proposal closed with the unknown-reason sentinel', () => {
+ const now = Date.now();
+ const recent = new Date(now - 5 * 24 * 60 * 60 * 1000).toISOString();
+ const report = computeSelfEvalSummary({
+ // Reconciled but undiagnosable: the sentinel is not an actionable failure pattern,
+ // so the "do NOT re-propose" line names it without a spurious reason gloss.
+ outcomes: [{ appId: 'a', slug: 'add-telemetry', outcome: 'rejected', rejectionReason: 'unknown-reason' }],
+ existingIssues: [
+ { number: 12, title: 'Add telemetry', body: '<!-- lil-slug: add-telemetry -->', state: 'closed', closedAt: recent }
+ ],
+ now
+ });
+ expect(report).toContain('#12 [add-telemetry] Add telemetry');
+ expect(report).not.toContain('previously closed:');
+ });
+
it('caps the named list and counts the remainder', () => {
const now = Date.now();
const closedAt = new Date(now - 24 * 60 * 60 * 1000).toISOString();