evalrun

package
v0.16.397 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package evalrun is the machine's side of the hub's evaluation (docs/hub/eval.md): it runs one golden task of the catalog in a sandbox on the person's machine and reports how it went. A clean copy of the task's base commit with no history, dependencies from the stores the machine already has, an agent session inside a bubblewrap sandbox that hides the person's home (no token of theirs is readable there), an access-only copy of the subscription login, `env -i`, then the task's hidden tests graded by exit code in the same sandbox. The copy and the sandbox home are removed afterwards.

Index

Constants

View Source
const (
	Done    = "done"
	Failed  = "failed"
	Timeout = "timeout"
	Stopped = "stopped"
	Skipped = "skipped"
)

Terminal states of a run; the others are preparing, running and grading.

Variables

View Source
var ErrBusy = errors.New("evalrun: another run is going on this machine")

ErrBusy is what Start returns while another run is going: a machine runs one at a time.

View Source
var RunID = regexp.MustCompile(`^[0-9a-f-]{36}$`)

RunID is the shape of a run's id (a UUID).

Functions

This section is empty.

Types

type Arm

type Arm struct {
	Key    string  `json:"key"`
	Model  string  `json:"model"`
	Effort *string `json:"effort"`
	// Harness is "personal" (the person's plugins, skills and CLAUDE.md) or "repo" (only what the repository brings).
	Harness string `json:"harness"`
	// Agent is "claude" (default) or "codex".
	Agent string `json:"agent"`
	// Variant "inline" runs without subagents.
	Variant string `json:"variant"`
}

Arm is the way the harness is set up for a run.

type Check

type Check struct {
	Name string `json:"name"`
	Run  string `json:"run"`
}

Check is a hidden check of a task: a shell command in the sandbox, passed when it exits 0.

type CheckResult

type CheckResult struct {
	Name     string `json:"name"`
	Passed   bool   `json:"passed"`
	ExitCode *int   `json:"exitCode"`
	Ms       int    `json:"ms"`
}

Check result of one hidden check.

type Diff

type Diff struct {
	Files     int      `json:"files"`
	Added     int      `json:"added"`
	Removed   int      `json:"removed"`
	Forbidden []string `json:"forbidden"`
}

Diff counts what the agent changed.

type Limits

type Limits struct {
	WallS int     `json:"wallS"`
	USD   float64 `json:"usd"`
}

Limits bound one run: wall time in seconds and the agent's budget in US dollars.

type Request

type Request struct {
	RunID string `json:"runId"`
	Task  Task   `json:"task"`
	Arm   Arm    `json:"arm"`
}

Request is what the hub hands over to start a run.

type Runner

type Runner struct {
	// Home is the person's home: their logins and harness are read from here, and hidden from the sandbox.
	Home string
	// Dir is where runs live: <Dir>/runs/<id>, and while a run goes <Dir>/work/<id> and <Dir>/home/<id>.
	Dir string
	// Workspace holds the repositories the tasks are cut from: <Workspace>/<repo>.
	Workspace string
	// BwrapPath is the bubblewrap binary; empty means the machine cannot sandbox and runs are skipped.
	BwrapPath string
	// ToolDirs are extra directories of tools (node, pnpm, go ...) that are put on the sandbox's PATH and bound read-only.
	ToolDirs []string
	// contains filtered or unexported fields
}

Runner runs the hub's golden tasks on this machine, one at a time.

func New

func New(home, dir, workspace string, toolDirs []string) *Runner

New is a Runner for the person who owns the home. Dir is usually <data dir>/eval.

func (*Runner) Poll

func (r *Runner) Poll(ids []string) map[string]State

Poll reports the runs it knows among ids. A run that was going when the agent restarted is over: it is reported failed.

func (*Runner) Start

func (r *Runner) Start(q Request) error

Start takes a run and goes on with it in the background. Asking again for a run the machine already has is not an error, so a hub that did not hear the answer can ask again.

func (*Runner) Stop

func (r *Runner) Stop(id string)

Stop ends a run. A run the machine does not have is not an error.

type State

type State struct {
	RunID       string         `json:"runId"`
	State       string         `json:"state"`
	StartedAt   string         `json:"startedAt"`
	UpdatedAt   string         `json:"updatedAt"`
	FinishedAt  string         `json:"finishedAt"`
	Error       string         `json:"error"`
	Fingerprint string         `json:"fingerprint"`
	SessionID   string         `json:"conversationId"`
	Passed      *bool          `json:"passed"`
	WallS       *int           `json:"wallS"`
	Usage       *Usage         `json:"usage"`
	Checks      []CheckResult  `json:"checks"`
	Diff        *Diff          `json:"diff"`
	Timings     map[string]int `json:"timings"`
}

State is the report on one run; the runner keeps it in the run's folder as state.json.

func (State) Terminal

func (s State) Terminal() bool

Terminal says whether the run is over.

type Task

type Task struct {
	Key    string  `json:"key"`
	Repo   string  `json:"repo"`
	Base   string  `json:"base"`
	Prompt string  `json:"prompt"`
	Checks []Check `json:"checks"`
	// Hidden are files written into the copy after the session, before the checks (the tests the agent never saw).
	Hidden map[string]string `json:"hidden"`
	// Forbidden are globs of files the agent must not have touched.
	Forbidden []string `json:"forbidden"`
	Limits    Limits   `json:"limits"`
	// Setup is bash run in the sandbox before the session; what it leaves becomes part of the base commit.
	Setup string `json:"setup"`
	// Layout "workspace" puts the copy under a workspace folder of its own, as a source checkout lives.
	Layout string `json:"layout"`
	// Profile "danger" runs without the eval profile's own prohibitions: only the harness's hooks stand between the agent
	// and the action; the sandbox still hides the home and the network tools stay denied.
	Profile string `json:"profile"`
}

Task is one golden task as the hub's catalog has it.

type Usage

type Usage struct {
	USD        *float64 `json:"usd"`
	ModelCalls int      `json:"modelCalls"`
	FirstCtx   *int     `json:"firstCtx"`
	PeakCtx    *int     `json:"peakCtx"`
	TokensIn   int64    `json:"tokensIn"`
	TokensOut  int64    `json:"tokensOut"`
	Subagents  int      `json:"subagents"`
}

Usage is what the session cost.

Jump to

Keyboard shortcuts

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