GeezerVison is showing github.com — fix(core): pin @opencode/pty 0.6.0 and use protocol 9 by jlongster · Pull Request #64251 · anomalyco/opencode
fix(core): pin @opencode/pty 0.6.0 and use protocol 9
#64251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement . We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Uh oh!
There was an error while loading. Please reload this page.
Show file tree
Hide file tree
Changes from all commits
Commits
File filter
Filter by extension
.json
(3)
.lock
(1)
.ts
(6)
All 3 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Hide whitespace
Diff view
Hide whitespace
There are no files selected for viewing
24 changes: 12 additions & 12 deletions
24
bun.lock
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Original file line number
Diff line number
Diff line change
Expand Up
@@ -32,7 +32,7 @@
"@effect/platform-node": "catalog:",
"@opencode/client": "workspace:*",
"@opencode/plugin": "workspace:*",
"@opencode/pty": "0.5.2 ",
"@opencode/pty": "0.6.0 ",
"@opencode/schema": "workspace:*",
"@opencode/server": "workspace:*",
"@opencode/tui": "workspace:*",
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -110,7 +110,7 @@
"@modelcontextprotocol/client": "2.4.0",
"@modelcontextprotocol/core": "2.4.0",
"@modelcontextprotocol/server": "2.4.0",
"@opencode/pty": "0.5.2 ",
"@opencode/pty": "0.6.0 ",
"@opencode/ai": "workspace:*",
"@opencode/codemode": "workspace:*",
"@opencode/plugin": "workspace:*",
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -5,7 +5,7 @@ import path from "node:path"
import { Cause, Data, Duration, Effect, Schema, Semaphore } from "effect"
import type { Handoff } from "@opencode/schema/persistent-pty"
const ProtocolVersion = 8
const ProtocolVersion = 9
const MaxFrameBytes = 8 * 1024 * 1024
const Lifecycle = Schema.Union([
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -327,8 +327,7 @@ const daemonLayer = Layer.effect(
if (run.stopping) yield* Fiber.interrupt(run.stopping)
// Stop waiting first, so forgetting the process is not mistaken for losing it.
if (run.wait) yield* Fiber.interrupt(run.wait)
// Forget the process before deleting its file. This also kills what is left of its group, even after a
// successful exit, which a spawned command would leave running: the daemon cannot forget a process otherwise.
// Terminate a running command or just forget a finished one before deleting its file.
yield* pty.terminatePipe(run.process).pipe(Effect.ignore)
yield* Effect.promise(() => unlink(run.info.file).catch(() => {}))
yield* Deferred.fail(run.done, new NotFoundError({ id }))
Expand Down
Expand Up
@@ -431,13 +430,6 @@ const daemonLayer = Layer.effect(
),
),
),
// Like spawned commands: what a failed command left running in its group is stopped with it, while a
// successful one may leave background processes (`cmd &`) behind.
Effect.tap((outcome) =>
outcome.status === "exited" && outcome.exit !== undefined && outcome.exit !== 0
? pty.signalPipe(run.process, "SIGTERM").pipe(Effect.ignore)
: Effect.void,
),
Effect.flatMap((outcome) => finish(run, outcome)),
),
)
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -5,7 +5,7 @@ import os from "node:os"
import path from "node:path"
import { Effect } from "effect"
export const pong = { type: "pong", instance_id: "test", pid: process.pid, protocol: 8 , features: [] }
export const pong = { type: "pong", instance_id: "test", pid: process.pid, protocol: 9 , features: [] }
export function temporaryDirectory() {
return Effect.acquireRelease(
Expand Down
Expand Up
@@ -105,7 +105,7 @@ export function frame(value: object) {
export function writeRegistration(directory: string, socket: string, instance = "test", token = "test") {
return writeFile(
path.join(directory, "service.json"),
JSON.stringify({ instance_id: instance, pid: process.pid, protocol: 8 , socket, token, features: [] }),
JSON.stringify({ instance_id: instance, pid: process.pid, protocol: 9 , socket, token, features: [] }),
)
}
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -235,7 +235,7 @@ it.live("rejects incompatible daemons without replacing or killing them", () =>
const optional = yield* Effect.flip(daemon.requestIfRunning({ op: "list" }))
expect(optional).toMatchObject({
kind: "protocol",
message: "opencode-pty protocol mismatch: daemon=7, client=8 ",
message: "opencode-pty protocol mismatch: daemon=7, client=9 ",
pid: existing.pid,
})
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -250,7 +250,7 @@ describe("Shell on the process daemon", () => {
}),
)
it.live("stops what a failed command left in its group, and leaves a successful one's ", () =>
it.live("records successful and failed exits without signalling a finished command ", () =>
Effect.gen(function* () {
const env = yield* daemonShells()
yield* env.withShell(env.directory, (shell) =>
Expand All
@@ -262,7 +262,7 @@ describe("Shell on the process daemon", () => {
env.daemon.exit(2, 3)
expect(yield* shell.wait(failed.id)).toMatchObject({ status: "exited", exit: 3 })
expect(yield* shell.wait(succeeded.id)).toMatchObject({ status: "exited", exit: 0 })
expect(env.signals(2)).toEqual(["SIGTERM" ])
expect(env.signals(2)).toEqual([])
expect(env.signals(1)).toEqual([])
}),
)
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -232,18 +232,6 @@ const call = (input: typeof ShellTool.Input.Type, id = "call-shell") => ({
const isWindows = process.platform === "win32"
// The process daemon keeps a finished command's zombie until the command is forgotten.
const running = (pid: number) => {
try {
process.kill(pid, 0)
} catch {
return false
}
return !Bun.spawnSync(["ps", "-o", "stat=", "-p", String(pid)])
.stdout.toString()
.trim()
.startsWith("Z")
}
const cwdCommand = isWindows ? "(Get-Location).Path; Start-Sleep -Milliseconds 100" : "pwd"
const helloCommand = isWindows ? "[Console]::Out.Write('hello'); Start-Sleep -Milliseconds 100" : "printf hello"
const stderrCommand = isWindows
Expand Down
Expand Up
@@ -2044,7 +2032,7 @@ describe("ShellTool", () => {
})
const pid = info.pid
if (pid === undefined) throw new Error("Expected shell PID")
expect(running( pid)).toBe(false )
expect(() => process.kill( pid, 0 )).toThrow(expect.objectContaining({ code: "ESRCH" }) )
}),
(info) =>
Effect.try(() => {
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -37,7 +37,7 @@
"effect": "catalog:"
},
"devDependencies": {
"@opencode/pty": "0.5.2 ",
"@opencode/pty": "0.6.0 ",
"@opencode/client": "workspace:*",
"@opencode/plugin": "workspace:*",
"@tsconfig/bun": "catalog:",
Expand Down
Loading
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.