mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-21 11:53:34 +00:00
fix(cli): ignore version mismatch on reconnect
This commit is contained in:
parent
5b2d90a441
commit
f406fed924
1 changed files with 6 additions and 3 deletions
|
|
@ -54,12 +54,15 @@ export default Runtime.handler(Commands, (input) =>
|
|||
// retry the same address; for the managed service discovery re-reads the
|
||||
// registration and may start a replacement.
|
||||
const serviceOptions = server === undefined && !input.standalone ? yield* ServiceConfig.options() : undefined
|
||||
const discover = serviceOptions
|
||||
// Only startup enforces the CLI version. A reconnect must accept a server
|
||||
// replaced by another client or the two clients will restart it forever.
|
||||
const reconnectOptions = serviceOptions ? { ...serviceOptions, version: undefined } : undefined
|
||||
const discover = reconnectOptions
|
||||
? () =>
|
||||
Effect.runPromise(
|
||||
Effect.gen(function* () {
|
||||
const found = yield* Service.discover(serviceOptions)
|
||||
return found ?? (yield* Service.start(serviceOptions))
|
||||
const found = yield* Service.discover(reconnectOptions)
|
||||
return found ?? (yield* Service.start(reconnectOptions))
|
||||
}).pipe(Effect.provide(NodeFileSystem.layer)),
|
||||
)
|
||||
: () => Promise.resolve(transport)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue