Documentation
¶
Overview ¶
Package agentrun orchestrates the coding-agent stage inside the Job pod: render the prompt, drive the harness under a token-budget kill switch, and report the stage as an envelope event on stdout. The investigate phase runs the analysis and emits the verdict without ever deciding continuation; the remediate phase executes a controller-provided analysis, then verifies and packages the resulting changeset.
The runner trusts the repository over the agent: a remediation report claiming success is downgraded unless commit.sh ran cleanly and left real commits on the branch. It never talks to a forge — the pod has no forge credentials by design; the controllers own every side effect.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent drives the stages.
type Config ¶
type Config struct {
Workspace string
Repo string
// Finding names the owning Finding resource; events echo it so the
// controller can key them.
Finding string
// BaseSHA is the remote commit the workspace tree corresponds to. The
// local git base is a synthetic commit over the artifact tarball, so the
// changeset's push base must come from here instead.
BaseSHA string
Phase Phase
// InvestigateHarness/RemediateHarness are the harness ids the stages run
// on, resolved controller-side from the stage model and passed per-Job.
InvestigateHarness string
RemediateHarness string
// InvestigateModel/RemediateModel are canonical provider-qualified model
// ids (e.g. "anthropic/claude-sonnet-5"). The controller resolves the
// harness and clamps the remediation model to the allowlist before the
// Job is created, so these already match the runner image the pod is in.
InvestigateModel string
RemediateModel string
// ModelAllowlist is the canonical model ids the investigation may suggest
// for remediation; rendered into the analysis prompt.
ModelAllowlist []string
// The investigation stage's limits are absolute: it runs on exactly
// these. The remediation stage's are ceilings — the investigation
// requests its own max_turns and token_budget, and Agent.clamp holds
// those requests to these bounds.
InvestigateMaxTurns int
InvestigateTokenBudget int
RemediateMaxTurns int
RemediateTokenBudget int
InvestigateTimeout time.Duration
RemediateTimeout time.Duration
// ChangesetMaxBytes caps the cumulative raw content of the changeset the
// remediation stage may emit.
ChangesetMaxBytes int
// Out receives the envelope events (stdout in the pod).
Out io.Writer
Log *slog.Logger
}
Config is the runner's configuration; in the pod every field arrives as PATCHY_* environment (see FromEnv).