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: stop reading LI's own pause label as a rejection diagnosis (#2689)

[._.]/ Adam Eivy13af131dccde
diff --git a/server/services/layeredIntelligenceRejections.js b/server/services/layeredIntelligenceRejections.js
index 85a0840290..cb90fb64b2 100644
--- a/server/services/layeredIntelligenceRejections.js
+++ b/server/services/layeredIntelligenceRejections.js
@@ -93,10 +93,23 @@ function normalizeToken(value) {
return typeof value === 'string' ? value.trim().toLowerCase().replace(/[\s_-]+/g, '-') : '';
}
-// Label → reason. Labels are a deliberate human act, so they outrank the generic
-// stateReason: `not_planned` + a `duplicate` label is a duplicate, not a bare
-// user rejection. Keys are normalizeToken'd; add conventions here rather than
-// teaching callers to pre-map.
+// Label → reason. Every key here must be a label a HUMAN applies as a judgement
+// about the issue: that is what earns labels their precedence over the generic
+// stateReason (`not_planned` + a `duplicate` label is a duplicate, not a bare user
+// rejection).
+//
+// Machine-applied labels must NEVER appear in this map, however suggestive they
+// look. LI stamps `layered-intelligence:blocking` on its own proposals to record
+// that the loop is paused there (applyBlockingLabel ← the reasoner's
+// `pause.blockOnIssue`); it is bookkeeping, not a diagnosis of why a proposal
+// failed. Mapping it to `environment-blocker` would outrank a real `not_planned`
+// close and feed the loop "blocked on the environment" when the user simply
+// declined — LI corrupting the very signal this taxonomy exists to produce, via
+// its own marker. Human-applied `blocked` / `environment-blocker` labels below
+// carry that meaning legitimately.
+//
+// Keys are normalizeToken'd; add conventions here rather than teaching callers to
+// pre-map.
const LABEL_REASONS = new Map(Object.entries({
'duplicate': 'duplicate',
'dupe': 'duplicate',
@@ -111,7 +124,6 @@ const LABEL_REASONS = new Map(Object.entries({
'invalid': 'quality-issue',
'quality-issue': 'quality-issue',
'blocked': 'environment-blocker',
- 'layered-intelligence:blocking': 'environment-blocker',
'environment-blocker': 'environment-blocker',
'merge-conflict': 'merge-conflict',
'conflict': 'merge-conflict',
diff --git a/server/services/layeredIntelligenceRejections.test.js b/server/services/layeredIntelligenceRejections.test.js
index b669e6168f..ea0e882628 100644
--- a/server/services/layeredIntelligenceRejections.test.js
+++ b/server/services/layeredIntelligenceRejections.test.js
@@ -78,11 +78,25 @@ describe('classifyRejection', () => {
expect(classifyRejection({ outcome: 'rejected', labels: ['NEEDS_INPUT'] })).toBe('missing-context');
});
- it('maps the LI blocking label to an environment blocker', () => {
+ it('maps a human-applied blocked label to an environment blocker', () => {
+ expect(classifyRejection({ outcome: 'rejected', labels: ['blocked'] })).toBe('environment-blocker');
+ });
+
+ it("ignores LI's own machine-applied pause label instead of reading it as a diagnosis", () => {
+ // LI stamps `layered-intelligence:blocking` on its own proposals to record that
+ // the loop is paused there. Treating that as evidence would outrank the real
+ // close reason and feed the loop "blocked on the environment" when the user
+ // simply declined — LI corrupting its own feedback signal via its own marker.
expect(classifyRejection({
outcome: 'rejected',
+ stateReason: 'not_planned',
labels: ['layered-intelligence:blocking']
- })).toBe('environment-blocker');
+ })).toBe('user-rejected');
+ // And with no other signal it is an honest unknown, not a fabricated blocker.
+ expect(classifyRejection({
+ outcome: 'rejected',
+ labels: ['layered-intelligence', 'layered-intelligence:blocking']
+ })).toBe(UNKNOWN_REJECTION_REASON);
});
it('ignores labels it has no mapping for and falls through to the stateReason', () => {