Dashboard › opencode › Distillation
8f1ff389-06b8-4f2d-8361-ccc5a8ddeec4["lore_tm_v1_0_-Yl_0pnyBTY2oI48Xs0xSg7L0ScIV5DfapXUgQk1w","lore_tm_v1_D4xwUSx7tTTm2TZ179FWx-bZXQY7SZtfanyE9WAFWXY","lore_tm_v1_gURfIqsCMYcdsWBnUmIuZ5OLGRR9U6RVHC2qDuNjmNY","lore_tm_v1_U5pwLhIHhr9R9v4W1hTRkE4sfNypjdErf34bfu4CtSw","lore_tm_v1_cJ5SqIVv2ShZzPwOAAts9ZkuV0rpmEtbpTKxQUHDaW0","lore_tm_v1_nQj6grqg_XyJ6Jco3jJmr7OJ7vdTdsytxPeeMCv1hvI","lore_tm_v1_RmSqvtnRt3RE-rFAfLb_04W36Y1nCtFTNBqMdqb3Iio","lore_tm_v1_4LMLYJPIfnAfbkeLCpG8wi5ebW8nVdP7mI-Q-sTRyms"]
Date: Sep 8, 2026
opencode-pty-[0-9a-f]{32}.service./home/byk/.local/share/opencode-v2-pilot/supervisor/PROTOCOL.md (50 lines). It specifies one Unix SOCK_STREAM connection per PTY retained by the Node SEA process; the supervisor authenticates immutable peer credentials against the exact opencode-v2.service MainPID; Node invokes the fixed root-owned helper with the connected socket duplicated to fd 3 and the approved directory to fd 4; the helper sends the start frame plus fd 4 and exits./home/byk/.local/share/opencode-v2-pilot/supervisor/PROTOCOL.md specifies a maximum frame payload of 71,680 bytes, input/output payloads no larger than 32,768 bytes, and plugin splitting of an accepted 65,536-byte write into at most two input frames. Runtime zero selects the supervisorβs 3,600-second default./home/byk/.local/share/opencode-v2-pilot/supervisor/PROTOCOL.md states that the helper sends exactly one type-1 start frame with exactly one SCM_RIGHTS descriptor. The supervisor receives descriptors atomically using MSG_CMSG_CLOEXEC, closes every received descriptor on every error, requires exactly one directory descriptor, and compares its st_dev and st_ino against the frame./home/byk/.local/share/opencode-v2-pilot/supervisor/PROTOCOL.md defines stop semantics: type 7 is an empty request to stop and wait for the complete unit cgroup; type 8 is an empty acknowledgement sent only after bounded cleanup and final-output drain. The supervisor stops the unit before draining final output and sends exit only after output EOF; cleanup failure is sent when possible, logged, and terminates the supervisor so no accepted ambiguous unit remains while it stays active, with each unitβs BindsTo enforcing shutdown cleanup./home/byk/.local/share/opencode-v2-pilot/supervisor/PROTOCOL.md says explicit stop maps to result stopped, CLD_KILLED, and signal 15 as a protocol completion record rather than a claimed systemd ExecMain result. Unknown frame types, malformed lengths, extra descriptors, descriptor truncation, and wrong-direction frames fail closed./home/byk/.local/share/opencode-v2-pilot/supervisor/PROTOCOL.md documents PTY execution: the launcher receives PTY stdin/stdout and the cwd descriptor as stderr, calls fchdir(2), replaces stderr with stdout, accepts only canonical a[A-Za-z0-9_-]* unpadded URL-safe base64 arguments, clears the environment, binds its reviewed executable to fd 3, and invokes /usr/bin/script -q -e -f -c "/bin/sh -i -c 'exec /proc/self/fd/3 --exec'" /dev/null. The inner launcher decodes argv, clears the temporary value, restores the fixed environment, closes fd 3, and directly calls execve with the original argv boundaries./home/byk/.local/share/opencode-v2-pilot/supervisor/PROTOCOL.md characterizes the transport as interactive PTY infrastructure, not a general security sandbox. Pilot commands retain workspace and IPv4/IPv6 access; systemd blocks supplementary privileged groups, capabilities, devices, namespace creation, privileged syscall groups, supervisor/Docker/D-Bus sockets, and cgroup delegation. Same-UID use of ptrace, /proc descriptor access, process control, inheritance, or descriptor delegation against the Node SEA MainPID remains a deployment blocker./home/byk/.local/share/opencode-v2-pilot/opencode-v2.service (35 lines). It requires and starts after opencode-pty-supervisor.service; runs as User=byk in /home/byk; gates startup with ExecCondition=/usr/local/libexec/opencode-pty-verify-readiness; and starts /home/byk/Code/opencode-v2-pilot/packages/cli/dist-v2-pilot-final/cli-node-linux-x64/bin/opencode2-node serve --hostname=0.0.0.0 --port=4096./home/byk/.local/share/opencode-v2-pilot/opencode-v2.service loads /home/byk/.opencode/env and /home/byk/.local/share/opencode-v2-pilot/server.env; sets OPENCODE_CONFIG_DIR=/home/byk/.local/share/opencode-v2-pilot/config/opencode, OPENCODE_DB=/home/byk/.local/share/opencode-v2-pilot/data/opencode/opencode.db, and XDG data/cache/config/state paths under /home/byk/.local/share/opencode-v2-pilot; and uses Restart=always, RestartSec=5, Nice=-5, LimitNOFILE=65535, LimitNPROC=4096, MemoryHigh=12G, and MemoryMax=13G./home/byk/.local/share/opencode-v2-pilot/opencode-v2.service hardening includes NoNewPrivileges=true, ProtectSystem=strict, ProtectHome=read-only, ReadWritePaths=/home/byk, PrivateTmp=yes, and an empty SupplementaryGroups=./home/byk/.local/share/opencode-v2-pilot/supervisor/opencode-pty-supervisor.service (59 lines). It runs /usr/local/libexec/opencode-pty-supervisor as root:byk, requires dbus.service, clears supplementary groups/capabilities, creates /run/opencode-pty with mode 0750, and uses UMask=0077, KillMode=control-group, KillSignal=SIGTERM, FinalKillSignal=SIGKILL, SendSIGKILL=yes, TimeoutStopSec=20s, OOMPolicy=kill, and Delegate=no./home/byk/.local/share/opencode-v2-pilot/supervisor/opencode-pty-supervisor.service isolation includes RestrictAddressFamilies=AF_UNIX, PrivateTmp=yes, PrivateDevices=yes, PrivateMounts=yes, PrivateNetwork=yes, ProtectSystem=strict, ProtectHome=yes, kernel/control-group/clock/hostname protections, ProtectProc=invisible, ProcSubset=pid, RestrictNamespaces=yes, RestrictSUIDSGID=yes, LockPersonality=yes, MemoryDenyWriteExecute=yes, SystemCallArchitectures=native, RestrictRealtime=yes, DevicePolicy=closed, and inaccessible Docker and user D-Bus sockets./home/byk/.local/share/opencode-v2-pilot/supervisor/opencode-pty-supervisor.service uses SystemCallFilter=~@clock @cpu-emulation @debug @module @mount @obsolete @privileged @raw-io @reboot @resources @swap; enables CPU/memory/tasks/I/O accounting; and limits the supervisor to MemoryHigh=192M, MemoryMax=256M, and TasksMax=64./home/byk/.local/share/opencode-v2-pilot/supervisor/opencode-pty.slice (14 lines). The slice enables CPU/memory/tasks/I/O accounting and sets CPUQuota=800%, IOWeight=100, MemoryHigh=1536M, MemoryMax=2G, and TasksMax=512./home/byk/.local/share/opencode-v2-pilot/supervisor/cmd/supervisor/main.go (31 lines). main() creates a context canceled by SIGINT or SIGTERM, calls supervisor.NewSystemdManager(ctx), defers manager.Close(), creates supervisor.NewServer(manager), runs server.Serve(ctx), and prints initialization/serve errors to stderr before exiting with status 1./home/byk/.local/share/opencode-v2-pilot/supervisor/cmd/client/main_test.go β TestNodePassesConnectedSocketWithoutChangingPeerMainPID, TestSendStartTransfersExactlyOneCloexecDirectoryDescriptor, TestDecodeStartEnforcesCommandArgumentAndAggregateLimits; cmd/launcher/main_test.go β TestDecodeArgumentsPreservesEveryArgument, TestDecodeArgumentsRejectsInvalidGrammar, TestScriptArgumentsRequireInteractiveShellAndExitPropagation, TestLauncherExecutesInDescriptorDirectory, TestLauncherPropagatesExitAndSignalStatus, TestLauncherPreservesMetacharactersAndNewlinesWithoutEvaluation; internal/supervisor/auth_test.go β TestAuthenticateCurrentPeerAndRecheck, TestAuthenticateRejectsWrongCredentialsAndIdentity, TestRecheckRejectsChangedInvocation./home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/server_test.go β TestReceiveStartWithDirectoryDescriptor, TestHandleCleansAmbiguousStartFailure, TestReceiveStartRejectsMetadataMismatch, TestReceiveStartClosesEveryExtraDescriptor, TestReceiveStartClosesDescriptorsAfterControlTruncation, TestReceiveStartHandlesFragmentedHeader, TestCopyInputRejectsOutputFrame, TestExitPayloadEncodingIsBounded, TestServeSessionStopsBeforeFinalOutputDrainAndSendsStructuredExit, TestServeSessionDetectsDisconnectWhileInputForwardingBlocks, TestServeSessionSurfacesCleanupFailure, TestServeSessionAcknowledgesStopOnlyAfterCleanup, TestWatchDisconnectHonorsCancellation, TestUnauthenticatedAdmissionHasSeparateBoundedQuotaAndRate, TestOnlyCachedMainPIDReceivesReservedAdmission, TestCopyOutputPreservesDataBeforeEOF, TestTypeScriptTransportUsesHelperAndSplitsWrites, TestTypeScriptTransportBoundsOutputBeforeListener, TestTypeScriptTransportBoundsBackpressuredStopWrite./home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/systemd_test.go β TestUnitNameGrammar, TestWaitForJobResultRejectsClosedNonDoneAndTimeout, TestUnitPropertiesAreFixed, TestDecodeUnitResult, TestClientIdentityUsesRealSystemdInterfaces, TestSystemd255IntrospectionPlacesPropertiesOnExactInterfaces, TestForgedUnitRemovedSignalCannotProveCleanup, TestBoundedSignalHandlerDropsFlood, TestReadinessVerifierBindsExactSourceAndCondition; /home/byk/.local/share/opencode-v2-pilot/supervisor/internal/protocol/frame_test.go β TestStartRoundTrip, TestFrameRoundTrip, TestRejectsOversizedFrame, TestRejectsNULArgument, TestStartLimits./home/byk/.local/share/opencode-v2-pilot/supervisor/internal/supervisor/systemd_test.go (199 lines). TestUnitNameGrammar accepts opencode-pty-0123456789abcdef0123456789abcdef.service and rejects an empty identifier, uppercase hexadecimal, a .scope suffix, and path traversal via .service/../x.TestWaitForJobResultRejectsClosedNonDoneAndTimeout verifies waitForJobResult() rejects a closed channel, rejects result "canceled", and returns context.DeadlineExceeded under a one-millisecond timeout. TestDecodeUnitResult verifies Result="exit-code", ExecMainCode=1, and ExecMainStatus=7.TestUnitPropertiesAreFixed verifies transient units contain fixed identity, kill, isolation, descriptor, accounting, resource, dependency, and runtime properties, including User, Group, SupplementaryGroups, NoNewPrivileges, CapabilityBoundingSet, AmbientCapabilities, UMask, KillMode, KillSignal, FinalKillSignal, SendSIGKILL, TimeoutStopUSec, OOMPolicy, Delegate, Slice, BindsTo, After, all three standard descriptor properties, InaccessiblePaths, PrivateDevices, DevicePolicy, ProtectControlGroups, ProtectProc, ProcSubset, RestrictNamespaces, RestrictAddressFamilies, SystemCallArchitectures, SystemCallFilter, all four accounting fields, CPUQuotaPerSecUSec, MemoryHigh, MemoryMax, TasksMax, and RuntimeMaxUSec. It specifically requires User="byk", Delegate=false, D-Bus signature (bas) for RestrictAddressFamilies and SystemCallFilter, and signature as for SupplementaryGroups.TestClientIdentityUsesRealSystemdInterfaces requires ActiveState, SubState, and 16-byte InvocationID from the Unit interface while taking MainPID and ControlGroup from the Service interface; it rejects ControlGroup supplied through Unit. TestSystemd255IntrospectionPlacesPropertiesOnExactInterfaces checks those exact placements against dbus.service and confirms systemd 255 does not expose ControlGroup through Unit.TestForgedUnitRemovedSignalCannotProveCleanup injects a forged org.freedesktop.systemd1.Manager.UnitRemoved signal from sender :1.999 and verifies cleanup still performs one authoritative stopped-state query. TestBoundedSignalHandlerDropsFlood delivers 10,000 signals into a capacity-1 handler and verifies the queue remains length 1.TestReadinessVerifierBindsExactSourceAndCondition runs /home/byk/.local/share/opencode-v2-pilot/supervisor/review-source-hash, requires a 64-character digest embedded in /home/byk/.local/share/opencode-v2-pilot/supervisor/verify-readiness as ;pty-source:sha256:<digest>', checks /home/byk/.local/share/opencode-v2-pilot/opencode-v2.service contains the exact line ExecCondition=/usr/local/libexec/opencode-pty-verify-readiness, and validates the verifier with /bin/sh -n.