healthfix

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package healthfix decides the health sweep's duplicate fixes (hadron-cli #2027). It is pure over what the sweep observed — agent processes, terminal tabs, the reset and pause guards — so every rule of the issue's acceptance and the gate's edge limits is a table row here, not a wiring path.

The guards this package owns, from the issue and Xabat's CHECKED gate:

  • the only agent is never stopped (nothing to decide below two agents);
  • exactly one supervised agent: the others are stopped; none supervised: nothing is stopped and one alert is raised (the issue's "keep the oldest and report it" names the keeper for the report; the acceptance line "two unsupervised agents: nothing stopped, one alert" is the oracle); two or more supervised is an anomaly that fails closed to an alert;
  • a bare-shell tab closes only when another, non-bare-shell tab of the same worktree remains — a worktree whose every tab is a bare shell is a no_agent report (relaunch is #1947's), and a tab running an agent never positively classifies bare shell in the first place;
  • a resetting worker is skipped entirely and rechecked next sweep;
  • under a team pause the fixes are decided but the worker is marked so the caller reports without applying.

Index

Constants

View Source
const (
	StopAgent = "stop-agent"
	CloseTab  = "close-tab"
)

Actions.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	PID        int
	Base       string // claude | codex
	Display    string // the redacted, bounded #1474 line
	Supervised bool
	StartTicks int64 // /proc start-time ticks; bigger means started later
}

Agent is one agent process the census found in a worktree.

type Alert

type Alert struct {
	Worker string
	Code   string // unsupervised-agents | multiple-supervised
	Count  int
}

Alert is a condition the sweep reports but does not act on.

type Fix

type Fix struct {
	Worker  string
	Action  string // stop-agent | close-tab
	Subject string
}

Fix is one would-be fix. The caller marks whether it was applied.

type Mode

type Mode struct {
	Applying bool
	Paused   bool
}

Mode is the sweep's posture.

type Plan

type Plan struct {
	Fixes  []Fix
	Alerts []Alert
	Skips  []Skip
}

Plan is what one worktree's observation adds up to.

func Decide

func Decide(w Worktree, m Mode) Plan

Decide turns one worktree's observation into its plan. It never stops the only agent, never proposes a close that would empty the worktree of agent tabs, and never proposes anything for a resetting worker.

type Skip

type Skip struct {
	Worker string
	Code   string // resetting | team-paused
}

Skip is a worker the sweep deliberately left alone, and why.

type Tab

type Tab struct {
	ID        string
	BareShell bool
}

Tab is one terminal tab of a worktree. BareShell is true only on positive evidence: every terminal in the tab classified bare shell.

type Worktree

type Worktree struct {
	WorkerID   string
	WorkerName string
	Path       string
	Agents     []Agent
	Tabs       []Tab
	Resetting  bool
}

Worktree is one bound-worker worktree's observation.

Jump to

Keyboard shortcuts

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