Skip to main content

Module poll

Module poll 

Source
Expand description

Single-tick orchestration for the supervisor auto-approve poll loop.

Exposes poll_tick — given a broker state, a session name, a pane-index resolver, and an AutoApproveConfig, it:

  1. Detects stalled agents via super::stall::detect_stalled_agents.
  2. Captures each stalled agent’s pane via super::permission_prompt::detect_permission_prompt.
  3. For safe-classified prompts, dispatches BTab Down Enter via super::approve::auto_approve_pane.
  4. For Unknown prompts, forwards a question to the dashboard inbox so the human can resolve it.

The loop driver lives in main.rs (background thread spawned by cmd_supervisor); this module keeps the per-tick logic pure and testable.

Structs§

AgentStatusRow
Subset of an agent record returned by the broker /status endpoint that the supervisor poll loop cares about.
PollContext
Inputs for poll_tick.
TmuxPaneInspector
Production PaneInspector backed by tmux capture-pane.

Enums§

TickOutcome
Outcome of processing a single stalled agent during a poll tick.

Traits§

PaneInspector
Trait providing the captured pane content for an agent.
PaneResolver
Trait providing the pane-index for a given agent ID.
QuestionForwarder
Forwarder for unsafe prompts — abstracted so tests can record forwards.
WorktreeResolver
Trait providing the worktree root path for a given agent ID.

Functions§

fetch_status_over_http
Fetches the broker /status endpoint and returns the agent summary.
poll_tick
Runs one tick of the auto-approve poll loop and returns the outcome for each stalled agent (in iteration order).
stalled_from_status
Returns the IDs of agents whose status is non-terminal and whose last_seen_seconds is at or above threshold_seconds.
tick_from_status
Runs one tick driven by an HTTP /status snapshot rather than an in-process BrokerState.