Dashboard › opencode › Session 0HnYWt04hkHD
0HnYWt04hkHDZf4YfPerform an independent, read-only correctness review of every file under /home/byk/.local/share/opencode-v2-pilot/supervisor. Inspect exact current source, protocol, units, tests, and docs. Verify Go API semantics against installed dependencies/source where needed. Focus on framing, SCM_RIGHTS handling, fd ownership, cwd inode binding, systemd StartTransientUnit properties and signatures, state races, disconnect/start/stop ordering, structured exit status, orphan cleanup, backpressure, process lifecycle, launcher argv and environment, test realism, and whether the Node plugin can actually integrate with this protocol. Do not edit files, start services, or run privileged operations. You may run unprivileged tests. Cite current file:line evidence and classify each finding PASS/CONCERN/MUST-FIX. End exactly MERGE or DO-NOT-MERGE.
I’ll inventory the exact supervisor tree, then trace the protocol and lifecycle end to end against installed Go and systemd APIs. I will keep the review read-only, run only unprivileged checks, and treat any unproven security or lifecycle invariant as a blocker.
[
{
"content": "Inventory every file under the supervisor directory and identify applicable source, protocol, units, tests, and docs",
"status": "in_progress",
"priority": "high"
},
{
"content": "Trace framing, descriptor transfer, ownership, cwd binding, lifecycle, races, cleanup, and backpressure",
"status": "pending",
"priority": "high"
},
{
"content": "Verify systemd and Go dependency API semantics against installed source and documentation",
"status": "pending",
"priority": "high"
},
{
"content": "Assess Node plugin protocol integration and launcher argv/environment compatibility",
"status": "pending",
"priority": "high"
},
{
"content": "Run unprivileged tests and produce line-cited PASS/CONCERN/MUST-FIX verdict",
"status": "pending",
"priority": "high"
}
]
/home/byk/Code/opencode/packages/codemode/package.json /home/byk/Code/opencode/packages/codemode/.turbo/turbo-typecheck.log /home/byk/Code/opencode/packages/http-recorder/package.json /home/byk/Code/opencode/packages/http-recorder/tsconfig.json /home/byk/Code/opencode/packages/http-recorder/script/verify-package.ts /home/byk/Code/opencode/packages/http-recorder/script/pack.ts /home/byk/Code/opencode/packages/http-recorder/script/build.ts /home/byk/Code/opencode/packages/http-recorder/README.md /home/byk/Code/opencode/packages/http-recorder/LICENSE /home/byk/Code/opencode/packages/storybook/package.json /home/byk/Code/opencode/packages/storybook/sst-env.d.ts /home/byk/Code/opencode/packages/storybook/tsconfig.json /home/byk/Code/opencode/packages/storybook/debug-storybook.log /home/byk/Code/opencode/packages/storybook/.storybook/main.ts /home/byk/Code/opencode/packages/storybook/.storybook/preview.tsx /home/byk/Code/opencode/packages/storybook/.storybook/playground-css-plugin.ts /home/b...
No files found
/home/byk/.local/share/opencode-v2-pilot/supervisor/ROOT-ACCEPTANCE.md /home/byk/.local/share/opencode-v2-pilot/supervisor/bin/opencode-pty-launcher /home/byk/.local/share/opencode-v2-pilot/supervisor/bin/opencode-pty-supervisor /home/byk/.local/share/opencode-v2-pilot/supervisor/PROTOCOL.md /home/byk/.local/share/opencode-v2-pilot/supervisor/opencode-pty.slice /home/byk/.local/share/opencode-v2-pilot/supervisor/opencode-pty-supervisor.service /home/byk/.local/share/opencode-v2-pilot/supervisor/go.sum /home/byk/.local/share/opencode-v2-pilot/supervisor/cmd/supervisor/main.go /home/byk/.local/share/opencode-v2-pilot/supervisor/cmd/launcher/main_test.go /home/byk/.local/share/opencode-v2-pilot/supervisor/cmd/launcher/main.go /home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/auth_test.go /home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/server_test.go /home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/server.go /home/byk/.lo...
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/server.go</path>
<type>file</type>
<content>
1: package supervisor
2:
3: import (
4: "context"
5: "crypto/rand"
6: "encoding/binary"
7: "errors"
8: "fmt"
9: "io"
10: "net"
11: "os"
12: "os/user"
13: "strconv"
14: "sync"
15: "syscall"
16: "time"
17:
18: "opencode-pty-supervisor/internal/protocol"
19:
20: "golang.org/x/sys/unix"
21: )
22:
23: const (
24: socketPath = "/run/opencode-pty/supervisor.sock"
25: maxSessions = 16
26: socketBufferSize = 128 * 1024
27: handshakeTimeout = 5 * time.Second
28: )
29:
30: type Server struct {
31: manager unitManager
32: listener *net.UnixListener
33: sessions chan struct{}
34: connections map[*net.UnixConn]struct{}
35: mutex sync.Mutex
36: wait sync.WaitGroup
37: }
38:
39: func NewServer(manager unitManager) *Server {
40: return &Server{
41: manager: manager,
42: sessions: make(chan struct{}, ...
File not found: /home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/unit.go
/home/byk/.local/share/opencode-v2-pilot/supervisor/cmd/supervisor/main.go /home/byk/.local/share/opencode-v2-pilot/supervisor/cmd/launcher/main_test.go /home/byk/.local/share/opencode-v2-pilot/supervisor/cmd/launcher/main.go /home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/auth_test.go /home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/server_test.go /home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/server.go /home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/auth.go /home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/systemd_test.go /home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/systemd.go /home/byk/.local/share/opencode-v2-pilot/supervisor/internal/protocol/frame_test.go /home/byk/.local/share/opencode-v2-pilot/supervisor/internal/protocol/frame.go
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/auth.go</path>
<type>file</type>
<content>
1: package supervisor
2:
3: import (
4: "context"
5: "errors"
6: "fmt"
7: "net"
8:
9: "golang.org/x/sys/unix"
10: )
11:
12: func authenticate(ctx context.Context, connection *net.UnixConn, manager unitManager) error {
13: credential, pidfd, err := peerIdentity(connection)
14: if err != nil {
15: return err
16: }
17: defer unix.Close(pidfd)
18: mainPID, activeState, controlGroup, err := manager.ClientState(ctx)
19: if err != nil {
20: return fmt.Errorf("query client service: %w", err)
21: }
22: if credential.Pid <= 0 || uint32(credential.Pid) != mainPID {
23: return errors.New("peer is not the current service MainPID")
24: }
25: if activeState != "active" || controlGroup != expectedClientCgroup {
26: return errors.New("client service is not active in the expected cgroup")
27: }
28: if err := unix.PidfdSendSignal(pidfd, 0, nil, 0); err != ...
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/systemd.go</path>
<type>file</type>
<content>
1: package supervisor
2:
3: import (
4: "context"
5: "encoding/base64"
6: "errors"
7: "fmt"
8: "os"
9: "regexp"
10: "time"
11:
12: systemddbus "github.com/coreos/go-systemd/v22/dbus"
13: "github.com/godbus/dbus/v5"
14: )
15:
16: const (
17: clientService = "opencode-v2.service"
18: supervisorService = "opencode-pty-supervisor.service"
19: ptySlice = "opencode-pty.slice"
20: expectedClientCgroup = "/system.slice/opencode-v2.service"
21: launcherPath = "/usr/local/libexec/opencode-pty-launcher"
22: unitPrefix = "opencode-pty-"
23: unitSuffix = ".service"
24: stopTimeout = 15 * time.Second
25: )
26:
27: var unitPattern = regexp.MustCompile(`^opencode-pty-[0-9a-f]{32}\.service$`)
28:
29: type unitResult struct {
30: Result string
31: ExecMainCode int32
32: ExecMainStatus ...
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/internal/protocol/frame.go</path>
<type>file</type>
<content>
1: package protocol
2:
3: import (
4: "encoding/binary"
5: "errors"
6: "fmt"
7: "io"
8: )
9:
10: const (
11: HeaderSize = 12
12: MaxFrameSize = 64 * 1024
13: MaxIOPayloadSize = 32 * 1024
14: Version = 1
15:
16: TypeStart = 1
17: TypeInput = 2
18: TypeOutput = 3
19: TypeExit = 4
20: TypeError = 5
21:
22: MaxArgs = 128
23: MaxArgSize = 4096
24: MaxRuntimeSec = 3600
25: )
26:
27: var (
28: magic = [4]byte{'O', 'P', 'T', 'Y'}
29: ErrInvalidFrame = errors.New("invalid frame")
30: ErrFrameTooLarge = errors.New("frame too large")
31: )
32:
33: type Frame struct {
34: Type byte
35: Payload []byte
36: }
37:
38: type Start struct {
39: Device uint64
40: Inode uint64
41: RuntimeSec uint32
42: Args []string
43: }
44:
45: func ReadFrame(reader io.Reader) (Frame, error) {
46: header := ...
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/auth_test.go</path>
<type>file</type>
<content>
1: package supervisor
2:
3: import (
4: "context"
5: "os"
6: "testing"
7: )
8:
9: type authenticationManager struct {
10: pid uint32
11: activeState string
12: cgroup string
13: }
14:
15: func (manager *authenticationManager) ClientState(context.Context) (uint32, string, string, error) {
16: return manager.pid, manager.activeState, manager.cgroup, nil
17: }
18:
19: func (*authenticationManager) Start(context.Context, string, []string, *os.File, *os.File, uint32) error {
20: return nil
21: }
22:
23: func (*authenticationManager) StopAndWait(context.Context, string) error { return nil }
24: func (*authenticationManager) Wait(context.Context, string) (unitResult, error) {
25: return unitResult{}, nil
26: }
27: func (*authenticationManager) CleanupOrphans(context.Context) error { return nil }
28: func (*authenticationManager) Close() ...
Found 11 matches
/home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/auth_test.go:
Line 12: cgroup string
Line 16: return manager.pid, manager.activeState, manager.cgroup, nil
Line 34: manager := &authenticationManager{pid: uint32(os.Getpid()), activeState: "active", cgroup: expectedClientCgroup}
Line 44: manager := &authenticationManager{pid: uint32(os.Getpid() + 1), activeState: "active", cgroup: expectedClientCgroup}
Line 54: manager := &authenticationManager{pid: uint32(os.Getpid()), activeState: "inactive", cgroup: expectedClientCgroup}
/home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/auth.go:
Line 12: func authenticate(ctx context.Context, connection *net.UnixConn, manager unitManager) error {
Line 26: return errors.New("client service is not active in the expected cgroup")
Line 28: if err := unix.PidfdSendSignal(pidfd, 0, nil, 0); err != nil {
Line 54: pidfd, socketError = ...
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/auth.go</path>
<type>file</type>
<content>
1: package supervisor
2:
3: import (
4: "context"
5: "errors"
6: "fmt"
7: "net"
8:
9: "golang.org/x/sys/unix"
10: )
11:
12: func authenticate(ctx context.Context, connection *net.UnixConn, manager unitManager) error {
13: credential, pidfd, err := peerIdentity(connection)
14: if err != nil {
15: return err
16: }
17: defer unix.Close(pidfd)
18: mainPID, activeState, controlGroup, err := manager.ClientState(ctx)
19: if err != nil {
20: return fmt.Errorf("query client service: %w", err)
21: }
22: if credential.Pid <= 0 || uint32(credential.Pid) != mainPID {
23: return errors.New("peer is not the current service MainPID")
24: }
25: if activeState != "active" || controlGroup != expectedClientCgroup {
26: return errors.New("client service is not active in the expected cgroup")
27: }
28: if err := unix.PidfdSendSignal(pidfd, 0, nil, 0); err != ...
The review target changed while I was reading it: auth.go gained the full authenticate path between two reads. I will review the latest complete tree and hash every source/config file at the end; if anything changes again, no exact-head security verdict is possible and I will report that as a blocker rather than mix revisions.
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/server_test.go</path>
<type>file</type>
<content>
1: package supervisor
2:
3: import (
4: "bytes"
5: "encoding/binary"
6: "net"
7: "os"
8: "syscall"
9: "testing"
10:
11: "opencode-pty-supervisor/internal/protocol"
12:
13: "golang.org/x/sys/unix"
14: )
15:
16: func TestReceiveStartWithDirectoryDescriptor(t *testing.T) {
17: server, client := unixConnectionPair(t)
18: defer server.Close()
19: defer client.Close()
20: cwd, err := os.Open(".")
21: if err != nil {
22: t.Fatal(err)
23: }
24: defer cwd.Close()
25: info, err := cwd.Stat()
26: if err != nil {
27: t.Fatal(err)
28: }
29: stat := info.Sys().(*syscall.Stat_t)
30: payload, err := protocol.EncodeStart(protocol.Start{Device: uint64(stat.Dev), Inode: stat.Ino, Args: []string{"printf", "ok"}})
31: if err != nil {
32: t.Fatal(err)
33: }
34: packet, err := protocol.MarshalFrame(protocol.Frame{Type: protocol.TypeStart, Payload: ...
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/systemd_test.go</path>
<type>file</type>
<content>
1: package supervisor
2:
3: import (
4: "os"
5: "testing"
6:
7: "github.com/godbus/dbus/v5"
8: )
9:
10: func TestUnitNameGrammar(t *testing.T) {
11: valid := "opencode-pty-0123456789abcdef0123456789abcdef.service"
12: if !validUnitName(valid) {
13: t.Fatalf("rejected %q", valid)
14: }
15: for _, invalid := range []string{
16: "opencode-pty-.service",
17: "opencode-pty-0123456789ABCDEF0123456789ABCDEF.service",
18: "opencode-pty-0123456789abcdef0123456789abcdef.scope",
19: "opencode-pty-0123456789abcdef0123456789abcdef.service/../x",
20: } {
21: if validUnitName(invalid) {
22: t.Fatalf("accepted %q", invalid)
23: }
24: }
25: }
26:
27: func TestUnitPropertiesAreFixed(t *testing.T) {
28: stream, err := os.Open("/dev/null")
29: if err != nil {
30: t.Fatal(err)
31: }
32: defer stream.Close()
33: properties := ...
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/internal/protocol/frame_test.go</path>
<type>file</type>
<content>
1: package protocol
2:
3: import (
4: "bytes"
5: "errors"
6: "strings"
7: "testing"
8: )
9:
10: func TestStartRoundTrip(t *testing.T) {
11: want := Start{Device: 12, Inode: 34, RuntimeSec: 60, Args: []string{"printf", "%s", "hello world"}}
12: payload, err := EncodeStart(want)
13: if err != nil {
14: t.Fatal(err)
15: }
16: got, err := DecodeStart(payload)
17: if err != nil {
18: t.Fatal(err)
19: }
20: if got.Device != want.Device || got.Inode != want.Inode || got.RuntimeSec != want.RuntimeSec || strings.Join(got.Args, "\x00") != strings.Join(want.Args, "\x00") {
21: t.Fatalf("got %#v, want %#v", got, want)
22: }
23: }
24:
25: func TestFrameRoundTrip(t *testing.T) {
26: var buffer bytes.Buffer
27: want := Frame{Type: TypeInput, Payload: []byte("hello")}
28: if err := WriteFrame(&buffer, want); err != nil {
29: t.Fatal(err)
30: }
31: ...
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/cmd/launcher/main.go</path>
<type>file</type>
<content>
1: package main
2:
3: import (
4: "encoding/base64"
5: "errors"
6: "fmt"
7: "os"
8: "strings"
9: "syscall"
10: )
11:
12: const (
13: maxArgs = 128
14: maxArgSize = 4096
15: )
16:
17: func main() {
18: if err := run(os.Args[1:]); err != nil {
19: fmt.Fprintln(os.Stderr, err)
20: os.Exit(1)
21: }
22: }
23:
24: func run(encoded []string) error {
25: command, err := decodeCommand(encoded)
26: if err != nil {
27: return err
28: }
29: if err := syscall.Fchdir(2); err != nil {
30: return fmt.Errorf("fchdir approved cwd: %w", err)
31: }
32: if err := syscall.Dup2(1, 2); err != nil {
33: return fmt.Errorf("replace cwd descriptor: %w", err)
34: }
35: os.Clearenv()
36: fixed := map[string]string{
37: "HOME": "/home/byk",
38: "LANG": "C.UTF-8",
39: "LOGNAME": "byk",
40: "PATH": "/usr/local/bin:/usr/bin:/bin",
41: "TERM": ...
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/cmd/launcher/main_test.go</path>
<type>file</type>
<content>
1: package main
2:
3: import (
4: "bytes"
5: "encoding/base64"
6: "fmt"
7: "os"
8: "os/exec"
9: "strings"
10: "testing"
11: )
12:
13: func TestDecodeCommandQuotesEveryArgument(t *testing.T) {
14: encoded := []string{
15: "a" + base64.RawURLEncoding.EncodeToString([]byte("printf")),
16: "a" + base64.RawURLEncoding.EncodeToString([]byte("%s\\n")),
17: "a" + base64.RawURLEncoding.EncodeToString([]byte("a'b; $(id)")),
18: "a",
19: }
20: got, err := decodeCommand(encoded)
21: if err != nil {
22: t.Fatal(err)
23: }
24: want := "'printf' '%s\\n' 'a'\\''b; $(id)' ''"
25: if got != want {
26: t.Fatalf("got %q, want %q", got, want)
27: }
28: }
29:
30: func TestDecodeCommandRejectsInvalidGrammar(t *testing.T) {
31: if _, err := decodeCommand([]string{"bad="}); err == nil {
32: t.Fatal("expected error")
33: }
34: }
35:
36: func ...
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/cmd/launcher/main.go</path>
<type>file</type>
<content>
20: os.Exit(1)
21: }
22: }
23:
24: func run(encoded []string) error {
25: command, err := decodeCommand(encoded)
26: if err != nil {
27: return err
28: }
29: if err := syscall.Fchdir(2); err != nil {
30: return fmt.Errorf("fchdir approved cwd: %w", err)
31: }
32: if err := syscall.Dup2(1, 2); err != nil {
33: return fmt.Errorf("replace cwd descriptor: %w", err)
34: }
35: os.Clearenv()
36: fixed := map[string]string{
37: "HOME": "/home/byk",
38: "LANG": "C.UTF-8",
39: "LOGNAME": "byk",
40: "PATH": "/usr/local/bin:/usr/bin:/bin",
41: "TERM": "xterm-256color",
42: "USER": "byk",
43: }
44: for key, value := range fixed {
45: if err := os.Setenv(key, value); err != nil {
46: return fmt.Errorf("set fixed environment: %w", err)
47: }
48: }
49: return syscall.Exec("/usr/bin/script", []string{"script", "-qefc", command, ...
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/cmd/supervisor/main.go</path>
<type>file</type>
<content>
1: package main
2:
3: import (
4: "context"
5: "fmt"
6: "os"
7: "os/signal"
8: "syscall"
9:
10: "opencode-pty-supervisor/internal/supervisor"
11: )
12:
13: func main() {
14: ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
15: defer cancel()
16: manager, err := supervisor.NewSystemdManager(ctx)
17: if err != nil {
18: fmt.Fprintln(os.Stderr, err)
19: os.Exit(1)
20: }
21: defer manager.Close()
22: if err := supervisor.NewServer(manager).Serve(ctx); err != nil {
23: fmt.Fprintln(os.Stderr, err)
24: os.Exit(1)
25: }
26: }
(End of file - total 26 lines)
</content>
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/opencode-pty-supervisor.service</path> <type>file</type> <content> 1: [Unit] 2: Description=OpenCode PTY supervisor 3: After=dbus.service 4: Requires=dbus.service 5: 6: [Service] 7: Type=exec 8: User=root 9: Group=byk 10: ExecStart=/usr/local/libexec/opencode-pty-supervisor 11: RuntimeDirectory=opencode-pty 12: RuntimeDirectoryMode=0750 13: RuntimeDirectoryPreserve=no 14: NoNewPrivileges=yes 15: UMask=0077 16: KillMode=control-group 17: KillSignal=SIGTERM 18: FinalKillSignal=SIGKILL 19: SendSIGKILL=yes 20: TimeoutStopSec=20s 21: OOMPolicy=kill 22: Delegate=no 23: RestrictAddressFamilies=AF_UNIX 24: PrivateTmp=yes 25: ProtectSystem=strict 26: ProtectKernelTunables=yes 27: ProtectKernelModules=yes 28: ProtectKernelLogs=yes 29: ProtectControlGroups=yes 30: ProtectClock=yes 31: RestrictSUIDSGID=yes 32: LockPersonality=yes 33: MemoryDenyWriteExecute=yes 34: 35: [Install] 36: WantedBy=multi-user.target (End of file - total 36 ...
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/opencode-pty.slice</path> <type>file</type> <content> 1: [Unit] 2: Description=OpenCode isolated PTY sessions 3: Before=slices.target 4: 5: [Slice] 6: CPUAccounting=yes 7: MemoryAccounting=yes 8: TasksAccounting=yes 9: MemoryMax=2G 10: TasksMax=512 (End of file - total 10 lines) </content>
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/PROTOCOL.md</path> <type>file</type> <content> 1: # PTY supervisor protocol 2: 3: The protocol uses one Unix `SOCK_STREAM` connection for one PTY. Every frame has a 12-byte header: 4: 5: - bytes 0–3: `OPTY` 6: - byte 4: version `1` 7: - byte 5: type 8: - bytes 6–7: zero 9: - bytes 8–11: unsigned big-endian payload length, at most 65536 10: 11: The authenticated client sends one start frame (`1`) with exactly one `SCM_RIGHTS` directory descriptor. Its payload contains unsigned big-endian `st_dev` and `st_ino` values, an optional runtime in seconds, an argument count, and length-prefixed argument bytes. The supervisor compares the descriptor's metadata, requires a directory, and never resolves a client path. 12: 13: After admission, the client sends input frames (`2`) of at most 32768 bytes. The supervisor sends output (`3`), exit (`4`), or error (`5`) frames. ...
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/ROOT-ACCEPTANCE.md</path> <type>file</type> <content> 1: # Root-only acceptance 2: 3: Do not start or enable the service until every check below passes. 4: 5: 1. Install both freshly built binaries in a root-controlled path. Never execute the root supervisor or transient launcher from the user-writable source tree. 6: 7: ```sh 8: sudo install -d -o root -g root -m 0755 /usr/local/libexec 9: sudo install -o root -g root -m 0755 bin/opencode-pty-supervisor /usr/local/libexec/opencode-pty-supervisor 10: sudo install -o root -g root -m 0755 bin/opencode-pty-launcher /usr/local/libexec/opencode-pty-launcher 11: ``` 12: 13: 2. Copy the reviewed service and slice files to `/etc/systemd/system`, owned by root and mode `0644`, then run `systemd-analyze verify` on the installed files. Do not enable or start either unit yet. 14: 15: 3. ...
File not found: /home/byk/.local/share/opfinder
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/PROTOCOL.md</path> <type>file</type> <content> 1: # PTY supervisor protocol 2: 3: The protocol uses one Unix `SOCK_STREAM` connection for one PTY. Every frame has a 12-byte header: 4: 5: - bytes 0–3: `OPTY` 6: - byte 4: version `1` 7: - byte 5: type 8: - bytes 6–7: zero 9: - bytes 8–11: unsigned big-endian payload length, at most 65536 10: 11: The authenticated client sends one start frame (`1`) with exactly one `SCM_RIGHTS` directory descriptor. Its payload contains unsigned big-endian `st_dev` and `st_ino` values, an optional runtime in seconds, an argument count, and length-prefixed argument bytes. The supervisor compares the descriptor's metadata, requires a directory, and never resolves a client path. 12: 13: After admission, the client sends input frames (`2`) of at most 32768 bytes. The supervisor sends output (`3`), exit (`4`), or error (`5`) frames. ...
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/go.mod</path> <type>file</type> <content> 1: module opencode-pty-supervisor 2: 3: go 1.22 4: 5: require ( 6: github.com/coreos/go-systemd/v22 v22.5.0 7: github.com/godbus/dbus/v5 v5.1.0 8: golang.org/x/sys v0.20.0 9: ) (End of file - total 9 lines) </content>
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/cmd/supervisor/main.go</path>
<type>file</type>
<content>
1: package main
2:
3: import (
4: "context"
5: "fmt"
6: "os"
7: "os/signal"
8: "syscall"
9:
10: "opencode-pty-supervisor/internal/supervisor"
11: )
12:
13: func main() {
14: ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
15: defer cancel()
16: manager, err := supervisor.NewSystemdManager(ctx)
17: if err != nil {
18: fmt.Fprintln(os.Stderr, err)
19: os.Exit(1)
20: }
21: defer manager.Close()
22: if err := supervisor.NewServer(manager).Serve(ctx); err != nil {
23: fmt.Fprintln(os.Stderr, err)
24: os.Exit(1)
25: }
26: }
(End of file - total 26 lines)
</content>
/home/byk/.config/opencode/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts /home/byk/.config/opencode/node_modules/yaml/dist/compose/util-empty-scalar-position.js /home/byk/.config/opencode/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js /home/byk/.config/opencode/node_modules/effect/src/NonEmptyIterable.ts /home/byk/.config/opencode/node_modules/effect/dist/NonEmptyIterable.d.ts /home/byk/.config/opencode/node_modules/effect/dist/NonEmptyIterable.js.map /home/byk/.config/opencode/node_modules/effect/dist/NonEmptyIterable.d.ts.map /home/byk/.config/opencode/node_modules/effect/dist/NonEmptyIterable.js
/home/byk/.local/share/opencode-v2-pilot/config/opencode/tsconfig.json /home/byk/.local/share/opencode-v2-pilot/config/opencode/test/followup.test.ts /home/byk/.local/share/opencode-v2-pilot/config/opencode/opencode.json /home/byk/.local/share/opencode-v2-pilot/config/opencode/service-v2-pilot.json /home/byk/.local/share/opencode-v2-pilot/config/opencode/package.json /home/byk/.local/share/opencode-v2-pilot/config/opencode/node_modules/detect-libc/package.json /home/byk/.local/share/opencode-v2-pilot/config/opencode/node_modules/detect-libc/index.d.ts /home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts /home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/followup.ts /home/byk/.local/share/opencode-v2-pilot/config/opencode/node_modules/fast-check/package.json /home/byk/.local/share/opencode-v2-pilot/config/opencode/node_modules/node-gyp-build-optional-packages/package.json /home/byk/.local/share/opencode-v2-pilot/config/opencode/node_modules/csstype/index...
<path>/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts</path>
<type>file</type>
<content>
1: import { Plugin } from "@opencode/plugin"
2: import type { Context } from "@opencode/plugin/plugin"
3: import type { ToolContext } from "@opencode/plugin/tool"
4: import { Schema } from "effect"
5: import { spawn } from "node:child_process"
6: import type { ChildProcessWithoutNullStreams } from "node:child_process"
7: import { open, realpath } from "node:fs/promises"
8: import type { FileHandle } from "node:fs/promises"
9: import { constants } from "node:fs"
10:
11: const MAX_BUFFER_SIZE = 1_000_000
12: const MAX_SESSIONS = 25
13: const MAX_SESSIONS_PER_OWNER = 5
14: const DEFAULT_READ_LIMIT = 500
15: const MAX_READ_LIMIT = 2_000
16: const MAX_READ_OFFSET = 10_000
17: const MAX_LINE_LENGTH = 2_000
18: const MAX_PATTERN_LENGTH = 500
19: const MAX_WRITE_SIZE = 65_536
20: const MAX_TIMEOUT_SECONDS = 2_147_483
21: const KILL_GRACE_MS = 1_000
22: const KILL_FORCE_MS = ...
Found 9 matches /home/byk/.local/share/opencode-v2-pilot/supervisor/ROOT-ACCEPTANCE.md: Line 9: sudo install -o root -g root -m 0755 bin/opencode-pty-supervisor /usr/local/libexec/opencode-pty-supervisor /home/byk/.local/share/opencode-v2-pilot/supervisor/PROTOCOL.md: Line 5: - bytes 0–3: `OPTY` Line 11: The authenticated client sends one start frame (`1`) with exactly one `SCM_RIGHTS` directory descriptor. Its payload contains unsigned big-endian `st_dev` and `st_ino` values, an optional runtime in seconds, an argument count, and length-prefixed argument bytes. The supervisor compares the descriptor's metadata, requires a directory, and never resolves a client path. /home/byk/.local/share/opencode-v2-pilot/supervisor/opencode-pty-supervisor.service: Line 10: ExecStart=/usr/local/libexec/opencode-pty-supervisor /home/byk/.local/share/opencode-v2-pilot/supervisor/cmd/supervisor/main.go: Line 10: ...
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/opencode-pty.slice</path> <type>file</type> <content> 1: [Unit] 2: Description=OpenCode isolated PTY sessions 3: Before=slices.target 4: 5: [Slice] 6: CPUAccounting=yes 7: MemoryAccounting=yes 8: TasksAccounting=yes 9: MemoryMax=2G 10: TasksMax=512 (End of file - total 10 lines) </content>
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/server.go</path>
<type>file</type>
<content>
340: }
341: if err := unix.SetsockoptInt(fd, unix.SOL_SOCKET, unix.SO_RCVBUF, socketBufferSize); err != nil {
342: closeFDs(fds[:])
343: return nil, nil, err
344: }
345: }
346: return os.NewFile(uintptr(fds[0]), "supervisor-stream"), os.NewFile(uintptr(fds[1]), "unit-stream"), nil
347: }
348:
349: func randomUnitName() (string, error) {
350: value := make([]byte, 16)
351: if _, err := rand.Read(value); err != nil {
352: return "", err
353: }
354: return fmt.Sprintf("%s%x%s", unitPrefix, value, unitSuffix), nil
355: }
356:
357: func writeError(writer io.Writer, err error) {
358: _ = protocol.WriteFrame(writer, protocol.Frame{Type: protocol.TypeError, Payload: boundedError(err)})
359: }
360:
361: func boundedError(err error) []byte {
362: payload := []byte(err.Error())
363: if len(payload) > protocol.MaxIOPayloadSize {
364: return ...
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/go.mod</path> <type>file</type> <content> 1: module opencode-pty-supervisor 2: 3: go 1.22 4: 5: require ( 6: github.com/coreos/go-systemd/v22 v22.5.0 7: github.com/godbus/dbus/v5 v5.1.0 8: golang.org/x/sys v0.20.0 9: ) (End of file - total 9 lines) </content>
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/cmd/supervisor/main.go</path>
<type>file</type>
<content>
1: package main
2:
3: import (
4: "context"
5: "fmt"
6: "os"
7: "os/signal"
8: "syscall"
9:
10: "opencode-pty-supervisor/internal/supervisor"
11: )
12:
13: func main() {
14: ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
15: defer cancel()
16: manager, err := supervisor.NewSystemdManager(ctx)
17: if err != nil {
18: fmt.Fprintln(os.Stderr, err)
19: os.Exit(1)
20: }
21: defer manager.Close()
22: if err := supervisor.NewServer(manager).Serve(ctx); err != nil {
23: fmt.Fprintln(os.Stderr, err)
24: os.Exit(1)
25: }
26: }
(End of file - total 26 lines)
</content>
Found 3 matches
/home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/server.go:
Line 400: func (server *Server) addConnection(connection *net.UnixConn) {
Line 406: func (server *Server) removeConnection(connection *net.UnixConn) {
Line 412: func (server *Server) closeConnections() {
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/server.go</path>
<type>file</type>
<content>
360:
361: func boundedError(err error) []byte {
362: payload := []byte(err.Error())
363: if len(payload) > protocol.MaxIOPayloadSize {
364: return payload[:protocol.MaxIOPayloadSize]
365: }
366: return payload
367: }
368:
369: func writeAll(writer io.Writer, value []byte) error {
370: for len(value) > 0 {
371: count, err := writer.Write(value)
372: if err != nil {
373: return err
374: }
375: if count == 0 {
376: return io.ErrShortWrite
377: }
378: value = value[count:]
379: }
380: return nil
381: }
382:
383: func closeFDs(fds []int) {
384: for _, fd := range fds {
385: unix.Close(fd)
386: }
387: }
388:
389: type frameWriter struct {
390: writer io.Writer
391: mutex sync.Mutex
392: }
393:
394: func (writer *frameWriter) write(frame protocol.Frame) error {
395: writer.mutex.Lock()
396: defer writer.mutex.Unlock()
397: return ...
/home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/subscription_test.go /home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/subscription_set_test.go /home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/subscription_set.go /home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/subscription.go /home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/set_test.go /home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/set.go /home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/properties.go /home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/methods_test.go /home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/methods.go /home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/dbus_test.go /home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/dbus.go
Found 7 matches
/home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/properties.go:
Line 57: func PropExecStart(command []string, uncleanIsFailure bool) Property {
Line 136: // PropBindsTo sets the BindsTo unit property. See
Line 138: func PropBindsTo(units ...string) Property {
/home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/methods_test.go:
Line 981: PropBindsTo("testing-transient-bindstodep.service"),
/home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/methods.go:
Line 122: func (c *Conn) StopUnitContext(ctx context.Context, name string, mode string, ch chan<- string) (int, error) {
Line 191: func (c *Conn) StartTransientUnitContext(ctx context.Context, name string, mode string, properties []Property, ch chan<- string) (int, error) {
Line 477: func (c *Conn) ListUnitsByPatternsContext(ctx context.Context, states []string, patterns []string) ([]UnitStatus, error) {
<path>/home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/properties.go</path>
<type>file</type>
<content>
45: }
46:
47: type execStart struct {
48: Path string // the binary path to execute
49: Args []string // an array with all arguments to pass to the executed command, starting with argument 0
50: UncleanIsFailure bool // a boolean whether it should be considered a failure if the process exits uncleanly
51: }
52:
53: // PropExecStart sets the ExecStart service property. The first argument is a
54: // slice with the binary path to execute followed by the arguments to pass to
55: // the executed command. See
56: // http://www.freedesktop.org/software/systemd/man/systemd.service.html#ExecStart=
57: func PropExecStart(command []string, uncleanIsFailure bool) Property {
58: execStarts := []execStart{
59: {
60: Path: command[0],
61: Args: command,
62: UncleanIsFailure: uncleanIsFailure,
63: },
64: ...
No files found
d38a26faee1c49d4d135735be194d535bcc827deeb37c7848f2cc202393508aa PROTOCOL.md 5321eca8e3dce8c10e35197731787e7099dadba19679746f2922666772efc053 ROOT-ACCEPTANCE.md d1d088bdd65f99056657717658d3336ae233acd2ad39fa998ebe8a773f68348e go.mod f5decbaa220ec1103eac7315c02788164bd8395adc89f111f2e7391b780170d7 opencode-pty.slice 5aec7e8fa6c0b2d5c2735159ca791836a82ac291e2fbb19525572642b9c10760 opencode-pty-supervisor.service 300651eb44530f43de19de2161a42e992044433309ee5e769cdc28c29526dde6 cmd/launcher/main.go 4cf6f95cf62a80ab9cb021b1cb1b79bf742addbd78ba8d53fd8d5f64605e09e2 cmd/launcher/main_test.go dd78f66426c1394a51cff58cbdd78ba9af1dfed7ea972ce43a97b7939bcb2d93 cmd/supervisor/main.go 14027d7dbfa68e6c8d3bc4768216490b7964d06f809743b9a1496ecd57d219dc internal/protocol/frame.go d6d851dc8354e04814d2720c29f26a650c770ca5c8d0962f8c6374acc84aed89 internal/protocol/frame_test.go 45cb9dda10d0d6a88caf65196ddc8b3b4fac5f788d76767319a184e1cab01b2e ...
<path>/home/byk/.local/share/opencode-v2-pilot/supervisor/go.sum</path> <type>file</type> <content> 1: github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= 2: github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= 3: github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= 4: github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= 5: github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= 6: golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= 7: golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= (End of file - total 7 lines) </content>
Found 27 matches
/home/byk/go/pkg/mod/golang.org/x/sys@v0.20.0/unix/sockcmsg_unix.go:
Line 39: func ParseSocketControlMessage(b []byte) ([]SocketControlMessage, error) {
Line 93: func ParseUnixRights(m *SocketControlMessage) ([]int, error) {
/home/byk/go/pkg/mod/golang.org/x/sys@v0.20.0/unix/syscall_linux.go:
Line 972: return GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL)
Line 1514: sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)
Line 1551: sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)
/home/byk/go/pkg/mod/golang.org/x/sys@v0.20.0/unix/zerrors_linux_ppc.go:
Line 391: SO_PEERPIDFD = 0x4d
/home/byk/go/pkg/mod/golang.org/x/sys@v0.20.0/unix/zerrors_linux_mipsle.go:
Line 336: SO_PEERPIDFD = 0x4d
/home/byk/go/pkg/mod/golang.org/x/sys@v0.20.0/unix/zerrors_linux_mips64le.go:
Line 336: SO_PEERPIDFD = 0x4d
/home/byk/go/pkg/mod/golang.org/x/sys@v0.20.0/unix/zerrors_linux_mips64.go:
...
MCP server "invalid" is not connected
File not found: /home/byk/go/pkg/mod/github notes
The end-to-end trace has exposed three likely blockers: authentication is released before admission, a completed unit can deadlock while output descriptors remain open, and the installed Node plugin contains no supervisor client or descriptor-transfer path. I’m now validating these against the exact dependency APIs, unit semantics, binaries, and unprivileged tests before assigning final classifications.
drwxr-xr-x 6 byk byk 4096 Sep 8 04:47 /tmp/opencode
ok opencode-pty-supervisor/cmd/launcher (cached) ? opencode-pty-supervisor/cmd/supervisor [no test files] ok opencode-pty-supervisor/internal/protocol (cached) ok opencode-pty-supervisor/internal/supervisor (cached)
ok opencode-pty-supervisor/cmd/launcher (cached) ? opencode-pty-supervisor/cmd/supervisor [no test files] ok opencode-pty-supervisor/internal/protocol (cached) ok opencode-pty-supervisor/internal/supervisor (cached)
(no output)
bin/opencode-pty-launcher: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=6RQ2SGk3gMRB14wEJKBx/BaGu9vt8LS5pWElxxNOG/QVBBd8KFMpoFP2E7P7KR/yoMXHpawFoMlTKoHDWWm, with debug_info, not stripped bin/opencode-pty-supervisor: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, Go BuildID=QNSxF-E7mbp_ecMBvxWo/CB3LcygzrBmD-duo2HiN/hPOfoy4MwUTbZ_KFbJsh/UgIoIOfxoJ_nI8w5bwhb, with debug_info, not stripped f97c546f46b6f2b818638c69ced6e461174549207225cd034ecf65da1017c20d bin/opencode-pty-launcher 65f00b20269806f513f5c6a479a7ca051db6a334ca4549121e5b813bbdf75989 bin/opencode-pty-supervisor bin/opencode-pty-launcher: go1.22.2 path opencode-pty-supervisor/cmd/launcher mod opencode-pty-supervisor (devel) build -buildmode=exe build -compiler=gc build -trimpath=true build CGO_ENABLED=1 build GOARCH=amd64 build GOOS=linux build GOAMD64=v1 bin/opencode-pty-supervisor: ...
Found 28 matches /usr/share/dbus-1/interfaces/org.freedesktop.systemd1.Mount.xml: Line 304: <property name="CollectMode" type="s" access="read"> Line 888: <property name="StandardInputFileDescriptorName" type="s" access="read"> Line 897: <property name="StandardOutputFileDescriptorName" type="s" access="read"> Line 903: <property name="StandardErrorFileDescriptorName" type="s" access="read"> /usr/share/dbus-1/interfaces/org.freedesktop.systemd1.Path.xml: Line 304: <property name="CollectMode" type="s" access="read"> /usr/share/dbus-1/interfaces/org.freedesktop.systemd1.Device.xml: Line 304: <property name="CollectMode" type="s" access="read"> /usr/share/dbus-1/interfaces/org.freedesktop.systemd1.Unit.xml: Line 304: <property name="CollectMode" type="s" access="read"> /usr/share/dbus-1/interfaces/org.freedesktop.systemd1.Automount.xml: Line 304: <property name="CollectMode" type="s" ...
Found 3 matches /usr/share/dbus-1/interfaces/org.freedesktop.systemd1.Manager.xml: Line 456: <method name="StopUnit"> Line 547: <method name="StartTransientUnit"> Line 800: <signal name="UnitRemoved">
<path>/usr/share/dbus-1/interfaces/org.freedesktop.systemd1.Manager.xml</path> <type>file</type> <content> 445: <arg type="s" name="name" direction="in"/> 446: <arg type="s" name="mode" direction="in"/> 447: <arg type="t" name="flags" direction="in"/> 448: <arg type="o" name="job" direction="out"/> 449: </method> 450: <method name="StartUnitReplace"> 451: <arg type="s" name="old_unit" direction="in"/> 452: <arg type="s" name="new_unit" direction="in"/> 453: <arg type="s" name="mode" direction="in"/> 454: <arg type="o" name="job" direction="out"/> 455: </method> 456: <method name="StopUnit"> 457: <arg type="s" name="name" direction="in"/> 458: <arg type="s" name="mode" direction="in"/> 459: <arg type="o" name="job" direction="out"/> 460: </method> 461: <method name="ReloadUnit"> 462: <arg type="s" name="name" direction="in"/> 463: <arg type="s" name="mode" direction="in"/> 464: <arg type="o" name="job" direction="out"/> 465: ...
<path>/usr/share/dbus-1/interfaces/org.freedesktop.systemd1.Manager.xml</path> <type>file</type> <content> 785: <method name="LookupDynamicUserByUID"> 786: <arg type="u" name="uid" direction="in"/> 787: <arg type="s" name="name" direction="out"/> 788: </method> 789: <method name="GetDynamicUsers"> 790: <arg type="a(us)" name="users" direction="out"/> 791: </method> 792: <method name="DumpUnitFileDescriptorStore"> 793: <arg type="s" name="name" direction="in"/> 794: <arg type="a(suuutuusu)" name="entries" direction="out"/> 795: </method> 796: <signal name="UnitNew"> 797: <arg type="s" name="id"/> 798: <arg type="o" name="unit"/> 799: </signal> 800: <signal name="UnitRemoved"> 801: <arg type="s" name="id"/> 802: <arg type="o" name="unit"/> 803: </signal> 804: <signal name="JobNew"> 805: <arg type="u" name="id"/> 806: <arg type="o" name="job"/> 807: <arg type="s" name="unit"/> 808: </signal> 809: <signal ...
<path>/home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/methods.go</path> <type>file</type> <content> 90: // and terminate all units that aren't dependencies of it. If 91: // "ignore-dependencies" it will start a unit but ignore all its dependencies. 92: // If "ignore-requirements" it will start a unit but only ignore the 93: // requirement dependencies. It is not recommended to make use of the latter 94: // two options. 95: // 96: // If the provided channel is non-nil, a result string will be sent to it upon 97: // job completion: one of done, canceled, timeout, failed, dependency, skipped. 98: // done indicates successful execution of a job. canceled indicates that a job 99: // has been canceled before it finished execution. timeout indicates that the 100: // job timeout was reached. failed indicates that the job failed. dependency 101: // indicates that a job this job has been depending on failed and the job hence 102: // has been removed too. ...
Found 4 matches
/home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/subscription.go:
Line 60: if signal.Name == "org.freedesktop.systemd1.Manager.JobRemoved" {
Line 71: case "org.freedesktop.systemd1.Manager.JobRemoved":
/home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/methods.go:
Line 54: func (c *Conn) startJob(ctx context.Context, ch chan<- string, job string, args ...interface{}) (int, error) {
/home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/dbus.go:
Line 213: "type='signal', interface='org.freedesktop.systemd1.Manager', member='JobRemoved'")
<path>/home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/methods.go</path>
<type>file</type>
<content>
45: c.jobListener.Lock()
46: out, ok := c.jobListener.jobs[job]
47: if ok {
48: out <- result
49: delete(c.jobListener.jobs, job)
50: }
51: c.jobListener.Unlock()
52: }
53:
54: func (c *Conn) startJob(ctx context.Context, ch chan<- string, job string, args ...interface{}) (int, error) {
55: if ch != nil {
56: c.jobListener.Lock()
57: defer c.jobListener.Unlock()
58: }
59:
60: var p dbus.ObjectPath
61: err := c.sysobj.CallWithContext(ctx, job, 0, args...).Store(&p)
62: if err != nil {
63: return 0, err
64: }
65:
66: if ch != nil {
67: c.jobListener.jobs[p] = ch
68: }
69:
70: // ignore error since 0 is fine if conversion fails
71: jobID, _ := strconv.Atoi(path.Base(string(p)))
72:
73: return jobID, nil
74: }
75:
76: // Deprecated: use StartUnitContext instead. ...
<path>/home/byk/go/pkg/mod/golang.org/x/sys@v0.20.0/unix/sockcmsg_unix.go</path>
<type>file</type>
<content>
1: // Copyright 2011 The Go Authors. All rights reserved.
2: // Use of this source code is governed by a BSD-style
3: // license that can be found in the LICENSE file.
4:
5: //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
6:
7: // Socket control messages
8:
9: package unix
10:
11: import (
12: "unsafe"
13: )
14:
15: // CmsgLen returns the value to store in the Len field of the Cmsghdr
16: // structure, taking into account any necessary alignment.
17: func CmsgLen(datalen int) int {
18: return cmsgAlignOf(SizeofCmsghdr) + datalen
19: }
20:
21: // CmsgSpace returns the number of bytes an ancillary element with
22: // payload of the passed data length occupies.
23: func CmsgSpace(datalen int) int {
24: return cmsgAlignOf(SizeofCmsghdr) + cmsgAlignOf(datalen)
25: }
26:
27: func (h *Cmsghdr) data(offset uintptr) ...
<path>/home/byk/go/pkg/mod/golang.org/x/sys@v0.20.0/unix/syscall_unix.go</path>
<type>file</type>
<content>
252: var rsa RawSockaddrAny
253: var len _Socklen = SizeofSockaddrAny
254: if err = getpeername(fd, &rsa, &len); err != nil {
255: return
256: }
257: return anyToSockaddr(fd, &rsa)
258: }
259:
260: func GetsockoptByte(fd, level, opt int) (value byte, err error) {
261: var n byte
262: vallen := _Socklen(1)
263: err = getsockopt(fd, level, opt, unsafe.Pointer(&n), &vallen)
264: return n, err
265: }
266:
267: func GetsockoptInt(fd, level, opt int) (value int, err error) {
268: var n int32
269: vallen := _Socklen(4)
270: err = getsockopt(fd, level, opt, unsafe.Pointer(&n), &vallen)
271: return int(n), err
272: }
273:
274: func GetsockoptInet4Addr(fd, level, opt int) (value [4]byte, err error) {
275: vallen := _Socklen(4)
276: err = getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen)
277: return value, err
278: }
279:
280: func GetsockoptIPMreq(fd, ...
Found 1 matches
/home/byk/go/pkg/mod/golang.org/x/sys@v0.20.0/unix/zsyscall_linux.go:
Line 2108: func PidfdSendSignal(pidfd int, sig Signal, info *Siginfo, flags int) (err error) {
<path>/home/byk/go/pkg/mod/golang.org/x/sys@v0.20.0/unix/zsyscall_linux.go</path>
<type>file</type>
<content>
2100: if e1 != 0 {
2101: err = errnoErr(e1)
2102: }
2103: return
2104: }
2105:
2106: // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
2107:
2108: func PidfdSendSignal(pidfd int, sig Signal, info *Siginfo, flags int) (err error) {
2109: _, _, e1 := Syscall6(SYS_PIDFD_SEND_SIGNAL, uintptr(pidfd), uintptr(sig), uintptr(unsafe.Pointer(info)), uintptr(flags), 0, 0)
2110: if e1 != 0 {
2111: err = errnoErr(e1)
2112: }
2113: return
2114: }
2115:
2116: // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
2117:
2118: func shmat(id int, addr uintptr, flag int) (ret uintptr, err error) {
2119: r0, _, e1 := Syscall(SYS_SHMAT, uintptr(id), uintptr(addr), uintptr(flag))
(Showing lines 2100-2119 of 2231. Use offset=2120 to continue.)
</content>
systemd 255 (255.4-1ubuntu8.17) +PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +SECCOMP +GCRYPT -GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY +P11KIT +QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD -BPF_FRAMEWORK -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified script from util-linux 2.39.3 go version go1.22.2 linux/amd64 6.8.0-117-generic
opencode-pty-supervisor.service: Command /usr/local/libexec/opencode-pty-supervisor is not executable: No such file or directory
d38a26faee1c49d4d135735be194d535bcc827deeb37c7848f2cc202393508aa PROTOCOL.md 5321eca8e3dce8c10e35197731787e7099dadba19679746f2922666772efc053 ROOT-ACCEPTANCE.md d1d088bdd65f99056657717658d3336ae233acd2ad39fa998ebe8a773f68348e go.mod dad6a6773121326ee41a6a081cf310444b6fcd3540f28f4b3f31de559d31726b go.sum f5decbaa220ec1103eac7315c02788164bd8395adc89f111f2e7391b780170d7 opencode-pty.slice 5aec7e8fa6c0b2d5c2735159ca791836a82ac291e2fbb19525572642b9c10760 opencode-pty-supervisor.service f97c546f46b6f2b818638c69ced6e461174549207225cd034ecf65da1017c20d bin/opencode-pty-launcher 65f00b20269806f513f5c6a479a7ca051db6a334ca4549121e5b813bbdf75989 bin/opencode-pty-supervisor 300651eb44530f43de19de2161a42e992044433309ee5e769cdc28c29526dde6 cmd/launcher/main.go 4cf6f95cf62a80ab9cb021b1cb1b79bf742addbd78ba8d53fd8d5f64605e09e2 cmd/launcher/main_test.go dd78f66426c1394a51cff58cbdd78ba9af1dfed7ea972ce43a97b7939bcb2d93 ...
? opencode-pty-supervisor/cmd/supervisor [no test files] ok opencode-pty-supervisor/cmd/launcher 0.033s ok opencode-pty-supervisor/internal/protocol 0.003s ok opencode-pty-supervisor/internal/supervisor 0.004s ? opencode-pty-supervisor/cmd/supervisor [no test files] ok opencode-pty-supervisor/cmd/launcher 1.070s ok opencode-pty-supervisor/internal/protocol 1.029s ok opencode-pty-supervisor/internal/supervisor 1.017s
[
{
"content": "Inventory every file under the supervisor directory and identify applicable source, protocol, units, tests, and docs",
"status": "completed",
"priority": "high"
},
{
"content": "Trace framing, descriptor transfer, ownership, cwd binding, lifecycle, races, cleanup, and backpressure",
"status": "completed",
"priority": "high"
},
{
"content": "Verify systemd and Go dependency API semantics against installed source and documentation",
"status": "completed",
"priority": "high"
},
{
"content": "Assess Node plugin protocol integration and launcher argv/environment compatibility",
"status": "completed",
"priority": "high"
},
{
"content": "Run unprivileged tests and produce line-cited PASS/CONCERN/MUST-FIX verdict",
"status": "completed",
"priority": "high"
}
]
f97c546f46b6f2b818638c69ced6e461174549207225cd034ecf65da1017c20d bin/opencode-pty-launcher f97c546f46b6f2b818638c69ced6e461174549207225cd034ecf65da1017c20d /tmp/opencode/review-opencode-pty-launcher 65f00b20269806f513f5c6a479a7ca051db6a334ca4549121e5b813bbdf75989 bin/opencode-pty-supervisor 65f00b20269806f513f5c6a479a7ca051db6a334ca4549121e5b813bbdf75989 /tmp/opencode/review-opencode-pty-supervisor
Found 75 matches
/home/byk/go/pkg/mod/github.com/godbus/dbus/v5@v5.1.0/variant_parser.go:
Line 86: default:
Line 219: default:
Line 302: default:
Line 384: default:
Line 513: default:
Line 691: default:
Line 727: default:
Line 805: default:
/home/byk/go/pkg/mod/github.com/godbus/dbus/v5@v5.1.0/variant_lexer.go:
Line 149: default:
/home/byk/go/pkg/mod/github.com/godbus/dbus/v5@v5.1.0/transport_unix.go:
Line 59: default:
Line 99: default:
/home/byk/go/pkg/mod/github.com/godbus/dbus/v5@v5.1.0/transport_tcp.go:
Line 20: default:
/home/byk/go/pkg/mod/github.com/godbus/dbus/v5@v5.1.0/server_interfaces_test.go:
Line 439: select {
/home/byk/go/pkg/mod/github.com/godbus/dbus/v5@v5.1.0/encoder.go:
Line 195: default:
Line 232: default:
/home/byk/go/pkg/mod/github.com/godbus/dbus/v5@v5.1.0/default_handler.go:
Line 321: select {
Line 325: default:
Line 332: select ...
<path>/home/byk/go/pkg/mod/github.com/godbus/dbus/v5@v5.1.0/default_handler.go</path>
<type>file</type>
<content>
285:
286: func (sh *defaultSignalHandler) AddSignal(ch chan<- *Signal) {
287: sh.mu.Lock()
288: defer sh.mu.Unlock()
289: if sh.closed {
290: return
291: }
292: sh.signals = append(sh.signals, &signalChannelData{
293: ch: ch,
294: done: make(chan struct{}),
295: })
296: }
297:
298: func (sh *defaultSignalHandler) RemoveSignal(ch chan<- *Signal) {
299: sh.mu.Lock()
300: defer sh.mu.Unlock()
301: if sh.closed {
302: return
303: }
304: for i := len(sh.signals) - 1; i >= 0; i-- {
305: if ch == sh.signals[i].ch {
306: sh.signals[i].close()
307: copy(sh.signals[i:], sh.signals[i+1:])
308: sh.signals[len(sh.signals)-1] = nil
309: sh.signals = sh.signals[:len(sh.signals)-1]
310: }
311: }
312: }
313:
314: type signalChannelData struct {
315: wg sync.WaitGroup
316: ch chan<- *Signal
317: done chan struct{}
318: }
319:
320: func (scd ...
launcher_cmp=0 supervisor_cmp=0
<path>/home/byk/go/pkg/mod/github.com/godbus/dbus/v5@v5.1.0/default_handler.go</path>
<type>file</type>
<content>
315: wg sync.WaitGroup
316: ch chan<- *Signal
317: done chan struct{}
318: }
319:
320: func (scd *signalChannelData) deliver(signal *Signal) {
321: select {
322: case scd.ch <- signal:
323: case <-scd.done:
324: return
325: default:
326: scd.wg.Add(1)
327: go scd.deferredDeliver(signal)
328: }
329: }
330:
331: func (scd *signalChannelData) deferredDeliver(signal *Signal) {
332: select {
333: case scd.ch <- signal:
334: case <-scd.done:
335: }
336: scd.wg.Done()
337: }
338:
339: func (scd *signalChannelData) close() {
340: close(scd.done)
341: scd.wg.Wait() // wait until all spawned goroutines return
342: }
(End of file - total 342 lines)
</content>
<path>/home/byk/go/pkg/mod/github.com/coreos/go-systemd/v22@v22.5.0/dbus/methods.go</path>
<type>file</type>
<content>
450: // be more unit names loaded than actual units behind them.
451: // Also note that a unit is only loaded if it is active and/or enabled.
452: // Units that are both disabled and inactive will thus not be returned.
453: func (c *Conn) ListUnitsContext(ctx context.Context) ([]UnitStatus, error) {
454: return c.listUnitsInternal(c.sysobj.CallWithContext(ctx, "org.freedesktop.systemd1.Manager.ListUnits", 0).Store)
455: }
456:
457: // Deprecated: use ListUnitsFilteredContext instead.
458: func (c *Conn) ListUnitsFiltered(states []string) ([]UnitStatus, error) {
459: return c.ListUnitsFilteredContext(context.Background(), states)
460: }
461:
462: // ListUnitsFilteredContext returns an array with units filtered by state.
463: // It takes a list of units' statuses to filter.
464: func (c *Conn) ListUnitsFilteredContext(ctx context.Context, states []string) ...
Your previous result was empty. Resume the same read-only correctness review against the unchanged exact source under /home/byk/.local/share/opencode-v2-pilot/supervisor. You must return substantive file:line findings or name the exact tool/error that blocks review. Cover every source, test, unit, protocol, and documentation file; verify relevant pinned go-systemd/godbus API semantics. Classify findings PASS/CONCERN/MUST-FIX. Do not edit files, install/start services, or perform privileged operations. End exactly MERGE or DO-NOT-MERGE.
One further launcher mismatch is now concrete: script -c gives the child a PTY but invokes its shell non-interactively, while this design requires an interactive inner shell. I’m checking the exact host behavior and then will issue the complete immutable-tree verdict.
noninteractive
<path>/home/byk/./.local/share/opencode-v2-pilot/supervisor/internal/supervisor/auth.go</path>
<type>file</type>
<content>
1: package supervisor
2:
3: import (
4: "context"
5: "errors"
6: "fmt"
7: "net"
8:
9: "golang.org/x/sys/unix"
10: )
11:
12: func authenticate(ctx context.Context, connection *net.UnixConn, manager unitManager) error {
13: credential, pidfd, err := peerIdentity(connection)
14: if err != nil {
15: return err
16: }
17: defer unix.Close(pidfd)
18: mainPID, activeState, controlGroup, err := manager.ClientState(ctx)
19: if err != nil {
20: return fmt.Errorf("query client service: %w", err)
21: }
22: if credential.Pid <= 0 || uint32(credential.Pid) != mainPID {
23: return errors.New("peer is not the current service MainPID")
24: }
25: if activeState != "active" || controlGroup != expectedClientCgroup {
26: return errors.New("client service is not active in the expected cgroup")
27: }
28: if err := unix.PidfdSendSignal(pidfd, 0, nil, 0); err != ...
/usr/bin/bash: -c: line 1: syntax error near unexpected token `placeholder' /usr/bin/bash: -c: line 1: `sha256sum(placeholder)'
Findings
MUST-FIX: The Node plugin does not implement this protocol. The supervisor listens on /run/opencode-pty/supervisor.sock at internal/supervisor/server.go:23-28 and requires a framed start request with one SCM_RIGHTS descriptor at internal/supervisor/server.go:219-257. The deployed plugin never opens that socket, constructs OPTY frames, transfers a descriptor, or parses output/exit frames. It still spawns /usr/bin/script directly at /home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts:223-230. Node’s standard net API does not expose Unix sendmsg(2) descriptor transfer, so integration needs a native binding or a narrowly scoped helper. As written, installing the supervisor cannot move plugin PTYs into its units.
MUST-FIX: Authentication does not remain valid until the privileged start side effect. authenticate acquires a pidfd but closes it when the function returns at internal/supervisor/auth.go:12-18. The server then receives an attacker-controlled start request and descriptor before calling Start at internal/supervisor/server.go:100-124. A connection authenticated while the old MainPID is valid can remain open or be inherited after that service identity changes. No pidfd or service-state assertion occurs immediately before StartTransientUnit. Keep the peer identity pinned for the connection and reassert it immediately before admission.
MUST-FIX: Unit completion can deadlock permanently on descendants holding the stream. Wait reports completion when the service reaches SubState=exited at internal/supervisor/systemd.go:101-125. Because the unit uses RemainAfterExit=true at internal/supervisor/systemd.go:254, the main script process can exit while another process in the unit still holds stdout. On unitDone, serveSession blocks synchronously waiting for outputDone at internal/supervisor/server.go:167-176. ...
Date: Sep 8, 2026 * 🔴 [requested-review] (05:15) User requested resumption of the same read-only correctness review against the unchanged exact source under `/home/byk/.local/share/opencode-v2-pilot/supervisor`, requiring substantive file:line findings or the exact blocking tool/error; coverage of every source, test, unit, protocol, and documentation file; verification of pinned `go-systemd`/`go…
* 🔴 (05:03) [completed-task] Supervisor audit task completed: inventory every file under the supervisor directory and identify applicable source, protocol, units, tests, and docs; priority `high`. * 🔴 (05:03) [completed-task] Supervisor audit task completed: trace framing, descriptor transfer, ownership, cwd binding, lifecycle, races, cleanup, and backpressure; priority `high`. * 🔴 (05:03) [co…
* 🟡 (04:52) `/home/byk/.local/share/opencode-v2-pilot/supervisor/opencode-pty.slice` defines `Description=OpenCode isolated PTY sessions`, `Before=slices.target`, and slice accounting/limits `CPUAccounting=yes`, `MemoryAccounting=yes`, `TasksAccounting=yes`, `MemoryMax=2G`, and `TasksMax=512`. * 🟡 (04:52) `/home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/server.go` define…
* 🔴 (04:51) User reiterated that the supervisor compares the supplied directory descriptor’s metadata, requires it to represent a directory, and never resolves a client path. * 🟡 (04:51) `/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts` is a 684-line TypeScript OpenCode plugin with ID `local-pty`; it imports `Plugin`, `Context`, `ToolContext`, Effect `Schema`, Node child…
Date: September 8, 2026 * 🟡 (04:49) `internal/protocol/frame_test.go` contains 5 tests plus 1 fuzz target: `TestStartRoundTrip`, `TestFrameRoundTrip`, `TestRejectsOversizedFrame`, `TestRejectsNULArgument`, `FuzzParsePacket`. * 🟡 (04:49) `TestStartRoundTrip` verifies `EncodeStart`/`DecodeStart` preserve `Start{Device: 12, Inode: 34, RuntimeSec: 60, Args: []string{"printf", "%s", "hello world"}}`…
Date: September 8, 2026 * 🟡 (04:49) `internal/supervisor/systemd_test.go` contains 3 tests: `TestUnitNameGrammar`, `TestUnitPropertiesAreFixed`, and `TestDecodeUnitResult`. * 🟡 (04:49) `TestUnitNameGrammar` accepts `opencode-pty-0123456789abcdef0123456789abcdef.service` and rejects: 1. `opencode-pty-.service` (missing identifier), 2. `opencode-pty-0123456789ABCDEF0123456789ABCDEF.service` (uppe…
* 🟡 (04:47) Review inventory found 19 files under `/home/byk/.local/share/opencode-v2-pilot/supervisor`: `ROOT-ACCEPTANCE.md`, `PROTOCOL.md`, `go.mod`, `go.sum`, `opencode-pty.slice`, `opencode-pty-supervisor.service`, `bin/opencode-pty-launcher`, `bin/opencode-pty-supervisor`, `cmd/supervisor/main.go`, `cmd/launcher/main.go`, `cmd/launcher/main_test.go`, `internal/protocol/frame.go`, `internal/…
Date: Sep 8, 2026 * 🔴 [requested-review] (04:46) User requested an independent, read-only correctness review of every file under `/home/byk/.local/share/opencode-v2-pilot/supervisor`, inspecting the exact current source, protocol, units, tests, and documentation. * 🟡 (04:46) User asked to verify Go API semantics against installed dependencies/source where needed and focus on framing, `SCM_RIGHT…