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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix(issue-2760): address codex review — honest framing, PortOS gate, size cap
[._.]/ Adam Eivy2ea576cacda8
diff --git a/server/services/autonomousJobs/layeredIntelligenceHooks.js b/server/services/autonomousJobs/layeredIntelligenceHooks.jsindex dae5e82301..deaf7b058f 100644--- a/server/services/autonomousJobs/layeredIntelligenceHooks.js+++ b/server/services/autonomousJobs/layeredIntelligenceHooks.js@@ -302,7 +302,7 @@ export async function buildTaskInput({ app } = {}) {// (#2698) can read the app's committed backlog off the SAME tracker the loop// files to — gatherSources has no other way to know where work lives.const [sources, issuesRead] = await Promise.all([- gatherSources(app, config, { tracker: { filer, forgeCli, cwd, jira } }),+ gatherSources(app, config, { tracker: { filer, forgeCli, cwd, jira }, isPortos }),readIssues({ filer, forgeCli, cwd, jira, config })])const { openIssues, existingIssues, trackerReadFailed } = issuesReaddiff --git a/server/services/autonomousJobs/layeredIntelligenceHooks.test.js b/server/services/autonomousJobs/layeredIntelligenceHooks.test.jsindex 067a1f6998..0fcc88324c 100644--- a/server/services/autonomousJobs/layeredIntelligenceHooks.test.js+++ b/server/services/autonomousJobs/layeredIntelligenceHooks.test.js@@ -230,7 +230,7 @@ describe('buildTaskInput', () => {expect(li.gatherSources).toHaveBeenCalledWith(APP,expect.anything(),- { tracker: { filer: 'forge', forgeCli: 'gh', cwd: '/repo', jira: null } }+ { tracker: { filer: 'forge', forgeCli: 'gh', cwd: '/repo', jira: null }, isPortos: expect.any(Boolean) });});@@ -241,7 +241,7 @@ describe('buildTaskInput', () => {expect(li.gatherSources).toHaveBeenCalledWith(jiraApp,expect.anything(),- { tracker: expect.objectContaining({ filer: 'jira', jira: expect.objectContaining({ instanceId: 'i1', projectKey: 'PROJ' }) }) }+ { tracker: expect.objectContaining({ filer: 'jira', jira: expect.objectContaining({ instanceId: 'i1', projectKey: 'PROJ' }) }), isPortos: expect.any(Boolean) });});diff --git a/server/services/layeredIntelligence.js b/server/services/layeredIntelligence.jsindex 641abc7913..7035c51981 100644--- a/server/services/layeredIntelligence.js+++ b/server/services/layeredIntelligence.js@@ -195,6 +195,15 @@ export const SCOPE_PREFER_SUCCESS_THRESHOLD = 75; // >=// proposal), so a slightly lower bar to surface the signal is acceptable.export const SCOPE_AWARENESS_MIN_SAMPLE = 3;+// Prompt-size bounds for the scope-awareness block, so a long-lived install with many+// task types (mission task keys embed an unbounded mission name) can't render an+// oversized block — the raw cosMetrics source is already char-capped for the same+// reason. Cap the entries surfaced per list (the lists are sorted sharpest-first, so+// the cap keeps the most decision-relevant scopes) and truncate any single task-type+// name so one pathological key can't blow the budget.+export const SCOPE_AWARENESS_MAX_PER_LIST = 12;+export const SCOPE_AWARENESS_MAX_TYPE_LEN = 80;+/*** The default per-app config. PortOS (isPortos) additionally gets the meta/self* scopes so the loop can extend itself; every other app is capped at its own@@ -918,12 +927,22 @@ export function computeSelfEvalSummary({}/**- * Scope-awareness report (#2760). Classifies each CoS task-type scope by its execution- * success rate into "avoid" (chronically failing) and "prefer" (reliably succeeding),- * then renders guidance the reasoner can use to steer a proposal toward work that will- * actually execute. Pure — takes the already-parsed per-type metrics map (the `summary`+ * Scope-awareness report (#2760). Classifies each CoS task TYPE by its completion rate+ * into low-completion and high-completion lists, as directional context for the+ * reasoner. Pure — takes the already-parsed per-type metrics map (the `summary`* gatherSources builds from learning.byTaskType) and returns a report string, or ''- * when no scope has enough runs to qualify either way.+ * when no type has enough runs to qualify either way.+ *+ * IMPORTANT (codex P1): this is per-task-TYPE, install-wide completion telemetry — NOT+ * a per-proposal execution record. An LI proposal is later implemented through a+ * claim/plan/handoff task whose task type does NOT carry the proposal's domain (a+ * handoff becomes `internal-task`; a claimed issue runs under the claim task type), so+ * these buckets are populated by independently-scheduled jobs, not by LI's own+ * proposals bucketed by subject. The block is therefore framed as "work of this KIND+ * tends to (not) get finished here" — useful directional context (especially LI's own+ * reasoning-run type, self-improve:layered-intelligence, which IS LI's execution) — and+ * deliberately NOT a claim that a given proposal maps 1:1 onto a listed type. Proper+ * per-proposal-domain outcome correlation is tracked as a follow-up (#2765).** `metricsByType[type] = { lifetimeSuccessRate, lifetimeCompleted, recentSuccessRate, recentCompleted, ... }`.*@@ -974,11 +993,27 @@ export function computeScopeAwareness({ metricsByType = {} } = {}) {// signal at the top of each list.avoid.sort((a, b) => a.rate - b.rate);prefer.sort((a, b) => b.rate - a.rate);- const fmt = ({ type, rate, n }) => `- ${type}: ${Math.round(rate)}% success over ${n} runs`;- const section = (header, items) => `${header}\n${items.map(fmt).join('\n')}`;+ // Cap each list (sharpest-first) and truncate a pathological task-type name so the+ // block stays bounded on a long-lived install.+ const clampType = (type) => type.length > SCOPE_AWARENESS_MAX_TYPE_LEN+ ? `${type.slice(0, SCOPE_AWARENESS_MAX_TYPE_LEN - 1)}…`+ : type;+ const fmt = ({ type, rate, n }) => `- ${clampType(type)}: ${Math.round(rate)}% completed over ${n} runs`;+ const section = (header, items) => {+ const shown = items.slice(0, SCOPE_AWARENESS_MAX_PER_LIST);+ const more = items.length - shown.length;+ const lines = shown.map(fmt);+ if (more > 0) lines.push(`- …and ${more} more`);+ return `${header}\n${lines.join('\n')}`;+ };const sections = [];- if (avoid.length) sections.push(section(`AVOID — these scopes' work has historically FAILED to execute (below ${SCOPE_AVOID_SUCCESS_THRESHOLD}% success):`, avoid));- if (prefer.length) sections.push(section(`PREFER — these scopes execute reliably (at or above ${SCOPE_PREFER_SUCCESS_THRESHOLD}% success):`, prefer));+ // Honest framing (#2760, codex P1): these are per-task-TYPE completion rates for the+ // whole install — NOT a per-proposal execution record. An LI proposal is implemented+ // through a claim/plan/handoff task whose type does not carry the proposal's domain,+ // so this is directional context ("work of this kind tends to (not) get finished+ // here"), not a claim that a given proposal maps 1:1 onto a listed type.+ if (avoid.length) sections.push(section(`LOW-COMPLETION task types — work of this kind is finished below ${SCOPE_AVOID_SUCCESS_THRESHOLD}% of the time on this install:`, avoid));+ if (prefer.length) sections.push(section(`HIGH-COMPLETION task types — finished at or above ${SCOPE_PREFER_SUCCESS_THRESHOLD}%:`, prefer));return sections.join('\n\n');}@@ -1056,13 +1091,15 @@ export function buildPrompt({ app, config, sources = {}, openIssues = [], isPort? `\n### liSelfEval\n${selfEvalReport.trim()}\n\nWeigh this against the sources above before you commit to a proposal. Filing nothing (proposal: null) is a legitimate, and sometimes the correct, outcome — a marginal issue costs the user triage time and lowers your merge rate further.\n`: '';- // Scope-awareness (#2760): your proposal, once filed, is EXECUTED as a CoS task, so- // the historical per-scope execution-success rates below predict whether the work- // you propose will actually land. Steer toward PREFER scopes and away from AVOID- // ones; if the highest-value work genuinely falls in an AVOID scope, you may still- // propose it, but scope it narrowly and justify why it will execute this time.- const scopeGuidanceBlock = (typeof sources.scopeGuidance === 'string' && sources.scopeGuidance.trim())- ? `\n### liScopeAwareness\n${sources.scopeGuidance.trim()}\n\nYour proposals are executed as CoS tasks in these scopes. Favor work that maps to a PREFER scope; treat AVOID scopes as needing a narrow scope and an explicit justification (or a null proposal) rather than a default.\n`+ // Scope-awareness (#2760): install-wide completion rates by CoS task TYPE — directional+ // context for how reliably different KINDS of work get finished here. PortOS-only+ // (codex P2): these rates are this install's own CoS execution history, meaningless to+ // a managed app, so the block is gated on isPortos even if a managed app enabled the+ // cosMetrics source. It is context, not a rule (codex P1): a proposal does not map 1:1+ // onto a listed type, so treat a low-completion type as a reason for extra scrutiny /+ // a narrower scope, not a hard veto.+ const scopeGuidanceBlock = (isPortos && typeof sources.scopeGuidance === 'string' && sources.scopeGuidance.trim())+ ? `\n### liScopeAwareness\n${sources.scopeGuidance.trim()}\n\nThese are per-task-type completion rates for THIS install — how reliably each KIND of work tends to get finished, not a per-proposal record (your proposals don't map 1:1 onto these types). Use it as directional context: a proposal whose implementation resembles a low-completion type deserves extra scrutiny or a narrower scope; high-completion kinds are safer bets. A low rate on self-improve:layered-intelligence is LI's OWN reasoning-run rate — a direct signal to propose conservatively.\n`: '';return `You are the Layered Intelligence reasoner for the app "${app.name}". Your job is to evaluate how THIS app is performing against its OWN goals and purpose${isPortos ? '' : ', not how well PortOS\'s tooling manages it'}. Decide the SINGLE highest-value improvement to propose this run (signal, not noise), grounded in the app's own goals and its own performance metrics (user success, KPIs, production telemetry). You never write code; you return structured JSON that a deterministic system files as ONE tracker issue.@@ -1267,7 +1304,7 @@ export async function gatherPlannedWork({* (`{ filer, forgeCli, cwd, jira }`, resolved by the caller) enables the* plannedWork source — absent, that source is simply skipped.*/-export async function gatherSources(app, config, { cosPath = PATHS.cos, trustShellSources, tracker = null } = {}) {+export async function gatherSources(app, config, { cosPath = PATHS.cos, trustShellSources, tracker = null, isPortos = false } = {}) {const out = {};const src = config.sources || {};const repo = app.repoPath;@@ -1334,14 +1371,18 @@ export async function gatherSources(app, config, { cosPath = PATHS.cos, trustShe};}out.cosMetrics = JSON.stringify(summary).slice(0, 4000);- // Scope-awareness guidance (#2760): a deterministic avoid/prefer split derived- // from the SAME per-type rates above, so the reasoner gets an interpreted signal- // alongside the raw JSON instead of being asked to spot the pattern itself.- // Rendered as its own prompt block (see buildPrompt), not a generic source dump.- // Gated implicitly on the cosMetrics source being enabled — which is the- // PortOS-vs-managed boundary these self-execution rates belong to.- const scopeGuidance = computeScopeAwareness({ metricsByType: summary });- if (scopeGuidance) out.scopeGuidance = scopeGuidance;+ // Scope-awareness guidance (#2760): a deterministic low/high-completion split+ // derived from the SAME per-type rates above, so the reasoner gets an interpreted+ // signal alongside the raw JSON instead of being asked to spot the pattern itself.+ // Rendered as its own prompt block (see buildPrompt). Gated on isPortos (codex P2):+ // these are THIS install's own CoS completion rates, meaningless to a managed app —+ // and a managed app CAN enable the cosMetrics source, so the cosMetrics toggle+ // alone is not the PortOS boundary. buildPrompt re-checks isPortos as defense in+ // depth; deriving it here only for PortOS also avoids the wasted work.+ if (isPortos) {+ const scopeGuidance = computeScopeAwareness({ metricsByType: summary });+ if (scopeGuidance) out.scopeGuidance = scopeGuidance;+ }}}for (const custom of src.custom || []) {diff --git a/server/services/layeredIntelligence.test.js b/server/services/layeredIntelligence.test.jsindex 42febc19e2..3a92a7963d 100644--- a/server/services/layeredIntelligence.test.js+++ b/server/services/layeredIntelligence.test.js@@ -46,6 +46,7 @@ import {SCOPE_AVOID_SUCCESS_THRESHOLD,SCOPE_PREFER_SUCCESS_THRESHOLD,SCOPE_AWARENESS_MIN_SAMPLE,+ SCOPE_AWARENESS_MAX_PER_LIST,PROPOSAL_OUTCOMES,extractPlanSlugs,appendProposalToPlan,@@ -478,18 +479,18 @@ describe('computeScopeAwareness (#2760)', () => {const out = computeScopeAwareness({ metricsByType: {'self-improve:layered-intelligence': { lifetimeSuccessRate: 0, lifetimeCompleted: 9 }} });- expect(out).toContain('AVOID');- expect(out).toContain('self-improve:layered-intelligence: 0% success over 9 runs');- expect(out).not.toContain('PREFER');+ expect(out).toContain('LOW-COMPLETION');+ expect(out).toContain('self-improve:layered-intelligence: 0% completed over 9 runs');+ expect(out).not.toContain('HIGH-COMPLETION');});it('classifies an at/above-threshold scope with enough runs as PREFER', () => {const out = computeScopeAwareness({ metricsByType: {'plan-task': { lifetimeSuccessRate: 100, lifetimeCompleted: 10 }} });- expect(out).toContain('PREFER');- expect(out).toContain('plan-task: 100% success over 10 runs');- expect(out).not.toContain('AVOID');+ expect(out).toContain('HIGH-COMPLETION');+ expect(out).toContain('plan-task: 100% completed over 10 runs');+ expect(out).not.toContain('LOW-COMPLETION');});it('leaves a mid-band scope (between avoid and prefer) unclassified', () => {@@ -514,9 +515,9 @@ describe('computeScopeAwareness (#2760)', () => {const out = computeScopeAwareness({ metricsByType: {'branch-reconcile': { lifetimeSuccessRate: 10, lifetimeCompleted: 20, recentSuccessRate: 100, recentCompleted: 6 }} });- expect(out).not.toContain('AVOID');- expect(out).toContain('PREFER');- expect(out).toContain('branch-reconcile: 100% success over 6 runs'); // windowed rate AND windowed count+ expect(out).not.toContain('LOW-COMPLETION');+ expect(out).toContain('HIGH-COMPLETION');+ expect(out).toContain('branch-reconcile: 100% completed over 6 runs'); // windowed rate AND windowed count});it('judges on the windowed rate so a REGRESSED scope enters avoid despite a high lifetime rate', () => {@@ -524,9 +525,9 @@ describe('computeScopeAwareness (#2760)', () => {const out = computeScopeAwareness({ metricsByType: {'performance': { lifetimeSuccessRate: 95, lifetimeCompleted: 40, recentSuccessRate: 20, recentCompleted: 8 }} });- expect(out).toContain('AVOID');- expect(out).toContain('performance: 20% success over 8 runs'); // windowed rate AND windowed count- expect(out).not.toContain('PREFER');+ expect(out).toContain('LOW-COMPLETION');+ expect(out).toContain('performance: 20% completed over 8 runs'); // windowed rate AND windowed count+ expect(out).not.toContain('HIGH-COMPLETION');});it('ignores a THIN recent window (below the sample floor) and lets lifetime govern (#2760)', () => {@@ -536,9 +537,9 @@ describe('computeScopeAwareness (#2760)', () => {const out = computeScopeAwareness({ metricsByType: {'plan-task': { lifetimeSuccessRate: 95, lifetimeCompleted: 40, recentSuccessRate: 0, recentCompleted: 1 }} });- expect(out).toContain('PREFER');- expect(out).toContain('plan-task: 95% success over 40 runs'); // lifetime rate AND lifetime count- expect(out).not.toContain('AVOID');+ expect(out).toContain('HIGH-COMPLETION');+ expect(out).toContain('plan-task: 95% completed over 40 runs'); // lifetime rate AND lifetime count+ expect(out).not.toContain('LOW-COMPLETION');});it('falls back to the lifetime rate when the recency window is empty', () => {@@ -546,8 +547,8 @@ describe('computeScopeAwareness (#2760)', () => {const out = computeScopeAwareness({ metricsByType: {'plan-task': { lifetimeSuccessRate: 100, lifetimeCompleted: 10, recentSuccessRate: null, recentCompleted: 0 }} });- expect(out).toContain('PREFER');- expect(out).toContain('plan-task: 100% success over 10 runs');+ expect(out).toContain('HIGH-COMPLETION');+ expect(out).toContain('plan-task: 100% completed over 10 runs');});it('sorts AVOID worst-first and PREFER best-first', () => {@@ -562,7 +563,17 @@ describe('computeScopeAwareness (#2760)', () => {// best prefer (performance 100%) precedes the milder one (test-coverage 80%)expect(out.indexOf('performance')).toBeLessThan(out.indexOf('test-coverage'));// AVOID section precedes PREFER section- expect(out.indexOf('AVOID')).toBeLessThan(out.indexOf('PREFER'));+ expect(out.indexOf('LOW-COMPLETION')).toBeLessThan(out.indexOf('HIGH-COMPLETION'));+ });++ it('truncates a pathologically long task-type name (#2760 codex P2)', () => {+ const longType = 'self-improve:mission-' + 'x'.repeat(200);+ const out = computeScopeAwareness({ metricsByType: {+ [longType]: { lifetimeSuccessRate: 0, lifetimeCompleted: 5 }+ } });+ expect(out).toContain('LOW-COMPLETION');+ expect(out).not.toContain(longType); // full 200-char name never rendered verbatim+ expect(out).toContain('…'); // truncation marker present});it('honors the exported thresholds at their exact boundaries', () => {@@ -570,7 +581,7 @@ describe('computeScopeAwareness (#2760)', () => {const atPrefer = computeScopeAwareness({ metricsByType: {x: { lifetimeSuccessRate: SCOPE_PREFER_SUCCESS_THRESHOLD, lifetimeCompleted: SCOPE_AWARENESS_MIN_SAMPLE }} });- expect(atPrefer).toContain('PREFER');+ expect(atPrefer).toContain('HIGH-COMPLETION');const atAvoidBoundary = computeScopeAwareness({ metricsByType: {x: { lifetimeSuccessRate: SCOPE_AVOID_SUCCESS_THRESHOLD, lifetimeCompleted: SCOPE_AWARENESS_MIN_SAMPLE }} });@@ -587,15 +598,28 @@ describe('buildPrompt', () => {expect(without).not.toContain('liScopeAwareness');const withGuidance = buildPrompt({...base,- sources: { scopeGuidance: 'AVOID — these scopes have historically FAILED:\n- branch-reconcile: 0% success over 4 runs' }+ sources: { scopeGuidance: 'LOW-COMPLETION task types:\n- branch-reconcile: 0% completed over 4 runs' }});expect(withGuidance).toContain('### liScopeAwareness');- expect(withGuidance).toContain('branch-reconcile: 0% success over 4 runs');- expect(withGuidance).toContain('executed as CoS tasks');+ expect(withGuidance).toContain('branch-reconcile: 0% completed over 4 runs');+ expect(withGuidance).toContain('completion rates for THIS install'); // honest framing (codex P1)// rendered under its dedicated heading, never as a generic "### scopeGuidance" dumpexpect(withGuidance).not.toContain('### scopeGuidance');});+ it('suppresses the scope-awareness block on a managed (non-PortOS) app (#2760 codex P2)', () => {+ // Even if a stray scopeGuidance string reaches a managed app's sources, buildPrompt+ // must not render it — the rates are this install's own CoS history, meaningless+ // there. Defense-in-depth alongside gatherSources gating the derivation on isPortos.+ const out = buildPrompt({+ app, isPortos: false,+ config: { allowedScopes: ['app-improvement'], rules: '' },+ sources: { scopeGuidance: 'LOW-COMPLETION task types:\n- plan-task: 0% completed over 9 runs' }+ });+ expect(out).not.toContain('liScopeAwareness');+ expect(out).not.toContain('plan-task: 0% completed over 9 runs');+ });+it('only offers meta/self scopes on PortOS', () => {const nonPortos = buildPrompt({app, isPortos: false,@@ -1974,7 +1998,7 @@ describe('gatherSources cosMetrics windowed rate (issue #2460)', () => {expect(out.cosMetrics).toBeUndefined();});- it('emits scopeGuidance derived from the same per-type rates (#2760)', async () => {+ it('emits scopeGuidance derived from the same per-type rates on PortOS (#2760)', async () => {await writeLearning({byTaskType: {'self-improve:layered-intelligence': { completed: 9, succeeded: 0, failed: 9, successRate: 0, recentOutcomes: [] },@@ -1982,11 +2006,11 @@ describe('gatherSources cosMetrics windowed rate (issue #2460)', () => {'feature-ideas': { completed: 8, succeeded: 5, failed: 3, successRate: 63, recentOutcomes: [] } // mid-band → neither}});- const out = await gatherSources({ repoPath: dir }, { sources: { cosMetrics: true } }, { cosPath: dir });- expect(out.scopeGuidance).toContain('AVOID');- expect(out.scopeGuidance).toContain('self-improve:layered-intelligence: 0% success over 9 runs');- expect(out.scopeGuidance).toContain('PREFER');- expect(out.scopeGuidance).toContain('plan-task: 100% success over 10 runs');+ const out = await gatherSources({ repoPath: dir }, { sources: { cosMetrics: true } }, { cosPath: dir, isPortos: true });+ expect(out.scopeGuidance).toContain('LOW-COMPLETION');+ expect(out.scopeGuidance).toContain('self-improve:layered-intelligence: 0% completed over 9 runs');+ expect(out.scopeGuidance).toContain('HIGH-COMPLETION');+ expect(out.scopeGuidance).toContain('plan-task: 100% completed over 10 runs');expect(out.scopeGuidance).not.toContain('feature-ideas');});@@ -1994,16 +2018,44 @@ describe('gatherSources cosMetrics windowed rate (issue #2460)', () => {await writeLearning({byTaskType: { 'plan-task': { completed: 2, succeeded: 2, failed: 0, successRate: 100, recentOutcomes: [] } }});- const out = await gatherSources({ repoPath: dir }, { sources: { cosMetrics: true } }, { cosPath: dir });+ const out = await gatherSources({ repoPath: dir }, { sources: { cosMetrics: true } }, { cosPath: dir, isPortos: true });expect(out.cosMetrics).toBeDefined(); // raw metrics still surfacedexpect(out.scopeGuidance).toBeUndefined();});+ it('does NOT emit scopeGuidance for a managed app even when it enabled cosMetrics (#2760 codex P2)', async () => {+ // These completion rates are the install's own CoS history — irrelevant to a+ // managed app — so the derivation is gated on isPortos, not just the cosMetrics+ // toggle (which a managed app CAN turn on). cosMetrics itself is still surfaced.+ await writeLearning({+ byTaskType: { 'plan-task': { completed: 10, succeeded: 0, failed: 10, successRate: 0, recentOutcomes: [] } }+ });+ const out = await gatherSources({ repoPath: dir }, { sources: { cosMetrics: true } }, { cosPath: dir, isPortos: false });+ expect(out.cosMetrics).toBeDefined();+ expect(out.scopeGuidance).toBeUndefined();+ });++ it('caps the number of task types per list and notes the overflow (#2760 codex P2)', async () => {+ // Overflow the cap by 3 chronically-failing types (all past the sample floor) → the+ // block must cap at SCOPE_AWARENESS_MAX_PER_LIST and note the remainder, not dump all.+ const overflow = 3;+ const total = SCOPE_AWARENESS_MAX_PER_LIST + overflow;+ const byTaskType = {};+ for (let i = 0; i < total; i++) {+ byTaskType[`self-improve:fail-scope-${i}`] = { completed: 5, succeeded: 0, failed: 5, successRate: 0, recentOutcomes: [] };+ }+ await writeLearning({ byTaskType });+ const out = await gatherSources({ repoPath: dir }, { sources: { cosMetrics: true } }, { cosPath: dir, isPortos: true });+ const listedTypes = (out.scopeGuidance.match(/self-improve:fail-scope-\d+/g) || []).length;+ expect(listedTypes).toBe(SCOPE_AWARENESS_MAX_PER_LIST);+ expect(out.scopeGuidance).toContain(`and ${overflow} more`);+ });+it('does not emit scopeGuidance when cosMetrics is off (#2760)', async () => {await writeLearning({byTaskType: { 'accessibility': { completed: 4, succeeded: 0, failed: 4, successRate: 0, recentOutcomes: [] } }});- const out = await gatherSources({ repoPath: dir }, { sources: { cosMetrics: false } }, { cosPath: dir });+ const out = await gatherSources({ repoPath: dir }, { sources: { cosMetrics: false } }, { cosPath: dir, isPortos: true });expect(out.scopeGuidance).toBeUndefined();});});