Fixes #49726.
Problem#
T3 Code isolates each Antigravity profile under <stateDir>/providers/antigravity/<64-char-sha256>/ and previously symlinked <profile>/config/skills -> ~/.gemini/config/skills and <profile>/antigravity-cli/skills -> ~/.gemini/antigravity-cli/skills. Because agy prints each skill's configured (unexpanded) path into its <skills> system prompt block and counts it against its skill-list character budget, repeating the long private profile prefix (~90–150+ chars per skill) causes premature skill eviction.
In a direct reproduction on agy 1.5.16 (Linux, 135 global skills with ~340-char descriptions + 1 antigravity-cli/skills skill + 1 ~/.gemini/config/skills.json skill):
- Before (legacy symlinks): 113 / 135 skills kept (22 evicted), 159-char advertised skill path,
61,279-char <skills> block.
- After (generated
<profile>/config/skills.json): 135 / 135 skills kept (0 evicted), 67-char advertised skill path (92 chars saved per skill), 0 duplicates, 61,272-char <skills> block.
Fix#
- Generate
<profile>/config/skills.json with short absolute ~/.gemini/... paths (apps/server/src/provider/antigravityAuthSupport.ts):
syncAntigravityUserSkillsConfig writes <profile>/config/skills.json referencing existing ~/.gemini/config/skills and ~/.gemini/antigravity-cli/skills via absolute entries (agy does not expand ~/ in skills.json) and an existing ~/.gemini/config/skills.json via inherits, then removes legacy <profile>/config/skills and <profile>/antigravity-cli/skills symlinks/junctions while preserving real profile-local directories and profile-owned custom config/skills.json files.
- Tracks T3-managed state atomically in
<profile>/.t3-skills-config.json (two-phase current/pending), serialized under profileConfigLock.
- Hardens Windows
.t3-rule-copies.json reads/writes (fail-closed on unreadable/symlinked manifests plus backward-compatible two-phase :pending atomic writes) because .t3-rule-copies.json now identifies legacy and fallback Windows config/skills.json copies during migration.
- Avoid double-scanning global roots in T3's skill picker (
apps/server/src/provider/Drivers/AntigravitySkills.ts):
- Memoises completed unfiltered directory and config scans (first-name-wins) so
<profile>/config/skills.json referencing ~/.gemini roots and inheriting ~/.gemini/config/skills.json does not double-charge ScanBudget. Excludes agent-root, child, plugin, filtered, cycle-cut, and MAX_INHERIT_DEPTH-truncated scans.
Disclosures & notes#
- Native Windows
agy runtime unverified: agy 1.5.16 tests ran on Linux; no Windows host was available for a live Windows agy smoke test. On Windows, this fix replaces legacy junctions with generated C:\... absolute paths in config\skills.json. If Windows agy were to mishandle backslash absolute paths in entries/inherits, syncAntigravityUserSkillsConfig would still remove the junctions and global skills would not load with no automatic fallback. In addition, .github/workflows/windows-tests.yml is manual, and the Linux platform: "win32" unit tests do not exercise real NTFS junctions or writeFileStringAtomically's Windows rename-retry branch (which runs under the process-wide profileConfigLock and can delay another profile's launch by ~2 s if a file is locked).
- Name-collision precedence (
agy 1.5.16 5-case matrix):
| Collision | Before (legacy symlinks) | After (generated skills.json) | T3 picker |
|---|
~/.gemini/config/skills vs <ws>/.gemini/skills | ~/.gemini/config/skills | ~/.gemini/config/skills | ~/.gemini/config/skills |
~/.gemini/config/skills vs <ws>/.agents/skills | <ws>/.agents/skills | <ws>/.agents/skills | <ws>/.agents/skills |
~/.gemini/config/skills vs <ws>/.agents/skills.json | <ws>/.agents/skills.json | <ws>/.agents/skills.json | <ws>/.agents/skills.json |
~/.gemini/antigravity-cli/skills vs <ws>/.agents/skills | <ws>/.agents/skills | <ws>/.agents/skills | <ws>/.agents/skills |
~/.gemini/config/skills vs ~/.gemini/config/skills.json | ~/.gemini/config/skills.json | ~/.gemini/config/skills | ~/.gemini/config/skills |
(4 of 5 cases are unchanged; ~/.gemini/config/skills vs ~/.gemini/config/skills.json now favors ~/.gemini/config/skills, matching T3's picker.) | | | |
~/.gemini/antigravity-cli/skills in ACP mode: Previously, agy acp --app-data-dir antigravity-acp did not load <profile>/antigravity-cli/skills; referencing it in entries now loads it consistently with docs/user/providers-antigravity.md and T3's picker.
- Profile-local directories & write-through: Profiles with their own real
<profile>/config/skills directory now also receive global skills via config/skills.json. Removing the directory symlink ends symlink write-through from <profile>/config/skills into ~/.gemini/config/skills (binary string scan of agy 1.5.16 found only agent instructions to write to ~/.gemini/config/skills/<name>/SKILL.md; no built-in write path was tested).
- Downgrade behavior: On downgrade to an older T3 build, the older build leaves the non-empty generated
config/skills.json in place and recreates the legacy skill-directory links (if an older build starts mid-crash with an uncommitted :pending rule copy, it treats that rule file as profile-owned).
- Textually overlapping open PRs: #46752, #45310, #32124 touch the same Antigravity skill-linking functions.
Verification#
- Real
agy 1.5.16 (Linux, isolated temp home/profile/workspace):
- 135-skill budget proof:
113/135 kept (22 evicted, 159-char path) -> 135/135 kept (0 evicted, 67-char path, 92 chars saved/skill, 0 duplicates).
- Default-mode
read_file verification (no --dangerously-skip-permissions): both advertised SKILL.md and sibling references/guide.md read cleanly with permRequestCount: 0 in both before and after layouts.
- 5-case collision precedence matrix above; malformed
~/.gemini/config/skills.json ({) gracefully skipped while entries still load; relative paths in inherited skills.json resolve identically before and after.
- Ephemeral fault-injection proofs verified green before trimming per
docs/internals/15_testing.md: fresh/legacy Windows fallback adoption across state-rename, skills.json-rename, dual-rename, whole-launch manifest read denial, global root stat denial, stale state.current after failed clearState, double-interrupted migration, symlinked .t3-skills-config.json, 10-step MAX_INHERIT_DEPTH inheritance boundary, and cyclic skills.json standalone re-scan (2 reads).
- Local checks:
vp run check:changed upstream/main (format, lint, knip, typecheck, changed tests) and vp test run across antigravityAuthSupport.test.ts (19), AntigravitySkills.test.ts (6), and AntigravityInstallation.test.ts (24) — 49/49 passed.
- Tests kept: core generated-config / POSIX upgrade / Windows sync & upgrade tests, symlinked
profile/config containment & custom Windows symlink preservation, failed-publish fallback/retry recovery, unreadable custom config/skills.json & Windows manifest-rename/:pending recovery, and AntigravitySkills.test.ts single-read deduplication for global roots + inherited relative filtered collections.
Council review#
Scores (average of Claude Fable 5.2, GPT 6.2 Sol and Gemini 4 Neon; 0–10):
| Category | R1 | R2 | R3 | R4 | R5 | R6 | R7 | R8 | R9 | R10 | R11 | R12 | R13 | R14 | R15 |
|---|
| Correctness & Edge Cases | 7.2 | 7.8 | 7.3 | 7.8 | 7.7 | 8.3 | 8.2 | 8.5 | 8.3 | 7.5 | 8.6 | 8.0 | 8.8 | 8.8 | 9.3 |
| Simplicity & Scope | 7.7 | 7.5 | 6.7 | 7.5 | 7.0 | 7.2 | 7.5 | 7.5 | 7.5 | 7.7 | 7.6 | 7.5 | 7.6 | 7.8 | 8.2 |
| Cross-Platform & Upgrade Safety | 7.3 | 7.5 | 7.3 | 7.2 | 7.0 | 7.7 | 8.2 | 7.8 | 7.5 | 6.8 | 8.0 | 7.5 | 8.2 | 8.0 | 8.8 |
| Tests & Verification | 7.0 | 8.2 | 7.7 | 7.7 | 7.7 | 8.5 | 8.5 | 8.3 | 8.5 | 7.3 | 8.7 | 8.2 | 8.4 | 8.7 | 8.8 |
Created with Gemini 4 Neon in T3 Code.
The automated pipeline stopped on this pull request and will not merge it:
the fix is written and reviewed, but proving it needs something no worker has:
It stays open for a person to finish or close.