sessionlaunch

package
v0.72.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package sessionlaunch owns the fixed target-side harness launch boundary. Request data selects only one closed harness specification; it never becomes a shell program or executable name.

Index

Constants

View Source
const (
	RuntimeCodex      = "codex"
	RuntimeClaudeCode = "claude-code"
)
View Source
const PrivateLauncherArgument = "--wb-internal-session-launch"

Variables

View Source
var ErrNotReleased = errors.New("successor launcher is not released")

ErrNotReleased is the only recovery-safe absence signal. Inspect returns it only when no immutable launch/release exists; missing artifacts after a release remain hard errors and must never fall back to Git replay.

View Source
var ErrRetryableLaunch = errors.New("successor launcher has an exactly retryable terminal attempt")

ErrRetryableLaunch means Inspect proved that the latest released attempt has exact terminal failure evidence, a dead PID, and no tmux session. Receive may route this one outcome to Start without touching Git; Start rechecks all gates.

Functions

func PreflightLocal added in v0.67.4

func PreflightLocal(sourceRuntime string) error

PreflightLocal verifies the fixed local launcher dependencies without creating a launch plan, claiming a resume route, or changing custody.

func RunPrivateLauncher

func RunPrivateLauncher(args []string) int

RunPrivateLauncher is the early-dispatch child started only through the receiver's fixed tmux argv. It registers the preallocated WB identity on its own PID, publishes readiness, waits for the receiver's immutable release, and then replaces itself with the fixed harness executable.

func ValidateHarnessSelection

func ValidateHarnessSelection(sourceRuntime, requested string) error

Types

type AttemptFailureError

type AttemptFailureError struct {
	Evidence FailureEvidence
}

AttemptFailureError carries exact immutable post-release failure proof.

func (*AttemptFailureError) Error

func (failure *AttemptFailureError) Error() string

type BeforeRelease

type BeforeRelease func(context.Context, Prepared) (targetWorkLogRef string, err error)

BeforeRelease is the Task 5 custody seam. It prepares the successor-owned Work Log before the wrapper is allowed to Exec and returns the durable target Work Log reference that the immutable release must bind to this exact PID.

type FailureEvidence

type FailureEvidence struct {
	HandoffID              string
	RequestDigest          sessionmove.Digest
	AttemptID              string
	AttemptIndex           uint64
	PID                    int
	StartedAt              time.Time
	FailedAt               time.Time
	TargetWorkLogReference string
	Diagnostic             string
	// contains filtered or unexported fields
}

FailureEvidence is descriptor-validated immutable launcher evidence for one released attempt. Receivers use it to append Work Log failure lineage without parsing error text or guessing a PID/attempt identity.

func (FailureEvidence) Authenticates

func (e FailureEvidence) Authenticates(handoffID string, digest sessionmove.Digest, targetWorkLogReference string) bool

Authenticates reports whether this value was constructed from descriptor- validated Task4 artifacts and binds the supplied external custody identity.

type HarnessSpec

type HarnessSpec struct {
	Runtime    string
	Model      string
	Executable string
	Args       []string
}

type Options

type Options struct {
	Store         sessionmove.Store
	ProjectsRoot  string
	Request       sessionmove.Request
	RequestDigest sessionmove.Digest
	WorktreeDir   string
	PinnedCommit  string
	ExecutionLock *sessionmove.ExecutionLock
	// Authority/StoreRoot/Fence are the protocol-neutral path used by parked
	// bundles. Existing session-move callers leave them zero and are adapted
	// byte-for-byte from Request, Store, and ExecutionLock.
	Authority     *sessionauthority.Launch
	StoreRoot     string
	Fence         sessionauthority.Fence
	BeforeRelease BeforeRelease
}

type Prepared

type Prepared struct {
	Request       sessionmove.Request
	RequestDigest sessionmove.Digest
	Authority     sessionauthority.Launch
	Session       session.Record
	AttemptID     string
	AttemptIndex  uint64
	WorktreeDir   string
	PinnedCommit  string
}

type PreparedEvidence

type PreparedEvidence struct {
	HandoffID     string
	RequestDigest sessionmove.Digest
	AttemptID     string
	AttemptIndex  uint64
	PID           int
	StartedAt     time.Time
	// contains filtered or unexported fields
}

PreparedEvidence is the narrow recovery identity for a launcher that durably published exact ready/process artifacts but may not yet have a release. It authorizes only that attempt ID at an external custody barrier; Start still decides whether the same wrapper can release or must be replaced.

func InspectPrepared

func InspectPrepared(_ context.Context, options Options) (PreparedEvidence, error)

InspectPrepared authenticates the most recent descriptor-bound ready attempt when no launch has been released. It never declares success and never chooses retry policy; Start performs the live-wrapper/abandonment checks again while holding the same aggregate fence.

func (PreparedEvidence) Authenticates

func (e PreparedEvidence) Authenticates(handoffID string, digest sessionmove.Digest) bool

type Result

type Result struct {
	HandoffID              string    `json:"handoff_id"`
	WBSessionID            string    `json:"wb_session_id"`
	PredecessorWBSessionID string    `json:"predecessor_wb_session_id"`
	TargetMachine          string    `json:"target_machine"`
	PID                    int       `json:"pid"`
	AttemptID              string    `json:"attempt_id"`
	AttemptIndex           uint64    `json:"attempt_index"`
	TmuxName               string    `json:"tmux_name"`
	Runtime                string    `json:"runtime"`
	Model                  string    `json:"model,omitempty"`
	NativeHarnessID        string    `json:"native_harness_id,omitempty"`
	TargetWorkLogRef       string    `json:"target_work_log_ref,omitempty"`
	WorktreeDir            string    `json:"worktree_dir"`
	PinnedCommit           string    `json:"pinned_commit"`
	StartedAt              time.Time `json:"started_at"`
	Reused                 bool      `json:"reused"`
}

func Inspect

func Inspect(ctx context.Context, options Options) (Result, error)

func Start

func Start(ctx context.Context, options Options) (Result, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL