fix(antigravity): dispatch $skill mentions and append user-only skill instructions #40504
Closedgek0v(GitHub profile, opens in a new tab)wants to merge 4 commits into
main fromrefs/pull/40504/headopened View on GitHubgek0v(GitHub profile, opens in a new tab) linked this to fix #39324
tanstack-source added labelsbug
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
juliusmarminge added labelstakeover:in-progress
- @@ -237,0 +273,21 @@273+ const rewrittenText = text.replace(274+ new RegExp(SKILL_MENTION_PATTERN.source, "gu"),275+ (match, prefix: string, name: string) => {276+ if (skillsByName.has(name)) {277+ mentionedNames.add(name);278+ return `${prefix}/${name}`;279+ }280+ return match;281+ },282+ );283+284+ if (mentionedNames.size === 0) return Effect.succeed(text);285+286+ const invokedUserOnlySkills = [...mentionedNames]287+ .map((name) => skillsByName.get(name)!)288+ .filter((skill) => skill.userInvocationOnly === true);289+290+ if (invokedUserOnlySkills.length === 0) return Effect.succeed(rewrittenText);291+292+ return Effect.forEach(invokedUserOnlySkills, (skill) =>293+ options.fileSystem.readFileString(skill.path).pipe(
Pushed34c165f
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
juliusmarminge added labelstakeover:needs-julius
juliusmarminge removed labelstakeover:in-progress
- @@ -524,0 +570,21 @@570+ const invocable = new Map(571+ skills572+ .filter((skill) => skill.enabled && skill.userInvocable !== false)573+ .map((skill) => [skill.name, skill]),574+ );575+ const invoked = new Map<string, ServerProviderSkill>();576+ const request = text.slice(historyLength);577+ const rewritten = request.replace(578+ SKILL_MENTION_PATTERN,579+ (match, prefix: string, name: string) => {580+ const skill = invocable.get(name);581+ if (skill === undefined) return match;582+ invoked.set(name, skill);583+ return `${prefix}/${name}`;584+ },585+ );586+ const blocks = yield* Effect.forEach(invoked.values(), (skill) =>587+ fileSystem.readFileString(skill.path).pipe(588+ Effect.map((contents) => contents.replace(FRONTMATTER_PATTERN, "").trim()),589+ Effect.orElseSucceed(() => `Read and follow ${skill.path}.`),590+ Effect.map((body) => `<skill name="${skill.name}">\n${body}\n</skill>`),
github-actions[bot](GitHub profile, opens in a new tab) added labelsneeds-rebase
github-actions[bot](GitHub profile, opens in a new tab) removed labelsneeds-rebase
Sign in to join this conversation.
Walkthrough
Antigravity now parses skill invocation flags and dispatches eligible
$skillmentions before sending the turn. The adapter receivesuserHomefrom the driver and preserves the original text when required paths are unavailable or discovery or dispatch fails.Changes: Antigravity skill dispatch
apps/server/src/provider/Drivers/AntigravitySkills.ts,apps/server/src/provider/Drivers/AntigravitySkills.test.tsapps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts,apps/server/src/provider/Drivers/AntigravityDriver.tsuserHome,profileDirectory, and the turn’s working directory are available. The driver passesuserHome. If prerequisites are missing or discovery or dispatch fails, the adapter returns the original text.Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Sequence Diagram(s)#
Suggested reviewers:
juliusmarminge,lucenx9Merge Risk:
Low · up to
34c16Antigravity now dispatches $skill mentions and appends instructions for invoked skills. Skill bodies are inlined without a size limit, so a very large skill could inflate a turn's prompt. Appended skill blocks also omit the skill's location, so skills that reference bundled scripts by relative path may not find them. Both are bounded, low-impact issues that can be fixed in a follow-up.
Pre-merge checks:
3 · 
1
#39324). It omits the template sections Problem, Change, Scope, and Verification. The Verification section is the main gap: no focused …#39324has two coding requirements. (1) Dispatch $skill mentions instead of sending them as plain text. The reviewed head summary states that AntigravityAdapterV2 rewriteUserText…#39324objectives. AntigravityAdapterV2.ts adds rewriteUserText and the optional userHome option needed for skill discovery and dispatch. AntigravityDriver.ts passes u…Full details: Title check
Explanation
The title names the primary change: dispatching $skill mentions for Antigravity and appending instructions for user-only skills. It matches the summarized code changes in AntigravitySkills.ts and AntigravityAdapterV2.ts. It is long at 82 characters, but it is specific and related to the changeset.
Full details: Linked Issues check
Explanation
Directly linked issue
#39324has two coding requirements. (1) Dispatch $skill mentions instead of sending them as plain text. The reviewed head summary states that AntigravityAdapterV2 rewriteUserText calls dispatchAntigravitySkillMentions in AntigravitySkills.ts. That function rewrites mentions in the post-history text to /name commands for enabled skills not marked userInvocable: false. The adapter applies this when userHome, profileDirectory, and cwd are set. AntigravityDriver.ts passes userHome, so the driver path satisfies the gate. (2) Handle skills with disable-model-invocation: true, which Antigravity omits from the model-facing <skills> catalog. The head file read confirms parseSkillFrontmatter reads disable-model-invocation and user-invocable, sets userInvocationOnly, and sets userInvocable: false. Per the summary, dispatch appends the SKILL.md body for each invoked skill, with a path-based fallback when the read fails. This covers the refinement in the PR objectives: instructions for every invoked skill, and dispatch limited to the user's own words. Unit tests in AntigravitySkills.test.ts cover mention rewriting, instruction injection, numeric dollar amounts, unknown or non-invocable mentions, and history offset. Limits: the body of dispatchAntigravitySkillMentions was truncated in the file read, so the result rests on the summary for that function. No test run results were reported, so test pass status is not established.Full details: Out of Scope Changes check
Explanation
All changed files connect to the
#39324objectives. AntigravityAdapterV2.ts adds rewriteUserText and the optional userHome option needed for skill discovery and dispatch. AntigravityDriver.ts passes userHome to makeAntigravityAdapterV2. AntigravitySkills.ts adds frontmatter flag parsing, the boolean parser, hasAntigravitySkillMention, and dispatchAntigravitySkillMentions. The test files cover these same changes. The earlier HostProcess home fallback removal and the typecheck fix are small supporting changes to the same wiring. The head file read showed no unrelated logic. Hunks beyond the truncated read rest on the summary.Full details: Description check
Explanation
The description has a Summary section and links the issue (Fixes
#39324). It omits the template sections Problem, Change, Scope, and Verification. The Verification section is the main gap: no focused tests or manual checks and observed results are described. The Problem and Change content is only implied by the summary bullets. The author also left the agent/model attribution line unaddressed, which the template asks for when an agent was used.Resolution
Rewrite the description to follow the repository template. Add a Problem section that states the bug: Antigravity sends $skill mentions as literal text, and disable-model-invocation skills are missing from the model catalog. Add a Change section that explains the parsing of the frontmatter flags and the rewriteUserText dispatch. Add a Scope section that links issue
#39324as the bug report. Add a Verification section that lists the specific tests run (AntigravitySkills.test.ts and AntigravityAdapterV2.test.ts), the observed results, and anything not checked. If an agent produced the change, end with the model and harness used.Finishing Touches
Generate unit tests (beta)