← Back to Pull requests

Make `podman exec --no-session` not use Conmon #30411

Open
mheon opened this pull request with 1459 lines diff across 24 files
View on GitHub
mheon mheon commented on Dec 01, 2026 19:22 UTC
Author

This was a goal for --no-session from the beginning. This is meant for tasks that aren't meant to be visible via typical podman exec APIs (e.g. healthchecks or high-throughput HPC applications) where we don't need the features or complexity that Conmon brings to the table. Running quickly, with as few resources as possible, is the most critical portion.

Losing this, we lose the ability to attach to or detach from a running session - which we didn't really want or need anyway for sessionless exec. We lose the ability to capture exit codes if Podman itself exits - again, not something we really wanted. In exchange, we remove the overhead of an extra fork-exec and an extra running monitor process we have no use for.

On top of this, stop taking locks in the happy path. The only thing we needed it for was syncContainer() potentially detecting a container that had exited before we started and not had its cleanup process fire yet. Just updating state from the DB to check if the container is running doesn't require that, and the only thing we lose is a less clear error message from the OCI runtime instead of from Podman when we go to start the session. In case of an error like that, we still run a syncContainer() to pick up the state change that occurred. This approach avoids any modification to the Container struct, and should be proof against concurrency issues as such.

Switch healthchecks over to the new codepath, because they don't really need anything Conmon offers (and having them not take locks is potentially a pretty big net win in high-throughput environments with lots of containers with healthchecks running at the same time - commands like podman ps a lot less likely to get hung grabbing locks).

Total performance increase is in the vicinity of 500% (sequential podman exec commands) to 650% (concurrently starting 100 podman exec) on my system, per testing with included scripts.

<!-- Thanks for sending a pull request! -->

Does this PR introduce a user-facing change?

<!--
Write None if there are no user-facing changes, otherwise enter your release note below.
Include "action required" if users need to take action when upgrading.
-->

``release-note
The
podman exec --no-session command no longer uses Conmon, and instead directly invokes the OCI runtime. Performance on starting large quantities of exec sessions has risen by approximately 500%.
``

Diff: 1459 lines (+1317 / -142) across 24 files Reviewer: giuseppe Review duration: 3880m
All Vouch review confidence checks passed
Residual risk 0.06 = Change Risk (0.72) × (1 − Review Confidence (0.92)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.72 · 1459 lines diff across 24 files
0.72
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.92 · 5 substantive comment(s)
0.92
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
91%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.400
Mass File Touch mass_file_touch
0.080
Real PR Conversation Timeline
19 items
mheon mheon commented on Dec 01, 2026 19:26 UTC
Author

@giuseppe Mind taking a look at the OCI runtime bits?

giuseppe giuseppe commented on code on Dec 02, 2026 07:58 UTC
Code Review
libpod/oci_conmon_exec_nosession.go:1
@@ -0,0 +1,401 @@
+//go:build !remote && (linux || freebsd)
+
+package libpod
+
+import (
+	"bytes"
+	"context"
+	"errors"
+	"fmt"
+	"io"
+	"net"
+	"os"
+	"os/exec"
+	"path/filepath"
+	"slices"
+	"strconv"
+
+	"github.com/sirupsen/logrus"
+	"go.podman.io/common/pkg/resize"
+	"go.podman.io/podman/v6/libpod/define"
+	"go.podman.io/podman/v6/pkg/errorhandling"
+	"go.podman.io/podman/v6/pkg/pidhandle"
+	"golang.org/x/sys/unix"
+	"golang.org/x/term"
+)
+
+// ExecContainerNoSession executes a command in a running container by invoking
+// the OCI runtime directly, without conmon. It blocks until the command exits.
+//
+// Non-TTY execs hand the attach streams to the runtime process: *os.File
+// streams are inherited without copying, other streams are copied by os/exec.
+// An attached STDIN must read from os.Stdin, and is piped if it is a terminal
+// (see wireNoSessionStdio).
+// TTY execs receive the PTY master from the runtime over a console socket and
+// service it here (byte copy and resizes).
+//
+// Runtime launch failures are read from the runtime's JSON log (when
+// supported) rather than from STDERR, so output of the exec'd process can never
+// be mistaken for one.
+func (r *ConmonOCIRuntime) ExecContainerNoSession(ctx context.Context, ctr *Container, sessionID string, options *ExecOptions, streams *define.AttachStreams, resizeChan <-chan resize.TerminalSize) (int, error) {
+	processFile, err := ctr.prepareProcessExec(options, sessionID)
+	if err != nil {
+		return define.ExecErrorCodeGeneric, err
+	}
+	defer processFile.Close()
+
+	preserveFDs, filesToClose, extraFiles, err := getPreserveFdExtraFiles(options.PreserveFD, options.PreserveFDs)
+	if err != nil {
+		return define.ExecErrorCodeGeneric, err
+	}
+	defer func() {
+		for _, f := range filesToClose {
+			errorhandling.CloseQuiet(f)
+		}
+	}()
+
+	env, err := r.configureConmonEnv()
+	if err != nil {
+		return define.ExecErrorCodeGeneric, fmt.Errorf("configuring OCI runtime env: %w", err)
+	}
+
+	ociLog := ctr.execOCILog(sessionID)
+
+	args := slices.Clone(r.runtimeFlags)
+	if ociLog != "" {
+		args = append(args, "--log-format=json", "--log", ociLog)
+	}
+	args = append(args, "exec", "--process", processFile.Name(), "--pid-file", ctr.execPidPath(sessionID))
+
+	var consoleListener *net.UnixListener
+	if options.Terminal {
+		sockPath := noSessionConsoleSocketPath(r.tmpDir, sessionID)
+		consoleListener, err = net.ListenUnix("unix", &net.UnixAddr{Name: sockPath, Net: "unix"})
+		if err != nil {
+			return define.ExecErrorCodeGeneric, fmt.Errorf("creating no-session exec console socket: %w", err)
+		}
+		// Closing a listener created by ListenUnix also removes the socket file.
+		defer consoleListener.Close()
+		args = append(args, "--console-socket", sockPath)

please also specify --detach as it would break with runc:

bin/podman exec --no-session=true -t -l echo hi
exec failed: cannot use console socket if runc will not detach or allocate tty
Error: OCI runtime error: runc: exec failed: cannot use console socket if runc will not detach or allocate tty

giuseppe giuseppe commented on code on Dec 02, 2026 08:42 UTC
Code Review
libpod/container_exec.go:1
@@ -1202,98 +1221,74 @@ func justWriteExecExitCode(c *Container, sessionID string, exitCode int, emitEve
 	return c.save()
 }
 
-// execLightweight executes a command in a container without creating a persistent exec session.
-// It is used by both ExecNoSession and healthCheckExec to avoid code duplication.
-func (c *Container) execLightweight(config *ExecConfig, streams *define.AttachStreams, timeout time.Duration) (int, error) {
+// ExecNoSession executes a command in a container by directly invoking the OCI
+// runtime, bypassing conmon entirely (see OCIRuntime.ExecContainerNoSession).
+// It does not create a persistent exec session and does not write anything to
+// the database. In the common case it does not take the container lock at all:
+// the lock is only taken if the exec fails, to record an exit that happened
+// underneath it. A long-running no-session exec therefore never blocks
+// unrelated operations such as `podman stop`.
+//
+// Raw-mode setup of the caller's terminal is done by the caller (see
+// terminal.ExecNoSessionCtr); resizeChan, when non-nil, forwards live resizes
+// to a TTY exec. Because there is no attach session, detaching is impossible:
+// --detach and --detach-keys are rejected by the CLI.
+//
+// Cancelling ctx kills the exec'd process (see execNoSession); callers that
+// want a long-running exec to follow their request lifecycle must pass a
+// cancellable ctx rather than context.Background().
+func (c *Container) ExecNoSession(ctx context.Context, config *ExecConfig, streams *define.AttachStreams, resizeChan <-chan resize.TerminalSize) (int, error) {
+	return c.execNoSession(ctx, config, streams, resizeChan)
+}
+
+// execNoSession implements ExecNoSession and healthCheckExec. Cancelling ctx
+// kills the exec'd process and returns ctx.Err().
+func (c *Container) execNoSession(ctx context.Context, config *ExecConfig, streams *define.AttachStreams, resizeChan <-chan resize.TerminalSize) (exitCode int, retErr error) {
 	if err := c.verifyExecConfig(config); err != nil {
 		return -1, err
 	}
 
-	unlock := true
+	// Check the container is running without taking the lock. UpdateContainer
+	// also populates c.state from the backing store, which prepareProcessExec
+	// (user/mount resolution) and the exec bundle path (bundlePath) require.
 	if !c.batched {
-		c.lock.Lock()
-		defer func() {
-			if unlock {
-				c.lock.Unlock()
-			}
-		}()
-
-		if err := c.syncContainer(); err != nil {
+		if err := c.runtime.state.UpdateContainer(c); err != nil {
 			return -1, err
 		}
 	}
-
 	if !c.ensureState(define.ContainerStateRunning) {
-		return -1, fmt.Errorf("can only create exec sessions on running containers: %w", define.ErrCtrStateInvalid)
-	}
-
-	session, err := c.createExecSession(config)
-	if err != nil {
-		return -1, err
-	}
-
-	if c.state.ExecSessions == nil {
-		c.state.ExecSessions = make(map[string]*ExecSession)
+		return -1, fmt.Errorf("can only exec into running containers: %w", define.ErrCtrStateInvalid)
 	}
-	c.state.ExecSessions[session.ID()] = session
-	defer delete(c.state.ExecSessions, session.ID())
 
-	opts, err := prepareForExec(c, session)
-	if err != nil {
-		return -1, err
-	}
+	// On failure, the container may have exited after the unlocked check above;
+	// sync under the lock so that exit is recorded.
 	defer func() {
-		if err := c.cleanupExecBundle(session.ID()); err != nil {
-			logrus.Errorf("Container %s light exec session cleanup error: %v", c.ID(), err)
+		if retErr == nil || c.batched {
+			return
+		}
+		c.lock.Lock()
+		defer c.lock.Unlock()
+		if err := c.syncContainer(); err != nil {
+			if errors.Is(err, define.ErrNoSuchCtr) || errors.Is(err, define.ErrCtrRemoved) {
+				return
+			}
+			logrus.Errorf("Container %s no-session exec: syncing state after failed start: %v", c.ID(), err)
 		}
 	}()
 
-	pid, attachErrChan, err := c.ociRuntime.ExecContainer(c, session.ID(), opts, streams, nil)
-	if err != nil {
-		// Check if the error is command not found before returning
-		if exitCode := define.ExitCode(err); exitCode == define.ExecErrorCodeNotFound {
-			return exitCode, err
-		}
-		return define.ExecErrorCodeGeneric, err
-	}
-	session.PID = pid
-	session.PIDData = getPidData(pid)
+	// Generate a throwaway ID used solely for the temporary exec bundle path.
+	// No ExecSession is created and nothing is added to the container state or
+	// the database.
+	sessionID := stringid.GenerateRandomID()
 
-	if !c.batched {
-		c.lock.Unlock()
-		unlock = false
+	if err := c.createExecBundle(sessionID); err != nil {

do we need to keep the container lock here to prevent a removal to rm the exec bundle and leak the bundle dir?

giuseppe giuseppe commented on code on Dec 02, 2026 08:43 UTC
Code Review
libpod/oci_conmon_exec_nosession.go:1
@@ -0,0 +1,401 @@
+//go:build !remote && (linux || freebsd)
+
+package libpod
+
+import (
+	"bytes"
+	"context"
+	"errors"
+	"fmt"
+	"io"
+	"net"
+	"os"
+	"os/exec"
+	"path/filepath"
+	"slices"
+	"strconv"
+
+	"github.com/sirupsen/logrus"
+	"go.podman.io/common/pkg/resize"
+	"go.podman.io/podman/v6/libpod/define"
+	"go.podman.io/podman/v6/pkg/errorhandling"
+	"go.podman.io/podman/v6/pkg/pidhandle"
+	"golang.org/x/sys/unix"
+	"golang.org/x/term"
+)
+
+// ExecContainerNoSession executes a command in a running container by invoking
+// the OCI runtime directly, without conmon. It blocks until the command exits.
+//
+// Non-TTY execs hand the attach streams to the runtime process: *os.File
+// streams are inherited without copying, other streams are copied by os/exec.
+// An attached STDIN must read from os.Stdin, and is piped if it is a terminal
+// (see wireNoSessionStdio).
+// TTY execs receive the PTY master from the runtime over a console socket and
+// service it here (byte copy and resizes).
+//
+// Runtime launch failures are read from the runtime's JSON log (when
+// supported) rather than from STDERR, so output of the exec'd process can never
+// be mistaken for one.
+func (r *ConmonOCIRuntime) ExecContainerNoSession(ctx context.Context, ctr *Container, sessionID string, options *ExecOptions, streams *define.AttachStreams, resizeChan <-chan resize.TerminalSize) (int, error) {
+	processFile, err := ctr.prepareProcessExec(options, sessionID)
+	if err != nil {
+		return define.ExecErrorCodeGeneric, err
+	}
+	defer processFile.Close()
+
+	preserveFDs, filesToClose, extraFiles, err := getPreserveFdExtraFiles(options.PreserveFD, options.PreserveFDs)
+	if err != nil {
+		return define.ExecErrorCodeGeneric, err
+	}
+	defer func() {
+		for _, f := range filesToClose {
+			errorhandling.CloseQuiet(f)
+		}
+	}()
+
+	env, err := r.configureConmonEnv()
+	if err != nil {
+		return define.ExecErrorCodeGeneric, fmt.Errorf("configuring OCI runtime env: %w", err)
+	}
+
+	ociLog := ctr.execOCILog(sessionID)
+
+	args := slices.Clone(r.runtimeFlags)
+	if ociLog != "" {
+		args = append(args, "--log-format=json", "--log", ociLog)
+	}
+	args = append(args, "exec", "--process", processFile.Name(), "--pid-file", ctr.execPidPath(sessionID))
+
+	var consoleListener *net.UnixListener
+	if options.Terminal {
+		sockPath := noSessionConsoleSocketPath(r.tmpDir, sessionID)
+		consoleListener, err = net.ListenUnix("unix", &net.UnixAddr{Name: sockPath, Net: "unix"})
+		if err != nil {
+			return define.ExecErrorCodeGeneric, fmt.Errorf("creating no-session exec console socket: %w", err)
+		}
+		// Closing a listener created by ListenUnix also removes the socket file.
+		defer consoleListener.Close()
+		args = append(args, "--console-socket", sockPath)

another question: instead of duplicating the tty handling, could we just pass "tty: true" to the OCI runtime and let it deal with the tty? The only disadvantage is that the runtime exec will stay around (but it is not a big cost IMO)

giuseppe giuseppe requested changes on Dec 02, 2026 08:44 UTC
Changes Requested Reviewer

Requested changes.

jankaluza jankaluza commented on Dec 02, 2026 09:51 UTC
Contributor

This is really nice. I've checked the overall logic in high-level and it makes sense. I will do detailed review later :-).

mheon mheon commented on code on Dec 02, 2026 20:18 UTC
Code Review
libpod/container_exec.go:1
@@ -1202,98 +1221,74 @@ func justWriteExecExitCode(c *Container, sessionID string, exitCode int, emitEve
 	return c.save()
 }
 
-// execLightweight executes a command in a container without creating a persistent exec session.
-// It is used by both ExecNoSession and healthCheckExec to avoid code duplication.
-func (c *Container) execLightweight(config *ExecConfig, streams *define.AttachStreams, timeout time.Duration) (int, error) {
+// ExecNoSession executes a command in a container by directly invoking the OCI
+// runtime, bypassing conmon entirely (see OCIRuntime.ExecContainerNoSession).
+// It does not create a persistent exec session and does not write anything to
+// the database. In the common case it does not take the container lock at all:
+// the lock is only taken if the exec fails, to record an exit that happened
+// underneath it. A long-running no-session exec therefore never blocks
+// unrelated operations such as `podman stop`.
+//
+// Raw-mode setup of the caller's terminal is done by the caller (see
+// terminal.ExecNoSessionCtr); resizeChan, when non-nil, forwards live resizes
+// to a TTY exec. Because there is no attach session, detaching is impossible:
+// --detach and --detach-keys are rejected by the CLI.
+//
+// Cancelling ctx kills the exec'd process (see execNoSession); callers that
+// want a long-running exec to follow their request lifecycle must pass a
+// cancellable ctx rather than context.Background().
+func (c *Container) ExecNoSession(ctx context.Context, config *ExecConfig, streams *define.AttachStreams, resizeChan <-chan resize.TerminalSize) (int, error) {
+	return c.execNoSession(ctx, config, streams, resizeChan)
+}
+
+// execNoSession implements ExecNoSession and healthCheckExec. Cancelling ctx
+// kills the exec'd process and returns ctx.Err().
+func (c *Container) execNoSession(ctx context.Context, config *ExecConfig, streams *define.AttachStreams, resizeChan <-chan resize.TerminalSize) (exitCode int, retErr error) {
 	if err := c.verifyExecConfig(config); err != nil {
 		return -1, err
 	}
 
-	unlock := true
+	// Check the container is running without taking the lock. UpdateContainer
+	// also populates c.state from the backing store, which prepareProcessExec
+	// (user/mount resolution) and the exec bundle path (bundlePath) require.
 	if !c.batched {
-		c.lock.Lock()
-		defer func() {
-			if unlock {
-				c.lock.Unlock()
-			}
-		}()
-
-		if err := c.syncContainer(); err != nil {
+		if err := c.runtime.state.UpdateContainer(c); err != nil {
 			return -1, err
 		}
 	}
-
 	if !c.ensureState(define.ContainerStateRunning) {
-		return -1, fmt.Errorf("can only create exec sessions on running containers: %w", define.ErrCtrStateInvalid)
-	}
-
-	session, err := c.createExecSession(config)
-	if err != nil {
-		return -1, err
-	}
-
-	if c.state.ExecSessions == nil {
-		c.state.ExecSessions = make(map[string]*ExecSession)
+		return -1, fmt.Errorf("can only exec into running containers: %w", define.ErrCtrStateInvalid)
 	}
-	c.state.ExecSessions[session.ID()] = session
-	defer delete(c.state.ExecSessions, session.ID())
 
-	opts, err := prepareForExec(c, session)
-	if err != nil {
-		return -1, err
-	}
+	// On failure, the container may have exited after the unlocked check above;
+	// sync under the lock so that exit is recorded.
 	defer func() {
-		if err := c.cleanupExecBundle(session.ID()); err != nil {
-			logrus.Errorf("Container %s light exec session cleanup error: %v", c.ID(), err)
+		if retErr == nil || c.batched {
+			return
+		}
+		c.lock.Lock()
+		defer c.lock.Unlock()
+		if err := c.syncContainer(); err != nil {
+			if errors.Is(err, define.ErrNoSuchCtr) || errors.Is(err, define.ErrCtrRemoved) {
+				return
+			}
+			logrus.Errorf("Container %s no-session exec: syncing state after failed start: %v", c.ID(), err)
 		}
 	}()
 
-	pid, attachErrChan, err := c.ociRuntime.ExecContainer(c, session.ID(), opts, streams, nil)
-	if err != nil {
-		// Check if the error is command not found before returning
-		if exitCode := define.ExitCode(err); exitCode == define.ExecErrorCodeNotFound {
-			return exitCode, err
-		}
-		return define.ExecErrorCodeGeneric, err
-	}
-	session.PID = pid
-	session.PIDData = getPidData(pid)
+	// Generate a throwaway ID used solely for the temporary exec bundle path.
+	// No ExecSession is created and nothing is added to the container state or
+	// the database.
+	sessionID := stringid.GenerateRandomID()
 
-	if !c.batched {
-		c.lock.Unlock()
-		unlock = false
+	if err := c.createExecBundle(sessionID); err != nil {

I think there's a risk, but holding the container lock would destroy the performance benefits, so I think we have to be willing to live with it? I could mention the risk in the manpage...

mheon mheon commented on code on Dec 02, 2026 20:19 UTC
Code Review
libpod/oci_conmon_exec_nosession.go:1
@@ -0,0 +1,401 @@
+//go:build !remote && (linux || freebsd)
+
+package libpod
+
+import (
+	"bytes"
+	"context"
+	"errors"
+	"fmt"
+	"io"
+	"net"
+	"os"
+	"os/exec"
+	"path/filepath"
+	"slices"
+	"strconv"
+
+	"github.com/sirupsen/logrus"
+	"go.podman.io/common/pkg/resize"
+	"go.podman.io/podman/v6/libpod/define"
+	"go.podman.io/podman/v6/pkg/errorhandling"
+	"go.podman.io/podman/v6/pkg/pidhandle"
+	"golang.org/x/sys/unix"
+	"golang.org/x/term"
+)
+
+// ExecContainerNoSession executes a command in a running container by invoking
+// the OCI runtime directly, without conmon. It blocks until the command exits.
+//
+// Non-TTY execs hand the attach streams to the runtime process: *os.File
+// streams are inherited without copying, other streams are copied by os/exec.
+// An attached STDIN must read from os.Stdin, and is piped if it is a terminal
+// (see wireNoSessionStdio).
+// TTY execs receive the PTY master from the runtime over a console socket and
+// service it here (byte copy and resizes).
+//
+// Runtime launch failures are read from the runtime's JSON log (when
+// supported) rather than from STDERR, so output of the exec'd process can never
+// be mistaken for one.
+func (r *ConmonOCIRuntime) ExecContainerNoSession(ctx context.Context, ctr *Container, sessionID string, options *ExecOptions, streams *define.AttachStreams, resizeChan <-chan resize.TerminalSize) (int, error) {
+	processFile, err := ctr.prepareProcessExec(options, sessionID)
+	if err != nil {
+		return define.ExecErrorCodeGeneric, err
+	}
+	defer processFile.Close()
+
+	preserveFDs, filesToClose, extraFiles, err := getPreserveFdExtraFiles(options.PreserveFD, options.PreserveFDs)
+	if err != nil {
+		return define.ExecErrorCodeGeneric, err
+	}
+	defer func() {
+		for _, f := range filesToClose {
+			errorhandling.CloseQuiet(f)
+		}
+	}()
+
+	env, err := r.configureConmonEnv()
+	if err != nil {
+		return define.ExecErrorCodeGeneric, fmt.Errorf("configuring OCI runtime env: %w", err)
+	}
+
+	ociLog := ctr.execOCILog(sessionID)
+
+	args := slices.Clone(r.runtimeFlags)
+	if ociLog != "" {
+		args = append(args, "--log-format=json", "--log", ociLog)
+	}
+	args = append(args, "exec", "--process", processFile.Name(), "--pid-file", ctr.execPidPath(sessionID))
+
+	var consoleListener *net.UnixListener
+	if options.Terminal {
+		sockPath := noSessionConsoleSocketPath(r.tmpDir, sessionID)
+		consoleListener, err = net.ListenUnix("unix", &net.UnixAddr{Name: sockPath, Net: "unix"})
+		if err != nil {
+			return define.ExecErrorCodeGeneric, fmt.Errorf("creating no-session exec console socket: %w", err)
+		}
+		// Closing a listener created by ListenUnix also removes the socket file.
+		defer consoleListener.Close()
+		args = append(args, "--console-socket", sockPath)

RE: tty=true - it had a few issues with attach in my testing so I avoided it - control characters being eaten during attach, for example.

giuseppe giuseppe commented on code on Dec 03, 2026 16:48 UTC
Code Review
libpod/container_exec.go:1
@@ -1202,98 +1221,74 @@ func justWriteExecExitCode(c *Container, sessionID string, exitCode int, emitEve
 	return c.save()
 }
 
-// execLightweight executes a command in a container without creating a persistent exec session.
-// It is used by both ExecNoSession and healthCheckExec to avoid code duplication.
-func (c *Container) execLightweight(config *ExecConfig, streams *define.AttachStreams, timeout time.Duration) (int, error) {
+// ExecNoSession executes a command in a container by directly invoking the OCI
+// runtime, bypassing conmon entirely (see OCIRuntime.ExecContainerNoSession).
+// It does not create a persistent exec session and does not write anything to
+// the database. In the common case it does not take the container lock at all:
+// the lock is only taken if the exec fails, to record an exit that happened
+// underneath it. A long-running no-session exec therefore never blocks
+// unrelated operations such as `podman stop`.
+//
+// Raw-mode setup of the caller's terminal is done by the caller (see
+// terminal.ExecNoSessionCtr); resizeChan, when non-nil, forwards live resizes
+// to a TTY exec. Because there is no attach session, detaching is impossible:
+// --detach and --detach-keys are rejected by the CLI.
+//
+// Cancelling ctx kills the exec'd process (see execNoSession); callers that
+// want a long-running exec to follow their request lifecycle must pass a
+// cancellable ctx rather than context.Background().
+func (c *Container) ExecNoSession(ctx context.Context, config *ExecConfig, streams *define.AttachStreams, resizeChan <-chan resize.TerminalSize) (int, error) {
+	return c.execNoSession(ctx, config, streams, resizeChan)
+}
+
+// execNoSession implements ExecNoSession and healthCheckExec. Cancelling ctx
+// kills the exec'd process and returns ctx.Err().
+func (c *Container) execNoSession(ctx context.Context, config *ExecConfig, streams *define.AttachStreams, resizeChan <-chan resize.TerminalSize) (exitCode int, retErr error) {
 	if err := c.verifyExecConfig(config); err != nil {
 		return -1, err
 	}
 
-	unlock := true
+	// Check the container is running without taking the lock. UpdateContainer
+	// also populates c.state from the backing store, which prepareProcessExec
+	// (user/mount resolution) and the exec bundle path (bundlePath) require.
 	if !c.batched {
-		c.lock.Lock()
-		defer func() {
-			if unlock {
-				c.lock.Unlock()
-			}
-		}()
-
-		if err := c.syncContainer(); err != nil {
+		if err := c.runtime.state.UpdateContainer(c); err != nil {
 			return -1, err
 		}
 	}
-
 	if !c.ensureState(define.ContainerStateRunning) {
-		return -1, fmt.Errorf("can only create exec sessions on running containers: %w", define.ErrCtrStateInvalid)
-	}
-
-	session, err := c.createExecSession(config)
-	if err != nil {
-		return -1, err
-	}
-
-	if c.state.ExecSessions == nil {
-		c.state.ExecSessions = make(map[string]*ExecSession)
+		return -1, fmt.Errorf("can only exec into running containers: %w", define.ErrCtrStateInvalid)
 	}
-	c.state.ExecSessions[session.ID()] = session
-	defer delete(c.state.ExecSessions, session.ID())
 
-	opts, err := prepareForExec(c, session)
-	if err != nil {
-		return -1, err
-	}
+	// On failure, the container may have exited after the unlocked check above;
+	// sync under the lock so that exit is recorded.
 	defer func() {
-		if err := c.cleanupExecBundle(session.ID()); err != nil {
-			logrus.Errorf("Container %s light exec session cleanup error: %v", c.ID(), err)
+		if retErr == nil || c.batched {
+			return
+		}
+		c.lock.Lock()
+		defer c.lock.Unlock()
+		if err := c.syncContainer(); err != nil {
+			if errors.Is(err, define.ErrNoSuchCtr) || errors.Is(err, define.ErrCtrRemoved) {
+				return
+			}
+			logrus.Errorf("Container %s no-session exec: syncing state after failed start: %v", c.ID(), err)
 		}
 	}()
 
-	pid, attachErrChan, err := c.ociRuntime.ExecContainer(c, session.ID(), opts, streams, nil)
-	if err != nil {
-		// Check if the error is command not found before returning
-		if exitCode := define.ExitCode(err); exitCode == define.ExecErrorCodeNotFound {
-			return exitCode, err
-		}
-		return define.ExecErrorCodeGeneric, err
-	}
-	session.PID = pid
-	session.PIDData = getPidData(pid)
+	// Generate a throwaway ID used solely for the temporary exec bundle path.
+	// No ExecSession is created and nothing is added to the container state or
+	// the database.
+	sessionID := stringid.GenerateRandomID()
 
-	if !c.batched {
-		c.lock.Unlock()
-		unlock = false
+	if err := c.createExecBundle(sessionID); err != nil {

so could we avoid the MkdirAll and create only the directories we need (so that it is not creating parent directories that were removed)?

giuseppe giuseppe commented on code on Dec 03, 2026 16:49 UTC
Code Review
libpod/oci_conmon_exec_nosession.go:1
@@ -0,0 +1,401 @@
+//go:build !remote && (linux || freebsd)
+
+package libpod
+
+import (
+	"bytes"
+	"context"
+	"errors"
+	"fmt"
+	"io"
+	"net"
+	"os"
+	"os/exec"
+	"path/filepath"
+	"slices"
+	"strconv"
+
+	"github.com/sirupsen/logrus"
+	"go.podman.io/common/pkg/resize"
+	"go.podman.io/podman/v6/libpod/define"
+	"go.podman.io/podman/v6/pkg/errorhandling"
+	"go.podman.io/podman/v6/pkg/pidhandle"
+	"golang.org/x/sys/unix"
+	"golang.org/x/term"
+)
+
+// ExecContainerNoSession executes a command in a running container by invoking
+// the OCI runtime directly, without conmon. It blocks until the command exits.
+//
+// Non-TTY execs hand the attach streams to the runtime process: *os.File
+// streams are inherited without copying, other streams are copied by os/exec.
+// An attached STDIN must read from os.Stdin, and is piped if it is a terminal
+// (see wireNoSessionStdio).
+// TTY execs receive the PTY master from the runtime over a console socket and
+// service it here (byte copy and resizes).
+//
+// Runtime launch failures are read from the runtime's JSON log (when
+// supported) rather than from STDERR, so output of the exec'd process can never
+// be mistaken for one.
+func (r *ConmonOCIRuntime) ExecContainerNoSession(ctx context.Context, ctr *Container, sessionID string, options *ExecOptions, streams *define.AttachStreams, resizeChan <-chan resize.TerminalSize) (int, error) {
+	processFile, err := ctr.prepareProcessExec(options, sessionID)
+	if err != nil {
+		return define.ExecErrorCodeGeneric, err
+	}
+	defer processFile.Close()
+
+	preserveFDs, filesToClose, extraFiles, err := getPreserveFdExtraFiles(options.PreserveFD, options.PreserveFDs)
+	if err != nil {
+		return define.ExecErrorCodeGeneric, err
+	}
+	defer func() {
+		for _, f := range filesToClose {
+			errorhandling.CloseQuiet(f)
+		}
+	}()
+
+	env, err := r.configureConmonEnv()
+	if err != nil {
+		return define.ExecErrorCodeGeneric, fmt.Errorf("configuring OCI runtime env: %w", err)
+	}
+
+	ociLog := ctr.execOCILog(sessionID)
+
+	args := slices.Clone(r.runtimeFlags)
+	if ociLog != "" {
+		args = append(args, "--log-format=json", "--log", ociLog)
+	}
+	args = append(args, "exec", "--process", processFile.Name(), "--pid-file", ctr.execPidPath(sessionID))
+
+	var consoleListener *net.UnixListener
+	if options.Terminal {
+		sockPath := noSessionConsoleSocketPath(r.tmpDir, sessionID)
+		consoleListener, err = net.ListenUnix("unix", &net.UnixAddr{Name: sockPath, Net: "unix"})
+		if err != nil {
+			return define.ExecErrorCodeGeneric, fmt.Errorf("creating no-session exec console socket: %w", err)
+		}
+		// Closing a listener created by ListenUnix also removes the socket file.
+		defer consoleListener.Close()
+		args = append(args, "--console-socket", sockPath)

is that an issue in crun?

Luap99 Luap99 commented on code on Dec 03, 2026 17:38 UTC
Code Review
libpod/container_exec.go:1
@@ -1202,98 +1221,86 @@ func justWriteExecExitCode(c *Container, sessionID string, exitCode int, emitEve
 	return c.save()
 }
 
-// execLightweight executes a command in a container without creating a persistent exec session.
-// It is used by both ExecNoSession and healthCheckExec to avoid code duplication.
-func (c *Container) execLightweight(config *ExecConfig, streams *define.AttachStreams, timeout time.Duration) (int, error) {
+// ExecNoSession executes a command in a container by directly invoking the OCI
+// runtime, bypassing conmon entirely (see OCIRuntime.ExecContainerNoSession).
+// It does not create a persistent exec session and does not write anything to
+// the database. In the common case it does not take the container lock at all:
+// the lock is only taken if the exec fails, to record an exit that happened
+// underneath it. A long-running no-session exec therefore never blocks
+// unrelated operations such as `podman stop`.
+//
+// Raw-mode setup of the caller's terminal is done by the caller (see
+// terminal.ExecNoSessionCtr); resizeChan, when non-nil, forwards live resizes
+// to a TTY exec. Because there is no attach session, detaching is impossible:
+// --detach and --detach-keys are rejected by the CLI.
+//
+// Cancelling ctx kills the exec'd process (see execNoSession); callers that
+// want a long-running exec to follow their request lifecycle must pass a
+// cancellable ctx rather than context.Background().
+func (c *Container) ExecNoSession(ctx context.Context, config *ExecConfig, streams *define.AttachStreams, resizeChan <-chan resize.TerminalSize) (int, error) {
+	return c.execNoSession(ctx, config, streams, resizeChan)
+}
+
+// execNoSession implements ExecNoSession and healthCheckExec. Cancelling ctx
+// kills the exec'd process and returns ctx.Err().
+func (c *Container) execNoSession(ctx context.Context, config *ExecConfig, streams *define.AttachStreams, resizeChan <-chan resize.TerminalSize) (exitCode int, retErr error) {
 	if err := c.verifyExecConfig(config); err != nil {
 		return -1, err
 	}
 
-	unlock := true
+	// Read the container's state from the backing store without taking the
+	// lock. UpdateContainer also populates the state that prepareProcessExec
+	// (user/mount resolution) and the exec bundle path (bundlePath) require.
+	//
+	// This runs on a throwaway copy of the Container, not the shared *c:
+	// UpdateContainer replaces the *state pointer, and doing that on the real
+	// container while holding no lock would race a concurrent, locked
+	// operation mutating the real container's state (for example, in
+	// preparation for a Save). A shallow copy keeps the immutable config, the
+	// lock, and the runtime, and only hands us a private state, so it is cheap
+	// and loses none of the synchronization the locked paths rely on. Every
+	// operation below reads state only, so operating on the copy is sufficient,
+	// and nothing here is written back to the real container or the database.
+	execCtr := new(Container)
+	*execCtr = *c
 	if !c.batched {
-		c.lock.Lock()
-		defer func() {
-			if unlock {
-				c.lock.Unlock()
-			}
-		}()
-
-		if err := c.syncContainer(); err != nil {
+		if err := c.runtime.state.UpdateContainer(execCtr); err != nil {
 			return -1, err
 		}
 	}
-
-	if !c.ensureState(define.ContainerStateRunning) {
-		return -1, fmt.Errorf("can only create exec sessions on running containers: %w", define.ErrCtrStateInvalid)
-	}
-
-	session, err := c.createExecSession(config)
-	if err != nil {
-		return -1, err
-	}
-
-	if c.state.ExecSessions == nil {
-		c.state.ExecSessions = make(map[string]*ExecSession)
+	if !execCtr.ensureState(define.ContainerStateRunning) {
+		return -1, fmt.Errorf("can only exec into running containers: %w", define.ErrCtrStateInvalid)

generally speaking all state check outside a lock are incorrect. by the time we checked this the container can be in any other state already.

Luap99 Luap99 commented on code on Dec 03, 2026 17:40 UTC
Code Review
libpod/container_exec.go:1
@@ -1202,98 +1221,86 @@ func justWriteExecExitCode(c *Container, sessionID string, exitCode int, emitEve
 	return c.save()
 }
 
-// execLightweight executes a command in a container without creating a persistent exec session.
-// It is used by both ExecNoSession and healthCheckExec to avoid code duplication.
-func (c *Container) execLightweight(config *ExecConfig, streams *define.AttachStreams, timeout time.Duration) (int, error) {
+// ExecNoSession executes a command in a container by directly invoking the OCI
+// runtime, bypassing conmon entirely (see OCIRuntime.ExecContainerNoSession).
+// It does not create a persistent exec session and does not write anything to
+// the database. In the common case it does not take the container lock at all:
+// the lock is only taken if the exec fails, to record an exit that happened
+// underneath it. A long-running no-session exec therefore never blocks
+// unrelated operations such as `podman stop`.
+//
+// Raw-mode setup of the caller's terminal is done by the caller (see
+// terminal.ExecNoSessionCtr); resizeChan, when non-nil, forwards live resizes
+// to a TTY exec. Because there is no attach session, detaching is impossible:
+// --detach and --detach-keys are rejected by the CLI.
+//
+// Cancelling ctx kills the exec'd process (see execNoSession); callers that
+// want a long-running exec to follow their request lifecycle must pass a
+// cancellable ctx rather than context.Background().
+func (c *Container) ExecNoSession(ctx context.Context, config *ExecConfig, streams *define.AttachStreams, resizeChan <-chan resize.TerminalSize) (int, error) {
+	return c.execNoSession(ctx, config, streams, resizeChan)
+}
+
+// execNoSession implements ExecNoSession and healthCheckExec. Cancelling ctx
+// kills the exec'd process and returns ctx.Err().
+func (c *Container) execNoSession(ctx context.Context, config *ExecConfig, streams *define.AttachStreams, resizeChan <-chan resize.TerminalSize) (exitCode int, retErr error) {
 	if err := c.verifyExecConfig(config); err != nil {
 		return -1, err
 	}
 
-	unlock := true
+	// Read the container's state from the backing store without taking the
+	// lock. UpdateContainer also populates the state that prepareProcessExec
+	// (user/mount resolution) and the exec bundle path (bundlePath) require.
+	//
+	// This runs on a throwaway copy of the Container, not the shared *c:
+	// UpdateContainer replaces the *state pointer, and doing that on the real
+	// container while holding no lock would race a concurrent, locked
+	// operation mutating the real container's state (for example, in
+	// preparation for a Save). A shallow copy keeps the immutable config, the
+	// lock, and the runtime, and only hands us a private state, so it is cheap
+	// and loses none of the synchronization the locked paths rely on. Every
+	// operation below reads state only, so operating on the copy is sufficient,
+	// and nothing here is written back to the real container or the database.
+	execCtr := new(Container)
+	*execCtr = *c
 	if !c.batched {
-		c.lock.Lock()
-		defer func() {
-			if unlock {
-				c.lock.Unlock()
-			}
-		}()
-
-		if err := c.syncContainer(); err != nil {
+		if err := c.runtime.state.UpdateContainer(execCtr); err != nil {
 			return -1, err
 		}
 	}
-
-	if !c.ensureState(define.ContainerStateRunning) {
-		return -1, fmt.Errorf("can only create exec sessions on running containers: %w", define.ErrCtrStateInvalid)
-	}
-
-	session, err := c.createExecSession(config)
-	if err != nil {
-		return -1, err
-	}
-
-	if c.state.ExecSessions == nil {
-		c.state.ExecSessions = make(map[string]*ExecSession)
+	if !execCtr.ensureState(define.ContainerStateRunning) {
+		return -1, fmt.Errorf("can only exec into running containers: %w", define.ErrCtrStateInvalid)
 	}
-	c.state.ExecSessions[session.ID()] = session
-	defer delete(c.state.ExecSessions, session.ID())
 
-	opts, err := prepareForExec(c, session)
-	if err != nil {
-		return -1, err
-	}
+	// On failure, the container may have exited after the unlocked check above;
+	// sync under the lock so that exit is recorded.
 	defer func() {
-		if err := c.cleanupExecBundle(session.ID()); err != nil {
-			logrus.Errorf("Container %s light exec session cleanup error: %v", c.ID(), err)
+		if retErr == nil || c.batched {
+			return
+		}
+		c.lock.Lock()
+		defer c.lock.Unlock()
+		if err := c.syncContainer(); err != nil {
+			if errors.Is(err, define.ErrNoSuchCtr) || errors.Is(err, define.ErrCtrRemoved) {
+				return
+			}
+			logrus.Errorf("Container %s no-session exec: syncing state after failed start: %v", c.ID(), err)
 		}
 	}()
 
-	pid, attachErrChan, err := c.ociRuntime.ExecContainer(c, session.ID(), opts, streams, nil)
-	if err != nil {
-		// Check if the error is command not found before returning
-		if exitCode := define.ExitCode(err); exitCode == define.ExecErrorCodeNotFound {
-			return exitCode, err
-		}
-		return define.ExecErrorCodeGeneric, err
-	}
-	session.PID = pid
-	session.PIDData = getPidData(pid)
+	// Generate a throwaway ID used solely for the temporary exec bundle path.
+	// No ExecSession is created and nothing is added to the container state or
+	// the database.
+	sessionID := stringid.GenerateRandomID()

what is preventing some other process from picking the same id randomly?
the mkdir should not use MkdirAll(), it should return an error is the session directory already exists to avoid id conflicts

Luap99 Luap99 commented on code on Dec 03, 2026 17:42 UTC
Code Review
libpod/healthcheck.go:1
@@ -69,7 +68,6 @@ func (c *Container) runHealthCheck(ctx context.Context, isStartup bool) (define.
 		// there is a start-period we need to honor; we add startPeriod to container start time
 		startPeriodTime := c.state.StartedTime.Add(c.HealthCheckConfig().StartPeriod)
 		c.lock.Unlock()
-		// Do not stay locked here, in healthCheckExec it will lock again.

why is this comment removed

Luap99 Luap99 commented on code on Dec 03, 2026 18:17 UTC
Code Review
pkg/subreaper/subreaper.go:1
@@ -0,0 +1,61 @@
+//go:build linux || freebsd
+
+// Package subreaper makes the calling process a child subreaper: orphaned
+// descendants are reparented to it, rather than to init, so it can reap them
+// and collect their exit codes. This is what lets a process that started an
+// OCI runtime with --detach wait for the process the runtime started.
+//
+// Being a subreaper is process-wide state, and it has a cost: every orphaned
+// descendant becomes a child that must be reaped, or it stays a zombie until
+// this process exits. The package therefore enables it only while at least
+// one caller holds it, and coordinates concurrent callers itself.
+package subreaper
+
+import (
+	"sync"
+
+	"github.com/sirupsen/logrus"
+)
+
+var state struct {
+	sync.Mutex
+	users int
+	// disable reverts enable; nil if the process was already a subreaper
+	// before the first Acquire, in which case it is left as it was.
+	disable func() error
+}
+
+// Acquire makes the calling process a child subreaper until the returned
+// release function is called. Acquire may be called concurrently: the process
+// remains a subreaper until every caller has released it. If the process was
+// already a subreaper before the first call, it stays one.
+//
+// A process becomes a child only once the parent it had exits, so a caller
+// must acquire before starting the process whose descendants it wants to reap,
+// and release only once it has reaped them.
+func Acquire() (release func(), err error) {
+	state.Lock()
+	defer state.Unlock()
+	if state.users == 0 {
+		disable, err := enable()
+		if err != nil {

There is nothing reaping the child process here is there? All process stays as zombie until the main one exists?

Also that is a big no for the podman system service

Luap99 Luap99 commented on Dec 03, 2026 18:49 UTC
Reviewer

Not a full review, overall this feels quite hacky. Do we really need to detach? Seems a lot simpler not doing that and just waiting for the crun exec parent we just spawned?
Then we can read the exit code normally and do not need to be supereaper. Also I agree not having to deal with the tty would be nice so using the --tty option would be nicer IMO.

I think the risk already exists is the problem with the session / process.json file leaking. Could we in theory pass a pipe instead? Like give /proc/self/fd/x to child as path and open the read side of the pipe there? Of course it would need a another sender goroutine as the content could be larger then the max buffer size of the pipe

mheon mheon commented on code on Dec 03, 2026 19:20 UTC
Code Review
libpod/container_exec.go:1
@@ -1202,98 +1221,86 @@ func justWriteExecExitCode(c *Container, sessionID string, exitCode int, emitEve
 	return c.save()
 }
 
-// execLightweight executes a command in a container without creating a persistent exec session.
-// It is used by both ExecNoSession and healthCheckExec to avoid code duplication.
-func (c *Container) execLightweight(config *ExecConfig, streams *define.AttachStreams, timeout time.Duration) (int, error) {
+// ExecNoSession executes a command in a container by directly invoking the OCI
+// runtime, bypassing conmon entirely (see OCIRuntime.ExecContainerNoSession).
+// It does not create a persistent exec session and does not write anything to
+// the database. In the common case it does not take the container lock at all:
+// the lock is only taken if the exec fails, to record an exit that happened
+// underneath it. A long-running no-session exec therefore never blocks
+// unrelated operations such as `podman stop`.
+//
+// Raw-mode setup of the caller's terminal is done by the caller (see
+// terminal.ExecNoSessionCtr); resizeChan, when non-nil, forwards live resizes
+// to a TTY exec. Because there is no attach session, detaching is impossible:
+// --detach and --detach-keys are rejected by the CLI.
+//
+// Cancelling ctx kills the exec'd process (see execNoSession); callers that
+// want a long-running exec to follow their request lifecycle must pass a
+// cancellable ctx rather than context.Background().
+func (c *Container) ExecNoSession(ctx context.Context, config *ExecConfig, streams *define.AttachStreams, resizeChan <-chan resize.TerminalSize) (int, error) {
+	return c.execNoSession(ctx, config, streams, resizeChan)
+}
+
+// execNoSession implements ExecNoSession and healthCheckExec. Cancelling ctx
+// kills the exec'd process and returns ctx.Err().
+func (c *Container) execNoSession(ctx context.Context, config *ExecConfig, streams *define.AttachStreams, resizeChan <-chan resize.TerminalSize) (exitCode int, retErr error) {
 	if err := c.verifyExecConfig(config); err != nil {
 		return -1, err
 	}
 
-	unlock := true
+	// Read the container's state from the backing store without taking the
+	// lock. UpdateContainer also populates the state that prepareProcessExec
+	// (user/mount resolution) and the exec bundle path (bundlePath) require.
+	//
+	// This runs on a throwaway copy of the Container, not the shared *c:
+	// UpdateContainer replaces the *state pointer, and doing that on the real
+	// container while holding no lock would race a concurrent, locked
+	// operation mutating the real container's state (for example, in
+	// preparation for a Save). A shallow copy keeps the immutable config, the
+	// lock, and the runtime, and only hands us a private state, so it is cheap
+	// and loses none of the synchronization the locked paths rely on. Every
+	// operation below reads state only, so operating on the copy is sufficient,
+	// and nothing here is written back to the real container or the database.
+	execCtr := new(Container)
+	*execCtr = *c
 	if !c.batched {
-		c.lock.Lock()
-		defer func() {
-			if unlock {
-				c.lock.Unlock()
-			}
-		}()
-
-		if err := c.syncContainer(); err != nil {
+		if err := c.runtime.state.UpdateContainer(execCtr); err != nil {
 			return -1, err
 		}
 	}
-
-	if !c.ensureState(define.ContainerStateRunning) {
-		return -1, fmt.Errorf("can only create exec sessions on running containers: %w", define.ErrCtrStateInvalid)
-	}
-
-	session, err := c.createExecSession(config)
-	if err != nil {
-		return -1, err
-	}
-
-	if c.state.ExecSessions == nil {
-		c.state.ExecSessions = make(map[string]*ExecSession)
+	if !execCtr.ensureState(define.ContainerStateRunning) {
+		return -1, fmt.Errorf("can only exec into running containers: %w", define.ErrCtrStateInvalid)
 	}
-	c.state.ExecSessions[session.ID()] = session
-	defer delete(c.state.ExecSessions, session.ID())
 
-	opts, err := prepareForExec(c, session)
-	if err != nil {
-		return -1, err
-	}
+	// On failure, the container may have exited after the unlocked check above;
+	// sync under the lock so that exit is recorded.
 	defer func() {
-		if err := c.cleanupExecBundle(session.ID()); err != nil {
-			logrus.Errorf("Container %s light exec session cleanup error: %v", c.ID(), err)
+		if retErr == nil || c.batched {
+			return
+		}
+		c.lock.Lock()
+		defer c.lock.Unlock()
+		if err := c.syncContainer(); err != nil {
+			if errors.Is(err, define.ErrNoSuchCtr) || errors.Is(err, define.ErrCtrRemoved) {
+				return
+			}
+			logrus.Errorf("Container %s no-session exec: syncing state after failed start: %v", c.ID(), err)
 		}
 	}()
 
-	pid, attachErrChan, err := c.ociRuntime.ExecContainer(c, session.ID(), opts, streams, nil)
-	if err != nil {
-		// Check if the error is command not found before returning
-		if exitCode := define.ExitCode(err); exitCode == define.ExecErrorCodeNotFound {
-			return exitCode, err
-		}
-		return define.ExecErrorCodeGeneric, err
-	}
-	session.PID = pid
-	session.PIDData = getPidData(pid)
+	// Generate a throwaway ID used solely for the temporary exec bundle path.
+	// No ExecSession is created and nothing is added to the container state or
+	// the database.
+	sessionID := stringid.GenerateRandomID()

I mean, they could, but it's a 256-bit random integer. If we have collisions, the universe hates us.

mheon mheon commented on Dec 03, 2026 19:22 UTC
Author

It would certainly be a lot simpler if we could drop detach and the subreaper bits

mheon mheon commented on Dec 03, 2026 19:23 UTC
Author

Regarding TTY - I think it's kind of important to retain, the expectation is that all usage is going to go through exec in this case, including debugging.

Reviewers
Assignees
mheon mheon
Labels
risk: low confidence: 91.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 71.5% (HIGH) · Higher = larger blast radius
71.5%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 91.7% · Lower = rushed or shallow review
91.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 5.9% · Safe to merge
5.9%