Repository navigation
fix(bots): keep a Share dialog's cached skill listing and preview tied to the folders and build that produced them - #47895
Conversation
… from Linked project roots are resolved once, on the skills branch, and the scan reads those exact folders; a root that cannot be resolved makes the listing uncacheable; an older build or pick never stops or replaces a newer listing. Sessionless builds skip the cache key.
…ed folder's listing is never kept A dialog's call order lives apart from its cached listing and is kept while any of its calls run, so an older pick can't stop a read a newer pick joined, however many dialogs open. A linked project folder that goes missing, or is swapped, while it is scanned makes that listing one never kept. The candidate store checks, where replacement runs in turn, that an older build never replaces the bot's newer preview.
…s keeps it out of the cache The linked projects' folders are checked again once the whole listing is done, shape checks included, so a folder that went missing while a skill's shape was checked never leaves that skill out of a reused listing.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Follow-up to #47154 (STA-16989).
ELI5
A bot's Share dialog keeps the skill list it read so ticking stays fast. That kept list could end up holding the wrong skills: one read from a different folder than it was filed under, a list taken while a linked project's folder was briefly missing or swapped, or a slow, older request overwriting a newer one. This makes sure a kept list always matches the folders it was read from and the newest request.
What Changed
Why
With the old code, a pick could reuse a listing read from a different folder than the one it was filed under:
And a slow older pick could abort the read a newer pick was waiting on, or replace the newer preview so it then expired. Resolving once and checking identity around the whole read is the smallest change that keeps the cache key and the content in step. No comparable: mechanical.
Linked Issue
STA-16989 (internal).
Visual Proof
N/A: no visible UI change. It only affects which cached skill listing and preview main keeps.
Testing
Invariant tests only. Each one fails when the fix it covers is reverted.
bot-share-skill-reads.test.ts:[]or the other project's skills.bot-share-service.test.ts:Local: the two test files pass (17 tests), oxfmt and oxlint are clean on the changed files, and
pnpm tc:nodepasses. macOS only. The on-disk symlink tests are skipped on Windows.Performance
BOT_MAX_SKILL_PROJECTS), in parallel and only on the skills branch. A warm pick adds about one lookup's latency and still does zero walks. Cold and sessionless builds do one lookup per project instead of two.lstatcalls and 1realpathper linked project, also in parallel. Warm picks don't pay this.Risk
Level: Low. Main process only, in the Share dialog's skill listing and preview. The riskiest part is the new "prepare again" path for older requests: if ordering misfired, a current pick would show the "prepare again" error and the user would retry. A plain revert restores the previous behavior.
Review
Agent skill upstream boundary
Checklist
N/Awith reason for visual proof