@@ -819,6 +819,10 @@ export async function getAttachments(
819819 ! options ?. skipSkillDiscovery
820820 ? [
821821 maybe ( 'skill_discovery' , async ( ) => {
822+ if ( suppressNextDiscovery ) {
823+ suppressNextDiscovery = false
824+ return [ ]
825+ }
822826 const result = await skillSearchModules . prefetch . getTurnZeroSkillDiscovery (
823827 input ,
824828 messages ?? [ ] ,
@@ -2638,6 +2642,7 @@ const sentSkillNames = new Map<string, Set<string>>()
26382642export function resetSentSkillNames ( ) : void {
26392643 sentSkillNames . clear ( )
26402644 suppressNext = false
2645+ suppressNextDiscovery = false
26412646}
26422647
26432648/**
@@ -2661,6 +2666,18 @@ export function suppressNextSkillListing(): void {
26612666}
26622667let suppressNext = false
26632668
2669+ /**
2670+ * Suppress the next skill-discovery injection on resume. Same rationale as
2671+ * suppressNextSkillListing: skill_discovery attachments are not persisted to
2672+ * transcript for non-ant users, so the prior process's discovery result is
2673+ * already in the conversation history the model sees. Re-generating it would
2674+ * inject duplicate content and bust the prompt cache prefix.
2675+ */
2676+ export function suppressNextSkillDiscovery ( ) : void {
2677+ suppressNextDiscovery = true
2678+ }
2679+ let suppressNextDiscovery = false
2680+
26642681// When skill-search is enabled and the filtered (bundled + MCP) listing exceeds
26652682// this count, fall back to bundled-only. Protects MCP-heavy users (100+ servers)
26662683// from truncation while keeping the turn-0 guarantee for typical setups.
0 commit comments