Skip to content

Executor

Translates DecisionMessage actions into GitHub API calls.

The harness executes all GitHub API calls — agents only produce action lists. Credentials never enter agent containers.

CLASS DESCRIPTION
GitHubExecutor

Translates a :class:~foreman.protocol.DecisionMessage into GitHub API calls.

UnknownActionError

Raised when a DecisionMessage contains an unrecognized action type.

Classes

GitHubExecutor

GitHubExecutor(token: str, memory: MemoryStore)

Translates a :class:~foreman.protocol.DecisionMessage into GitHub API calls.

Logs the decision to the memory store before executing any GitHub API call, so the record exists even if a downstream call fails.

PARAMETER DESCRIPTION
token

GitHub Personal Access Token for the bot account.

TYPE: str

memory

:class:~foreman.memory.MemoryStore used to log decisions.

TYPE: MemoryStore

METHOD DESCRIPTION
execute

Execute all actions in decision, logging the decision first.

Functions

execute
execute(decision: DecisionMessage, repo: str, issue_number: int, task_type: str = 'issue.triage', allow_close: bool = False) -> None

Execute all actions in decision, logging the decision first.

Writes the decision record to action_log before any GitHub API call is attempted. Actions are executed in the order they appear in :attr:~foreman.protocol.DecisionMessage.actions.

PARAMETER DESCRIPTION
decision

The agent's decision message containing actions to run.

TYPE: DecisionMessage

repo

Repository in owner/repo format.

TYPE: str

issue_number

GitHub issue number targeted by this decision.

TYPE: int

task_type

Task type string stored in action_log.

TYPE: str DEFAULT: 'issue.triage'

allow_close

Whether close_issue actions are permitted.

TYPE: bool DEFAULT: False

RAISES DESCRIPTION
UnknownActionError

If any action has an unrecognized type.

UnknownActionError

Bases: Exception

Raised when a DecisionMessage contains an unrecognized action type.