Documentation
¶
Overview ¶
Package waitregistry records outstanding delegated waits so that someone other than the waiting process can see them.
A wait that exists only as a background process in one harness's memory has moved the "did anyone remember this?" problem rather than solved it: an agent that correctly delegates its waiting goes quiet, and a quiet session is indistinguishable from a crashed one. The only recourse available to a watching human is to interrupt, which destroys the quiet that delegating the wait exists to create.
This is deliberately not a watch service. It stores no events, delivers nothing, and wakes nobody. It answers one question — what is this session waiting for, since when, and how would it resume — and forgets the answer when the wait ends.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAlive ¶ added in v0.172.0
DefaultAlive reports whether a process still exists. It delegates to WB's existing per-platform liveness check rather than reimplementing one: an earlier hand-rolled version used Process.Signal(nil), which always fails Go's signal type assertion, so every live waiter was reported as stale.
It is List's liveness check when Options.Alive is nil. Callers that need a different answer — tests deciding liveness without spawning processes — set Options.Alive instead of replacing this function: liveness is an injected dependency, not mutable package state, so parallel tests never race on it.
Types ¶
type Options ¶ added in v0.172.0
type Options struct {
// Alive reports whether a process still exists. Nil defaults to
// DefaultAlive, the real OS check.
Alive func(pid int) bool
}
Options configures registry behaviour that differs between production and tests. The zero value is production behaviour.
type Record ¶
type Record struct {
Schema int `json:"schema"`
ID string `json:"id"`
PID int `json:"pid"`
WBSessionID string `json:"wb_session_id,omitempty"`
Kind string `json:"kind"`
Targets []string `json:"targets"`
Until string `json:"until"`
StartedAt time.Time `json:"started_at"`
Deadline time.Time `json:"deadline,omitempty"`
ResumeArgs []string `json:"resume_args,omitempty"`
// Stale marks a record whose process is gone. It is never persisted; List
// derives it, because a wait that died without clearing its record is
// exactly the thing worth seeing.
Stale bool `json:"stale,omitempty"`
// Provenance fields (wb#631, SDLC logging-gap analysis 2026-09-18): IDs
// only, stamped by Register from the environment at zero cost, never a
// prompt or response body. Additive and omitempty; recordSchema did not
// need to move for a purely additive field.
HarnessSessionID string `json:"harness_session_id,omitempty"`
Harness string `json:"harness,omitempty"`
EffortLevel string `json:"effort_level,omitempty"`
AgentID string `json:"agent_id,omitempty"`
ToolUseID string `json:"tool_use_id,omitempty"`
WBVersion string `json:"wb_version,omitempty"`
}
Record is one outstanding wait. It holds no provider payloads, no credentials, and no prompt text: only what is needed to answer "who is waiting for what, and how does it resume".