Fix skills routes to skip user secret resolution

Skip user_secret_ref bindings when resolving adapter config for agent skill listing and sync paths, while keeping normal runtime resolution strict. Add route and service regression tests for required user-secret refs in adapter config.
This commit is contained in:
Nicky Leach authored and GitHub committed 2026-07-09 15:09:58 -07:00
1 parent 8b6a06ee25
commit 4856558fd9
4 files changed
+183 -1

No files matched your search

+11 -1
View File
@@ -406,6 +406,11 @@ type SecretResolutionOptions = {
allowUserSecretScope?: boolean;
};
type ResolveAdapterConfigForRuntimeOptions = {
adapterType?: string | null;
skipUserSecrets?: boolean;
};
export type RuntimeSecretManifestEntry = {
configPath: string;
envKey: string | null;
@@ -4064,7 +4069,7 @@ export function secretService(db: Db) {
companyId: string,
adapterConfig: Record<string, unknown>,
context?: Omit<SecretConsumerContext, "configPath">,
opts?: { adapterType?: string | null },
opts?: ResolveAdapterConfigForRuntimeOptions,
): Promise<{ config: Record<string, unknown>; secretKeys: Set<string>; manifest: RuntimeSecretManifestEntry[] }> => {
const resolved = { ...adapterConfig };
const secretKeys = new Set<string>();
@@ -4102,6 +4107,7 @@ export function secretService(db: Db) {
manifest.push(secretResolution.manifestEntry);
secretKeys.add(key);
} else {
if (opts?.skipUserSecrets) continue;
const secretResolution = await secretService(db).resolveUserSecretValue(
companyId,
{
@@ -4135,6 +4141,10 @@ export function secretService(db: Db) {
const binding = canonicalizeBinding(parsed.data as EnvBinding);
if (binding.type === "plain") continue;
if (binding.type === "user_secret_ref") {
if (opts?.skipUserSecrets) {
delete resolved[key];
continue;
}
const secretResolution = await secretService(db).resolveUserSecretValue(
companyId,
{