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): notice reads outcomes directly so failing-domain exclusions are always announced

[._.]/ Adam Eivyd058986d8772
diff --git a/server/services/autonomousJobs/layeredIntelligenceHooks.js b/server/services/autonomousJobs/layeredIntelligenceHooks.js
index 2316ab2c4a..d61a69d1ce 100644
--- a/server/services/autonomousJobs/layeredIntelligenceHooks.js
+++ b/server/services/autonomousJobs/layeredIntelligenceHooks.js
@@ -393,10 +393,15 @@ 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. Armed off the same liTaskStats the enforcement gate reads.
- const hardExclusionNotice = computeHardExclusionNotice({
- liTaskStats,
- outcomes: Array.isArray(outcomes) ? outcomes : []
- })
+ // Its failing-domain list must be derived from the SAME outcomes the enforcement gate
+ // reads in processTaskOutput — which loads them DIRECTLY (independent of the `outcomes`
+ // prompt-source toggle). So when the gathered `outcomes` aren't an array (source off /
+ // store unreadable), read them directly here too; otherwise a domain the gate would
+ // exclude on could be silently absent from the notice.
+ const noticeOutcomes = Array.isArray(outcomes)
+ ? outcomes
+ : await listOutcomes({ appId: app.id }).catch(() => [])
+ const hardExclusionNotice = computeHardExclusionNotice({ liTaskStats, outcomes: noticeOutcomes })
const prompt = buildPrompt({ app, config, sources, openIssues, isPortos, outcomesReport, selfEvalReport, proposalExecutionReport, crossReferenceReport, hardExclusionNotice }) + buildCompletionContract()
// Option A: surface the fully-resolved LI agent provider/model (from
diff --git a/server/services/autonomousJobs/layeredIntelligenceHooks.test.js b/server/services/autonomousJobs/layeredIntelligenceHooks.test.js
index 96d84383e0..a7c6ccf5b0 100644
--- a/server/services/autonomousJobs/layeredIntelligenceHooks.test.js
+++ b/server/services/autonomousJobs/layeredIntelligenceHooks.test.js
@@ -353,6 +353,20 @@ describe('buildTaskInput', () => {
}));
});
+ it('reads outcomes DIRECTLY for the hard-exclusion notice when the outcomes source is off (#2824)', async () => {
+ // The enforcement gate reads outcomes directly (independent of the prompt-source
+ // toggle), so the notice's failing-domain list must too — else a domain the gate
+ // would exclude on is silently absent from the prompt. With the outcomes SOURCE off,
+ // the gathered `outcomes` is null, so the notice falls back to a direct listOutcomes read.
+ li.getEffectiveConfig.mockReturnValue({ providerId: 'ollama', model: 'qwen', allowedScopes: ['app-improvement'], sources: { selfEval: true } });
+ listOutcomes.mockResolvedValue([{ scope: 'app-improvement', executionOutcome: 'failure' }]);
+ await buildTaskInput({ app: APP });
+ expect(listOutcomes).toHaveBeenCalledWith(expect.objectContaining({ appId: 'app-1' }));
+ expect(li.computeHardExclusionNotice).toHaveBeenCalledWith(expect.objectContaining({
+ outcomes: [{ scope: 'app-improvement', executionOutcome: 'failure' }]
+ }));
+ });
+
it('passes outcomes to selfEval as null (not []) when the outcomes source is off (#2700)', async () => {
// The sentinel that keeps "we never gathered outcomes" from reaching the
// reasoner as "this app has never had a proposal merged".