fix(plugins): preserve frozen hosted workers on stale library

This commit is contained in:
2026-09-01 22:26:20 +08:00
parent 697c68974d
commit 40e1912f2f
5 changed files with 217 additions and 3 deletions

View File

@@ -273,6 +273,7 @@ describe('CodingCapabilityRegistry', () => {
const resolve = vi.fn(async () => frozenSnapshot);
const effectiveResolver = {
resolve,
resolveForInvocation: resolve,
getSkillSources: vi.fn(async () => []),
getPolicyState: vi.fn(() => hostedPolicy),
getInstalledDefinition: vi.fn(async () => hostedDefinition),
@@ -400,8 +401,10 @@ describe('CodingCapabilityRegistry', () => {
const resolve = vi.fn(async ({ role }: { role: 'parent' | 'child' }) => (
role === 'child' ? { ...disabled, unavailableReasons: [] } : current
));
const resolveForInvocation = vi.fn(async () => current);
const effectiveResolver = {
resolve,
resolveForInvocation,
getSkillSources: vi.fn(async () => [{
id: 'web-search', pluginId: definition.id, packageRoot: 'C:/packages/web-search',
directory: 'C:/packages/web-search/skills/web-search', entryPath: 'SKILL.md',
@@ -461,6 +464,7 @@ describe('CodingCapabilityRegistry', () => {
capability_id: 'web-search.search', operation: 'search',
payload_schema: 'web-search.v1', billing: { status: 'settled', actual_points: '1.00' },
});
expect(resolveForInvocation).toHaveBeenCalledOnce();
current = disabled;
const stale = await capabilityRegistry.invoke({
@@ -497,6 +501,7 @@ describe('CodingCapabilityRegistry', () => {
};
const effectiveResolver = {
resolve: vi.fn(async () => currentSnapshot),
resolveForInvocation: vi.fn(async () => currentSnapshot),
getSkillSources: vi.fn(async () => []),
getPolicyState: vi.fn(() => policy),
} as unknown as EffectivePluginResolver;
@@ -509,7 +514,7 @@ describe('CodingCapabilityRegistry', () => {
});
expect(result.details).toMatchObject({ success: false, code: 'plugin_not_enabled' });
expect(effectiveResolver.resolve).toHaveBeenCalledWith(expect.objectContaining({
expect(effectiveResolver.resolveForInvocation).toHaveBeenCalledWith(expect.objectContaining({
projectId: context.projectId,
projectPath: context.projectPath,
role: 'parent',