authorgravatar for 43803274+BarryHenryJr@users.noreply.github.comBarry <43803274+BarryHenryJr@users.noreply.github.com> 2026-09-03 21:58:56-10:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-04 03:58:56-04:00
log2152d44de2db30a6bae965b0afd30be080e5c872
treec6da3a270d12c12c52ba835b6a1cc7002ba3497b
parent706231535ceac8618712913dfdc4a058c2ffb0d8
signature Signed by PGP key B5690EEEBB952194

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


1 files changed, 19 insertions(+), 5 deletions(-)

apps/server/src/provider/Drivers/OpenCodeDriver.ts+19-5
......@@ -149,6 +149,14 @@ export const OpenCodeDriver: ProviderDriver<OpenCodeSettings, OpenCodeDriverEnv>
149149 Effect.provideService(OpenCodeServerOwner.OpenCodeServerOwner, serverOwner),
150150 Effect.provideService(OpenCodeRuntime, openCodeRuntime),
151151 );
152 // NOTE: the local branch intentionally uses the shared SDK server
153 // instead of `opencode debug skill` (loadSkillsFromCli). The CLI writes
154 // its full JSON inventory to stdout, but the Bun-compiled binary does
155 // not flush more than one 64KB pipe buffer to a non-TTY stdout, so the
156 // piped output arrives truncated and unparseable — which degrades to an
157 // empty skill list and poisons the workspace snapshot the `$` picker
158 // reads. The SDK `app.skills` endpoint honors the per-request directory
159 // and returns complete results regardless of size.
152160 const loadSkillsForCwd = (cwd: string) =>
153161 effectiveConfig.serverUrl.trim().length > 0
154162 ? Effect.scoped(
......@@ -172,11 +180,17 @@ export const OpenCodeDriver: ProviderDriver<OpenCodeSettings, OpenCodeDriverEnv>
172180 return yield* openCodeRuntime.loadOpenCodeSkills(client);
173181 }),
174182 )
175 : openCodeRuntime.loadSkillsFromCli({
176 binaryPath: effectiveConfig.binaryPath,
177 cwd,
178 environment: processEnv,
179 });
183 : serverOwner.withServer((server) =>
184 openCodeRuntime.loadOpenCodeSkills(
185 openCodeRuntime.createOpenCodeSdkClient({
186 baseUrl: server.url,
187 directory: cwd,
188 ...(server.serverPassword !== undefined
189 ? { serverPassword: server.serverPassword }
190 : {}),
191 }),
192 ),
193 );
180194
181195 const snapshotSettings = makeProviderSnapshotSettingsSource(effectiveConfig, serverSettings);
182196 const snapshot = yield* makeManagedServerProvider<ProviderSnapshotSettings<OpenCodeSettings>>(