budget

package
v0.1.0-proto2m Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package budget derives the supervisor's start deadlines from one measured table (GAPI-DIV-107).

ONE CONSTANT USED TO BOUND TWO DEADLINES THAT BEHAVE NOTHING ALIKE. core/lifecycle.Controller.WaitStart was 10s for every agent of every language and type, and it expressed only the second of the two intervals a start actually contains:

  • exec to first control frame. The ADK coming up. The supervisor CAN know it, it barely varies, and it is language-dependent.
  • first frame to RUNNING. The agent's own start(). Application code the supervisor has never seen, and therefore unbounded.

Two phenomena, so two policy multipliers over ONE measured table (operator decision 63). A second measured table would be the duplication decision 43(1) forbids - "reusing (3)'s derivation rather than duplicating it" is honoured by the floor, not by the factor. A single shared value would make decision 43(3)'s "much tighter" vacuous by making the two numbers equal, which re-creates exactly the defect this entry names.

This package imports nothing but the standard library, on purpose. core/lifecycle owns the waits, core/agentmgr owns the instrument, and core/schema owns the declaration; all three need the derivation, and a leaf package adds no edge between any of them.

Index

Constants

View Source
const (

	// Ceiling is the supervisor-owned MAXIMUM a descriptor may declare.
	// Decision 43(2) is explicit that this is not a default and must not
	// be spelled as one: boot targets (decision 5) mean a single agent
	// declaring 24h holds a phase open forever.
	//
	// The value is 1.6x the slowest derived default (python, 37.2s), so
	// no language's default can ever exceed it, while still admitting an
	// agent that is genuinely slow to become ready. It is deliberately
	// well under core/config.TestAgentStartTimeout's 120s, which leaves
	// the harness slack by construction - see that constant.
	Ceiling = 60 * time.Second

	// Spawn bounds the runner's Start CALL: fork, exec, pipe and socket
	// setup. It is not the readiness budget and it is not the silence
	// budget.
	//
	// PRESERVED, NOT DERIVED. This entry measured exec-to-first-frame
	// and first-frame-to-RUNNING; it did not measure the exec call
	// itself, so there is no measurement here to derive from. WaitStart
	// was doing this job as a second job (see core/lifecycle), and
	// carrying its 10s across unchanged is the only move that adds no
	// invented number and changes no behaviour. It is deliberately NOT
	// per-agent: a descriptor declaring a short readiness budget is
	// asking for its own start() to be judged sooner, not for fork/exec
	// to be given less time.
	Spawn = 10 * time.Second
)

Variables

This section is empty.

Functions

func CheckDeclared

func CheckDeclared(agentID string, declared time.Duration) error

CheckDeclared refuses a declaration the supervisor will not honour.

AT DECLARATION TIME, NOT AT START. The exit calls for "a declaration-time refusal of a budget above the ceiling", and that is the difference between a config that cannot be valid failing to build and one failing at 3am.

func DefaultReadinessBudget

func DefaultReadinessBudget(lang string) time.Duration

DefaultReadinessBudget is what an agent that declares nothing gets: the per-language measured floor times the safety factor, per decision 43(1) as amended by decision 51. Declaring is how an agent asks for something else.

func Resolve

func Resolve(lang string, declared *time.Duration) time.Duration

Resolve is the one place a declared budget becomes an effective one. A nil declaration means ABSENT, which is distinct from zero and is why the parameter is a pointer.

func SilenceBudget

func SilenceBudget(lang string) time.Duration

SilenceBudget is how long a spawned child may write NOTHING to its control descriptor before the supervisor calls it silent rather than slow (GAPI-DIV-104's discriminator, GAPI-DIV-107's tighter deadline).

Types

type AboveCeiling

type AboveCeiling struct {
	AgentID  string
	Declared time.Duration
	Ceiling  time.Duration
}

AboveCeiling is a declared readiness budget exceeding the supervisor's maximum, as data rather than as a sentence. It names the declared value, the ceiling and the agent, because an operator reading it needs to know which agent to edit and what the bound is.

func (*AboveCeiling) Error

func (e *AboveCeiling) Error() string

type NotPositive

type NotPositive struct {
	AgentID  string
	Declared time.Duration
}

NotPositive is a declared readiness budget of zero or less. Zero is not absence - absence is the field not being there at all - so a declared zero is an author saying something they cannot have meant.

func (*NotPositive) Error

func (e *NotPositive) Error() string

Jump to

Keyboard shortcuts

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