Dashboard › opencode › Distillation
eb3c4e24-7646-4d40-8ab1-1ae465cda0e6["lore_tm_v1_GqlcWsXCiGdSCZkgicmvnLMCv1q30usYqmq8gPsbQwM","lore_tm_v1_-nsoYJ3Qg7IohCXT-h4j8I82FZ3SskrcnyEn9BKeve0","lore_tm_v1_fcOhk_a0c_XGNri5asjg_gmZ-rXCPiMq1HU962I1gk8","lore_tm_v1_R0SUSULVpkW50YPA6GrtgVubvheAqFoyr7PMovk3k74","lore_tm_v1_mUtCbf6Ag6HPy0qU5M8u2Y5rY2WfLN4cJu_q6POL5FE","lore_tm_v1_w-zwfTPuKkxJcUvP0BKfk-p7HMrgF32kHvJW7ZZisH0"]
Date: Sep 8, 2026
/tmp/opencode/pty-plugin-smoke.ts is a 339-line smoke harness importing createPtyPlugin from /home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts and assertSupervisorAvailable, SupervisorExit, and SupervisorTransport from /home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty-transport.ts; it injects a mock supervisor transport rather than invoking the real supervisor./tmp/opencode/pty-plugin-smoke.ts simulates /bin/printf, /bin/true, interactive /bin/sh input/output, runtime timeout, and close behavior. It returns unit names shaped as opencode-pty-${crypto.randomUUID().replaceAll("-", "")}.service; normal completion uses { result: "success", execMainCode: 1, execMainStatus: 0 }, timeout uses { result: "timeout", execMainCode: 2, execMainStatus: 15 }, and close uses { result: "stopped", execMainCode: 2, execMainStatus: 15 }./tmp/opencode/pty-plugin-smoke.ts first verifies fail-closed activation by calling assertSupervisorAvailable({ helperPath: "/tmp/opencode/does-not-exist", socketPath: "/tmp/opencode/does-not-exist.sock" }) and requiring an ENOENT failure.pty_spawn, 2. pty_write, 3. pty_read, 4. pty_list, 5. pty_kill; it separately requires pty_spawn, pty_write, and pty_kill to declare "shell" permission."x".repeat(4_097); 2. 129 arguments; 3. 5 arguments of 16_000 bytes each, exceeding the aggregate argv bound; 4. one argument of 16_385 bytes. Accepted failures must mention "limit" or "argv"."shell" denial to reject pty_spawn, and explicit "external_directory" denial to reject a symlink escape from /tmp/opencode/pty-project/outside to /tmp; both must fail with text containing PTY command denied./bin/sh with ["-c", "read value; printf 'got:%s\\n' \"$value\""], description "interactive input smoke test", and notifyOnExit: true; it writes "hello\\n", requires the shell permission resource to include <stdin>, requires notification exitCode to equal 0, and searches PTY output with pattern "got:hello"."session-smoke" and foreign Session "other-session"; foreign pty_write, pty_read, and pty_kill must each return PTY session not found, while foreign pty_list must return the exact JSON array []./tmp/opencode/pty-plugin-smoke.ts require canonical source { type: "tool", messageID: "message-smoke", id: "call-smoke" } and prohibit passing command resources through save; after all operations, every recorded "shell" permission call is checked against those requirements./bin/sh with ["-c", "read value"], description "timeout smoke test", notifyOnExit: true, and timeoutSeconds: 1; its synthetic exit notification must contain timedOut: true.pty_kill({ id, cleanup: true }), including a "forced cleanup escalation test" running /bin/sh -c "trap '' TERM; while :; do sleep 1; done"; the spawn must return both a PTY ID and unitName before cleanup."session-smoke", emitting { type: "session.deleted", data: { sessionID: "session-smoke" } }, and requiring the deleted PTY ID to disappear from pty_list."session-paging" by running /bin/printf with "one\\ntwo\\n" and notifyOnExit: true; an unfiltered pty_read must report exactly 2 line records and totalLines === 2, proving the trailing newline does not create a phantom line."session-bytes" by attempting to write "π".repeat(20_000) to a waiting shell; the write must fail with text containing UTF-8 byte limit, after which the PTY is removed with pty_kill({ cleanup: true })."session-inflight" by pausing pty_spawn at the shell-permission gate, emitting session.deleted, then releasing permission; the in-flight spawn must fail with Session has been deleted, and every later spawn for that owner must fail with the same message."session-reservations" by pausing 5 simultaneous pty_spawn calls at permission authorization and attempting a sixth; the sixth must fail with PTY session limit reached, after which the first 5 are released, awaited, and each removed using pty_kill({ cleanup: true })./tmp/opencode/pty-plugin-smoke.ts prints JSON with tools equal to the five expected tool names and all of these flags set to true: permissions, ownership, interactive, notification, timeout, supervisorStop, failClosedActivation, sessionDeletion, inflightDeletion, atomicReservations, argvBounds, utf8Bytes, linePaging, and cleanup./home/byk/go/pkg/mod/github.com/godbus/dbus/v5@v5.1.0/conn.go showed (*Conn).Signal(ch chan<- *Signal) requires the configured signal handler to implement SignalRegistrar, panics otherwise, and registers through handler.AddSignal(ch); RemoveSignal likewise requires SignalRegistrar and invokes handler.RemoveSignal(ch).godbus/dbus/v5@v5.1.0 Conn.Signal documentation states multiple signal channels may be registered, the connection closes those channels when Conn closes, callers must not close them before RemoveSignal, and an active eavesdrop channel receives all signals instead of channels registered through Signal./home/byk/go/pkg/mod/github.com/godbus/dbus/v5@v5.1.0/default_handler.go defines defaultSignalHandler with sync.RWMutex, a closed flag, and []*signalChannelData; DeliverSignal holds a read lock and delivers to every registered channel unless closed, while Terminate holds the write lock, closes and waits on each channel record, closes each caller channel, marks the handler closed, and clears the slice.defaultSignalHandler.AddSignal appends a signalChannelData with the callerβs channel and a fresh done channel unless the handler is closed. RemoveSignal searches backward, calls close() on each matching record, shifts the slice, nils the former final slot, and shortens the slice.signalChannelData.deliver() first attempts a nonblocking direct send; if removal has begun it returns via done, and if the destination channel is blocked it increments a sync.WaitGroup and starts deferredDeliver() in a goroutine. deferredDeliver() blocks until either the signal is sent or done closes, then calls wg.Done(); close() closes done and waits for all spawned delivery goroutines, preventing removal while deferred sends remain active.