"Skipping duplicate agent skill name" log spam#303878
Conversation
There was a problem hiding this comment.
Pull request overview
Reduces noisy Window output logging during agent skill discovery by downgrading several skill-validation/discovery warnings to debug, addressing repeated “Skipping duplicate agent skill name” spam reported in multi-root / multi-skill-source setups.
Changes:
- Downgraded skill name/description sanitization warnings (XML tag stripping, truncation) from
warntodebug. - Downgraded skill discovery warnings (missing name fallback, name mismatch, duplicate-name skip) from
warntodebug. - Minor cleanup in the affected logging block (removed an extra blank line).
| private truncateAgentSkillName(name: string, uri: URI): string { | ||
| const MAX_NAME_LENGTH = 64; | ||
| const sanitized = this.sanitizeAgentSkillText(name); | ||
| if (sanitized !== name) { | ||
| this.logger.warn(`[findAgentSkills] Agent skill name contains XML tags, removed: ${uri}`); | ||
| this.logger.debug(`[findAgentSkills] Agent skill name contains XML tags, removed: ${uri}`); | ||
| } | ||
| if (sanitized.length > MAX_NAME_LENGTH) { | ||
| this.logger.warn(`[findAgentSkills] Agent skill name exceeds ${MAX_NAME_LENGTH} characters, truncated: ${uri}`); | ||
| this.logger.debug(`[findAgentSkills] Agent skill name exceeds ${MAX_NAME_LENGTH} characters, truncated: ${uri}`); | ||
| return sanitized.substring(0, MAX_NAME_LENGTH); | ||
| } | ||
| return sanitized; | ||
| } | ||
|
|
||
| private truncateAgentSkillDescription(description: string | undefined, uri: URI): string | undefined { | ||
| if (!description) { | ||
| return undefined; | ||
| } | ||
| const MAX_DESCRIPTION_LENGTH = 1024; | ||
| const sanitized = this.sanitizeAgentSkillText(description); | ||
| if (sanitized !== description) { | ||
| this.logger.warn(`[findAgentSkills] Agent skill description contains XML tags, removed: ${uri}`); | ||
| this.logger.debug(`[findAgentSkills] Agent skill description contains XML tags, removed: ${uri}`); | ||
| } | ||
| if (sanitized.length > MAX_DESCRIPTION_LENGTH) { | ||
| this.logger.warn(`[findAgentSkills] Agent skill description exceeds ${MAX_DESCRIPTION_LENGTH} characters, truncated: ${uri}`); | ||
| this.logger.debug(`[findAgentSkills] Agent skill description exceeds ${MAX_DESCRIPTION_LENGTH} characters, truncated: ${uri}`); | ||
| return sanitized.substring(0, MAX_DESCRIPTION_LENGTH); |
There was a problem hiding this comment.
The log prefix here says [findAgentSkills], but these messages are emitted from truncateAgentSkillName / truncateAgentSkillDescription and can also happen during validateAndSanitizeSkillFile (extension-contributed skills) and computeSkillDiscoveryInfo. Consider updating the prefix to reflect the helper/function emitting the message so logs are easier to trace.
| const sanitizedName = this.truncateAgentSkillName(name, uri); | ||
| if (sanitizedName !== folderName) { | ||
| this.logger.warn(`[computeSkillDiscoveryInfo] Agent skill name "${sanitizedName}" does not match folder name "${folderName}", using folder name: ${uri}`); | ||
|
|
||
| this.logger.debug(`[computeSkillDiscoveryInfo] Agent skill name "${sanitizedName}" does not match folder name "${folderName}", using folder name: ${uri}`); | ||
| } |
There was a problem hiding this comment.
This log message claims the folder name will be used when the sanitized name doesn't match, but the code continues using sanitizedName for duplicate detection and for the loaded entry. Either adjust the message to match the behavior, or actually switch to using the folder name in this branch (consistent with the agentskills folder-name spec and the wording of the message).
See below for a potential fix:
const headerName = parsedFile.header?.name;
let name = headerName;
if (!name) {
this.logger.debug(`[computeSkillDiscoveryInfo] Agent skill file missing name attribute, using folder name "${folderName}": ${uri}`);
name = folderName;
}
const sanitizedName = this.truncateAgentSkillName(name, uri);
const folderSanitizedName = this.truncateAgentSkillName(folderName, uri);
let effectiveName = sanitizedName;
if (headerName && sanitizedName !== folderName) {
this.logger.debug(`[computeSkillDiscoveryInfo] Agent skill name "${sanitizedName}" does not match folder name "${folderName}", using folder name: ${uri}`);
effectiveName = folderSanitizedName;
}
if (seenNames.has(effectiveName)) {
this.logger.debug(`[computeSkillDiscoveryInfo] Skipping duplicate agent skill name: ${effectiveName} at ${uri}`);
files.push({ uri, storage, status: 'skipped', skipReason: 'duplicate-name', name: effectiveName, duplicateOf: nameToUri.get(effectiveName), extensionId, source });
continue;
}
const description = parsedFile.header?.description;
seenNames.add(effectiveName);
nameToUri.set(effectiveName, uri);
const disableModelInvocation = parsedFile.header?.disableModelInvocation === true;
const userInvocable = parsedFile.header?.userInvocable !== false;
files.push({ uri, storage, status: 'loaded', name: effectiveName, description, extensionId, source, disableModelInvocation, userInvocable });
No description provided.