perf(skills): coalesce inventory before run cache locking (#16576)

Share each active company skill-inventory refresh before taking the version-cache lock. Read actor visibility under the lock and keep snapshot publication protected through durable run pinning. Preserve empty-selection behavior and the list API.

Validation: 176 affected cases, full repository typecheck/build, fresh full CI/E2E, security and exact-head Apex 5/5 pass. The local six-reader latency experiment improves from 50.4s to 18.3s; live response latency is a separate acceptance check.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip authored and GitHub committed 2026-10-16 10:39:02 -05:00
1 parent 5fbece9dcc
commit 06689c1b34
8 files changed
+173 -45

No files matched your search

+6
View File
@@ -1506,6 +1506,12 @@ as they are available, so later setup failures still clean up acquired resources
Busy-account deferral returns explicitly before session/workspace preparation.
Public-path tests are in `server/src/__tests__/heartbeat-execution-configuration.test.ts`.
Concurrent skill preparations join the company inventory refresh before taking
the version-cache lock. Each preparation then reads its actor's current skill
visibility under that lock. Snapshot materialization and the durable run version
pins stay in the same locked callback. Only the in-flight inventory work is
shared; completed refreshes and permission results are not cached.
Browser Use skill assignment first checks for an enabled, active Browser Use
connection in the run's company. With none, it skips full tool discovery.
With one, the existing task, tool-policy and credential-grant checks still apply.