killswitch

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 11 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 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

View Source
const AnnotationSource = "agents.ogenki.io/stop-source"

AnnotationSource marks a stop object the control-issue poller made, so that only it lifts it.

View Source
const ConfigMap = "agent-factory-stop"

ConfigMap is the stop object's name, in the factory's namespace. Its content is ignored.

View Source
const SourceIssue = "control-issue"

SourceIssue is the AnnotationSource of the stop object the poller publishes.

Variables

This section is empty.

Functions

func Engaged

func Engaged(ctx context.Context, c client.Reader, ns string) (bool, error)

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

func PublishIssue(ctx context.Context, c client.Client, ns string, on bool) error

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

func (s *Sweeper) NeedLeaderElection() bool

NeedLeaderElection is true: only the leader sweeps; two would race the same deletes.

func (*Sweeper) Start

func (s *Sweeper) Start(ctx context.Context) error

Start sweeps at once, then every Every, until ctx ends. A failed sweep is logged and the next one retries.

func (*Sweeper) Sweep

func (s *Sweeper) Sweep(ctx context.Context) ([]runs.Run, error)

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).

Jump to

Keyboard shortcuts

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