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): arm hard-exclusion notice regardless of selfEval toggle

[._.]/ Adam Eivyab1cdacec6ed
diff --git a/server/services/autonomousJobs/layeredIntelligenceHooks.js b/server/services/autonomousJobs/layeredIntelligenceHooks.js
index 38f13558e1..2316ab2c4a 100644
--- a/server/services/autonomousJobs/layeredIntelligenceHooks.js
+++ b/server/services/autonomousJobs/layeredIntelligenceHooks.js
@@ -376,7 +376,11 @@ export async function buildTaskInput({ app } = {}) {
// its proposals would park the loop on every such app permanently.
// Read LI's own execution-health stats ONCE and feed BOTH the selfEval Signal-3 line
// and the hard-exclusion notice (#2824) — they must judge health off the same number.
- const liTaskStats = (config.sources?.selfEval) ? await readLiTaskMetrics() : null
+ // Read UNCONDITIONALLY (not gated on the selfEval source): the hard-exclusion gate in
+ // processTaskOutput enforces regardless of any source toggle, so the reasoner-facing
+ // notice must arm under the SAME condition — otherwise a selfEval-off app would get no
+ // warning yet still have its proposal silently dropped, wasting the whole run.
+ const liTaskStats = await readLiTaskMetrics()
let selfEvalReport = ''
if (config.sources?.selfEval) {
selfEvalReport = computeSelfEvalSummary({
@@ -388,7 +392,7 @@ export async function buildTaskInput({ app } = {}) {
// Hard-exclusion notice (#2824): the reasoner-facing mirror of the deterministic
// filing gate. '' unless LI's execution health is degraded (gate armed), so a healthy
- // loop's prompt is unchanged. Enforcement runs in processTaskOutput regardless.
+ // loop's prompt is unchanged. Armed off the same liTaskStats the enforcement gate reads.
const hardExclusionNotice = computeHardExclusionNotice({
liTaskStats,
outcomes: Array.isArray(outcomes) ? outcomes : []
diff --git a/server/services/autonomousJobs/layeredIntelligenceHooks.test.js b/server/services/autonomousJobs/layeredIntelligenceHooks.test.js
index ca01245dbb..96d84383e0 100644
--- a/server/services/autonomousJobs/layeredIntelligenceHooks.test.js
+++ b/server/services/autonomousJobs/layeredIntelligenceHooks.test.js
@@ -315,11 +315,17 @@ describe('buildTaskInput', () => {
expect(li.buildPrompt).toHaveBeenCalledWith(expect.objectContaining({ outcomesReport: expect.stringContaining('Total filed: 1') }));
});
- it('skips selfEval when the source toggle is off (#2700)', async () => {
+ it('skips the selfEval REPORT when the source toggle is off, but still arms the hard-exclusion notice (#2700/#2824)', async () => {
li.getEffectiveConfig.mockReturnValue({ providerId: 'ollama', model: 'qwen', allowedScopes: ['app-improvement'], sources: {} });
await buildTaskInput({ app: APP });
expect(li.computeSelfEvalSummary).not.toHaveBeenCalled();
- expect(li.readLiTaskMetrics).not.toHaveBeenCalled();
+ // The selfEval source toggle no longer gates the execution-health read: the hard-
+ // exclusion gate (#2824) enforces regardless of any source toggle, so its reasoner-
+ // facing notice must arm under the same condition — which needs the health stats.
+ expect(li.readLiTaskMetrics).toHaveBeenCalled();
+ expect(li.computeHardExclusionNotice).toHaveBeenCalledWith(expect.objectContaining({
+ liTaskStats: expect.objectContaining({ read: true })
+ }));
expect(li.buildPrompt).toHaveBeenCalledWith(expect.objectContaining({ selfEvalReport: '' }));
});
diff --git a/server/services/layeredIntelligence.js b/server/services/layeredIntelligence.js
index 90ff954210..e8beaebf0b 100644
--- a/server/services/layeredIntelligence.js
+++ b/server/services/layeredIntelligence.js
@@ -1503,10 +1503,12 @@ export function computeHardExclusionNotice({ liTaskStats = null, outcomes = [],
];
// Surface each currently chronically-failing domain by name so the reasoner can route
- // around it explicitly — the same isAvoidDomain set rule 2 of the gate enforces.
+ // around it explicitly — the same isAvoidDomain set rule 2 of the gate enforces. Skip
+ // any self-improve scope already named in the bullet above (gate rule 1 short-circuits
+ // rule 2 for those) so the notice never lists the same scope twice.
const byDomain = computeExecutionByDomain(outcomes);
const failing = Object.entries(byDomain)
- .filter(([, bucket]) => isAvoidDomain(bucket))
+ .filter(([scope, bucket]) => isAvoidDomain(bucket) && !SELF_IMPROVE_SCOPES.includes(scope))
.map(([scope, bucket]) => `${clampScopeLabel(scope)} (${bucket.successRate}% over ${bucket.completed})`);
if (failing.length) {
lines.push(`- Any proposal in a chronically-failing execution domain: ${failing.join('; ')}.`);