Documentation
¶
Overview ¶
Package killswitch is the factory's own stop layer (§6.1): a ConfigMap deliberately not in Git, which Flux never reverts. The other layers (the runs quota, the App) do not depend on the factory.
Index ¶
Constants ¶
const AnnotationSource = "agents.ogenki.io/stop-source"
AnnotationSource marks a stop object the control-issue poller made, so that only it lifts it.
const ConfigMap = "agent-factory-stop"
ConfigMap is the stop object's name, in the factory's namespace. Its content is ignored.
const SourceIssue = "control-issue"
SourceIssue is the AnnotationSource of the stop object the poller publishes.
Variables ¶
This section is empty.
Functions ¶
func Engaged ¶
Engaged reports whether the stop object exists. Callers pause intake on an error too, but stop tasks only on a definite yes: a transient API error must not revoke every run.
func PublishIssue ¶
PublishIssue makes the control issue's stop visible to every replica (#53). Only the leader polls the issue, but the run API and RunLore intake serve on every replica, and each reads the stop object: the poller creates it when the label is on and deletes it when the label is off, but only an object it made. A stop a human set by hand is never lifted by the label. The object outlives the leader, so a new leader's first poll reconciles it either way.
Types ¶
type RunStore ¶
type RunStore interface {
List(ctx context.Context) ([]runs.Run, error)
Annotate(ctx context.Context, id string, kv map[string]string) error
Delete(ctx context.Context, id string) error
}
RunStore is the part of the AgentRun client the sweep uses; runs.Client implements it.
type Sweeper ¶
type Sweeper struct {
Reader client.Reader
Namespace string
Runs RunStore
// Release drops a deleted run's reservation from the day's ledger (#55): a claim deleted
// while live never reaches the terminal phase the meter releases on. nil: the meter's
// unclaimed sweep releases it after its grace.
Release func(ctx context.Context, r runs.Run) error
Every time.Duration
// OnSweep is told of the runs a sweep revoked, each to count under its payer.
OnSweep func(revoked []runs.Run)
Log *slog.Logger
}
Sweeper is the stop's reach over every run (owner, 2026-09-27; R35). The reconciler stops tasks; this revokes and deletes every live AgentRun in agents, human-requested ones included, since after phase 5 the factory created them all. Only on a definite yes: a transient API error never revokes a run.
func (*Sweeper) NeedLeaderElection ¶
NeedLeaderElection is true: only the leader sweeps; two would race the same deletes.
func (*Sweeper) Start ¶
Start sweeps at once, then every Every, until ctx ends. A failed sweep is logged and the next one retries.
func (*Sweeper) Sweep ¶
Sweep revokes and deletes every non-terminal run while the stop is engaged: the annotation first, so the composition sees the revoke even if the delete then fails. A run already gone mid-sweep is done, not an error. It returns the runs it revoked: a run that already carried a revoke, such as one the task reconciler's stop revoked seconds earlier, was counted by whoever wrote it (F30).