Skip to content

Commit a88a8ac

Browse files
mkantenkoclaude
andcommitted
fix(opencode): leave the 1.x helper out of the service fix
OpenCode 1.x has no background service. Closing T3 Code's own 1.x helper after an update is a separate change with no real-binary proof, so it does not belong here. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 464e8fa commit a88a8ac

4 files changed

Lines changed: 2 additions & 32 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export interface ProviderInstance {
4545
) => Effect.Effect<ProviderWorkspaceSnapshot, ProviderDriverError>;
4646
readonly refreshModels?: () => Effect.Effect<void, ProviderDriverError>;
4747
readonly invalidateCaches?: Effect.Effect<void>;
48-
/** Moves long-lived processes onto a newly updated binary before its version is read back. */
48+
/** Moves a long-lived service onto a newly updated binary before its version is read back. */
4949
readonly afterUpdate?: Effect.Effect<void>;
5050
readonly consumeResetCredit?: () => Effect.Effect<
5151
ProviderConsumeResetCreditOutcome,

‎packages/provider-opencode/src/server/OpenCodeServerOwner.test.ts‎

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -85,28 +85,6 @@ it.effect("shares concurrent borrowers and closes after the idle TTL", () =>
8585
}).pipe(Effect.provide(TestClock.layer())),
8686
);
8787

88-
it.effect("closes only an idle server so the next borrower starts the updated binary", () =>
89-
Effect.gen(function* () {
90-
const testRuntime = yield* makeRuntime;
91-
yield* Effect.scoped(
92-
Effect.gen(function* () {
93-
const owner = yield* OpenCodeServerOwner.make({
94-
binaryPath: "opencode",
95-
directory: "/project",
96-
});
97-
yield* owner.withServer(() => owner.closeIfIdle);
98-
expect(yield* Ref.get(testRuntime.closes)).toBe(0);
99-
100-
yield* owner.closeIfIdle;
101-
expect(yield* Ref.get(testRuntime.closes)).toBe(1);
102-
expect(yield* owner.withServer((server) => Effect.succeed(server.url))).toBe(
103-
"http://127.0.0.1:2",
104-
);
105-
}),
106-
).pipe(Effect.provideService(OpenCodeRuntime.OpenCodeRuntime, testRuntime.runtime));
107-
}),
108-
);
109-
11088
it.effect("retries a failed start and closes on owner scope shutdown", () =>
11189
Effect.gen(function* () {
11290
const testRuntime = yield* makeRuntime;

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export class OpenCodeServerOwner extends Context.Service<
2323
readonly withServer: <A, E, R>(
2424
use: (server: OpenCodeRuntime.OpenCodeServerProcess) => Effect.Effect<A, E, R>,
2525
) => Effect.Effect<A, E | OpenCodeRuntime.OpenCodeRuntimeError, R>;
26-
readonly closeIfIdle: Effect.Effect<void>;
2726
}
2827
>()("@t3tools/provider-opencode/server/OpenCodeServerOwner") {}
2928

@@ -176,13 +175,6 @@ export const make = Effect.fn("OpenCodeServerOwner.make")(function* (input: {
176175
),
177176
);
178177
}),
179-
closeIfIdle: mutex.withPermit(
180-
Effect.gen(function* () {
181-
if (state.borrowers > 0) return;
182-
yield* cancelIdleClose();
183-
yield* closeServer();
184-
}),
185-
),
186178
});
187179
});
188180

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ export const OpenCodeDriver: ProviderDriver<
455455
Effect.provideService(FileSystem.FileSystem, fileSystem),
456456
Effect.provideService(Path.Path, pathService),
457457
)
458-
: serverOwner.closeIfIdle;
458+
: Effect.void;
459459

460460
const snapshotSettings = yield* makeProviderSnapshotSettingsSource(effectiveConfig);
461461
const snapshot = yield* makeManagedServerProvider<ProviderSnapshotSettings<OpenCodeSettings>>({

0 commit comments

Comments
 (0)