Skip to content

Commit c4e2392

Browse files
committed
fix(server): report OpenCode and Pi command discovery as complete
1 parent a7b61dc commit c4e2392

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

‎apps/server/src/provider/ProviderRegistry.test.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,7 +1995,21 @@ it.layer(
19951995
yield* registry.refreshWorkspaceSnapshot({ instanceId, cwd: "/workspace" });
19961996
assert.deepStrictEqual((yield* workspaceOf)?.skills, []);
19971997

1998+
// A driver that discovers its own commands reports them even while
1999+
// health is in error.
2000+
const discoveredCommand = { name: "review", description: "Review changes" };
2001+
yield* Ref.set(scanResult, {
2002+
...unhealthyProvider,
2003+
slashCommands: [discoveredCommand],
2004+
slashCommandsPending: false,
2005+
});
2006+
yield* registry.refreshWorkspaceSnapshot({ instanceId, cwd: "/workspace" });
2007+
const discovered = yield* workspaceOf;
2008+
assert.deepStrictEqual(discovered?.slashCommands, [discoveredCommand]);
2009+
assert.strictEqual(discovered?.slashCommandsPending, undefined);
2010+
19982011
// Once health recovers, the next scan restores the full entry.
2012+
yield* TestClock.adjust(PROVIDER_WORKSPACE_SNAPSHOT_TTL_MS);
19992013
yield* Ref.set(scanResult, { ...healthyProvider, skills: laterSkills });
20002014
yield* registry.refreshWorkspaceSnapshot({ instanceId, cwd: "/workspace" });
20012015
const recovered = yield* workspaceOf;

‎packages/provider-opencode/src/server/driver.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ export const OpenCodeDriver: ProviderDriver<OpenCodeSettings, OpenCodeDriverEnv>
511511
...machineSnapshot,
512512
skills: openCode2SkillsToServerProviderSkills(skills),
513513
slashCommands: openCode2CommandsToServerProviderSlashCommands(commands),
514+
slashCommandsPending: false,
514515
})),
515516
),
516517
v1: Effect.all([
@@ -521,6 +522,7 @@ export const OpenCodeDriver: ProviderDriver<OpenCodeSettings, OpenCodeDriverEnv>
521522
...machineSnapshot,
522523
skills: openCodeSkillsToServerProviderSkills(skills),
523524
slashCommands: openCodeCommandsToServerProviderSlashCommands(commands),
525+
slashCommandsPending: false,
524526
})),
525527
Effect.mapError(
526528
(cause) =>

‎packages/provider-pi/src/server/driver.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,11 @@ export const PiDriver: ProviderDriver<PiSettings, PiDriverEnv> = {
201201
),
202202
),
203203
]).pipe(
204-
Effect.map(([machineSnapshot, commands]) => ({ ...machineSnapshot, ...commands })),
204+
Effect.map(([machineSnapshot, commands]) => ({
205+
...machineSnapshot,
206+
...commands,
207+
slashCommandsPending: false,
208+
})),
205209
),
206210
orchestrationAdapter,
207211
textGeneration,

0 commit comments

Comments
 (0)