Dashboard › opencode › Distillation
b3707aa8-0189-424e-b1fd-488201209729["lore_tm_v1_dhBdAzQMpYVCjhNA3NMToMZuKUbpjWhqmFqbKc9QBuU"]
Date: Sep 8, 2026
internal/supervisor/server.go defines socketBufferSize = 128 * 1024, tracks active Unix connections in connections map[*net.UnixConn]struct{} protected by mutex sync.Mutex, performs startup orphan cleanup via server.manager.CleanupOrphans(), closes tracked connections during shutdown, and uses a server.sessions semaphore whose slot is released with <-server.sessions.internal/supervisor/server.go session admission sets a handshake deadline with connection.SetDeadline(time.Now().Add(handshakeTimeout)), reports failures using writeError(connection, err), and starts an admitted transient unit with server.manager.Start(ctx, unitName, start.Args, unitStream, cwd, start.RuntimeSec).internal/supervisor/server.go handles PTY input/output and unit completion concurrently, serializes outbound frames through a mutex-protected frameWriter, emits protocol.TypeError with boundedError(err) on errors, and validates input as a nonempty protocol.TypeInput payload no larger than protocol.MaxIOPayloadSize.internal/supervisor/server.go reads an initial packet beginning with a protocol.HeaderSize buffer, rejects oversized start frames with protocol.ErrFrameTooLarge, closes received descriptors through closeFDs(fds) on failure paths, calls cwd.Stat(), and rejects a supplied cwd descriptor when its metadata differs from the start payload with exact error cwd descriptor metadata mismatch.internal/supervisor/server.go includes copyOutput(stream *os.File, writer *frameWriter) error, boundedError(err error) []byte, synchronized frameWriter.write(...), listener creation/cleanup helpers, and shutdown logic that closes server.listener.