Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): load OpenCode workspace skills via SDK to avoid 64KB CLI pipe truncation #9585

MergedBarryHenryJr(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/9585/headmerged by maria-rcks View on GitHub

Showing 1 changed file with 19 additions and 5 deletions.

x
0 of 1 viewed, 1 left
19 additions and 5 deletionsapps/server/src/provider/Drivers/OpenCodeDriver.tsModified
View file
@@ -149,6 +149,14 @@
Effect.provideService(OpenCodeServerOwner.OpenCodeServerOwner, serverOwner),
Effect.provideService(OpenCodeRuntime, openCodeRuntime),
+ // NOTE: the local branch intentionally uses the shared SDK server
+ // instead of `opencode debug skill` (loadSkillsFromCli). The CLI writes
+ // its full JSON inventory to stdout, but the Bun-compiled binary does
+ // not flush more than one 64KB pipe buffer to a non-TTY stdout, so the
+ // piped output arrives truncated and unparseable — which degrades to an
+ // empty skill list and poisons the workspace snapshot the `$` picker
+ // reads. The SDK `app.skills` endpoint honors the per-request directory
+ // and returns complete results regardless of size.
const loadSkillsForCwd = (cwd: string) =>
effectiveConfig.serverUrl.trim().length > 0
? Effect.scoped(
@@ -172,11 +180,17 @@
return yield* openCodeRuntime.loadOpenCodeSkills(client);
}),
- : openCodeRuntime.loadSkillsFromCli({
- binaryPath: effectiveConfig.binaryPath,
- cwd,
- environment: processEnv,
- });
+ : serverOwner.withServer((server) =>
+ openCodeRuntime.loadOpenCodeSkills(
+ openCodeRuntime.createOpenCodeSdkClient({
+ baseUrl: server.url,
+ directory: cwd,