Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Merge pull request #5633 from dovstern/shared-skills-source-policy-optout

capy-ai[bot]2caa3b984e7b
diff --cc src/core/shared-skills/setup-source-policy.ts
index a26beac5d8,84a49c43a1..af74df35fd
--- a/src/core/shared-skills/setup-source-policy.ts
+++ b/src/core/shared-skills/setup-source-policy.ts
@@@ -12,11 -12,18 +12,21 @@@ export async function sharedSkillSource
if (company?.noWriteback) return { mode: 'preserve_files',
reason: 'source_writeback_required: the approved company-brain ingestion contract is file-preserving (noWriteback:true). Shared-skill setup cannot modify this repository, even if it contains a pack. Use a separately authorized content source; ingestion approval, files and grants remain unchanged.' };
const [source] = await engine.executeRaw<{ config: unknown }>('SELECT config FROM sources WHERE id=$1 AND NOT archived', [sourceId]);
- if (!source) throw new OperationError('source_changed', 'The selected content source is missing or archived.');
+ if (!source) {
+ throw new OperationError('source_changed', 'The selected content source is missing or archived.',
+ `Source ${sourceId} is archived or not registered; choose an active content source (gbrain sources list --json shows them).`);
+ }
const config = parseSourceConfig(source.config);
+ // A source can already decline adoption implicitly by being connector-managed
+ // or an unapproved external repo (below). Some sources have a working
+ // skill-delivery path entirely outside this migration (their own
+ // brain-resident skillpack served over MCP, or an external plugin install)
+ // and need an explicit way to decline too: `inventorySkillpack`'s fixed
+ // file-count/byte-size bound throws on any skillpack that exceeds it, and
+ // after enough consecutive failures the migration wedges permanently for
+ // that source, with no other way to opt out per source.
+ if (config.shared_skills === false) return { mode: 'preserve_files',
+ reason: 'source_shared_skills_disabled: this source opted out of shared-skills catalog adoption (config.shared_skills=false). Its existing skill-delivery path (e.g. list_brain_skillpack/get_skill, or an external plugin install) is unaffected; no files or grants were touched.' };
if (config.kind != null) return { mode: 'preserve_files',
reason: 'source_skill_adoption_required: this connector-managed source is not a shared-skill write target. Preserve its generated/imported files and put approved shared skills in a separate content source.' };
if (config.remote_url != null || config.managed_clone === true) return { mode: 'explicit_pack_required',