Documentation
¶
Overview ¶
Package remedctrl is the remediation-controller's engine: it picks up context-enhanced findings past the accumulation window, runs the coding agent in an ephemeral Kubernetes Job, and performs every GitHub side effect on the agent's behalf — the agent pod has no GitHub credentials.
The controller consumes the runner's envelope events: a classification event lands the report, the severity/priority/recommendation labels and the routing decision (dismiss the alerts and close, assign a human, or let the same pod continue into remediation); a remediation event pushes the agent's branch and opens the pull request. Merging stays human; the merge webhook closes the issue.
Every write is driven by a fresh read of the issue's labels, so redeliveries, restarts, and the reconcile sweep converge on the same state — GitHub remains the only state store.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clients ¶
type Clients interface {
For(ctx context.Context, repo ghclient.Repo) (Stores, error)
All(ctx context.Context) ([]Searcher, error)
// CloneToken mints a contents:read token for repo.
CloneToken(ctx context.Context, repo ghclient.Repo) (string, error)
// PushToken mints a contents:write token for repo.
PushToken(ctx context.Context, repo ghclient.Repo) (string, error)
}
Clients resolves GitHub access and mints the short-lived, single-repo tokens the Job's init container clones with.
type Config ¶
type Config struct {
// MinAge is how old an issue must be before remediation picks it up —
// DESIGN's "older than one hour" gate, belt-and-braces with the
// accumulation label. Default one hour.
MinAge time.Duration
// MaxAttempts bounds Job retries per issue before it is handed to a
// human. Default 2.
MaxAttempts int
// ApproveCommand is the issue comment forcing a remediation attempt.
ApproveCommand string
}
Config tunes the controller.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is the remediation-controller engine; it implements webhook.Handler.
type Pusher ¶
type Pusher interface {
Push(ctx context.Context, repo ghclient.Repo, cloneURL, token, branch string, bundle []byte) error
}
Pusher applies an agent's changeset to GitHub: it fetches the bundle into a scratch clone and pushes the branch with a short-lived write token. Kept behind an interface so the controller stays testable without git.
type Runner ¶
type Runner interface {
Create(ctx context.Context, spec jobs.Spec) (string, error)
Follow(ctx context.Context, job string, fn func(envelope.Event) error) error
Result(ctx context.Context, job string) ([]envelope.Event, error)
Status(ctx context.Context, job string) (jobs.Status, error)
List(ctx context.Context) ([]jobs.Owned, error)
Delete(ctx context.Context, job string) error
}
Runner creates and observes the agent Jobs.
type Searcher ¶
type Searcher interface {
SearchIssues(ctx context.Context, query string) ([]*ghclient.Issue, error)
}
Searcher runs cross-repository issue searches within one installation.
type Stores ¶
type Stores interface {
ghclient.IssueStore
ghclient.AlertStore
ghclient.RepoStore
}
Stores is the per-repository GitHub surface the controller mutates.