Help us shape the future of Go! Take the 2026 Go Developer Survey

worker

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneIfMissing

func CloneIfMissing(ctx context.Context, repoPath, remote string) error

CloneIfMissing runs `git clone remote repoPath` if repoPath does not exist. CloneIfMissing runs `git clone remote repoPath` if repoPath does not exist. Only http/https/ssh/git URL schemes are permitted to prevent git ext:: injection.

func PostCheckpointWithRetry

func PostCheckpointWithRetry(c *client.Client, ticketID string, phase, sha string, maxAttempts int) error

PostCheckpointWithRetry calls client.PostCheckpoint with up to maxAttempts total attempts (using the client's built-in exponential-backoff retry logic). It temporarily overrides the client's RetryAttempts field, restoring it on return so the client remains usable for other calls.

func ReconstructState

func ReconstructState(ticketDir, worktreePath string, claim *client.ClaimResponse) error

ReconstructState writes state.json and log.jsonl into ticketDir from the data carried in the ClaimResponse. The directory is created if absent. worktreePath is the expected worktree path for the ticket (used by ticket.Load).

func RecoverTicket

func RecoverTicket(ctx context.Context, claim *client.ClaimResponse, cfg *config.Config) error

RecoverTicket ensures the local repo is in the correct state for resuming a checkpointed ticket, then reconstructs the ticket's local state files. Idempotent: safe to call on an already-present worktree.

Types

type Executor

type Executor interface {
	RunTicket(ctx context.Context, cfg *config.Config, c *client.Client, claim *client.ClaimResponse) error
}

Executor is the interface for running a ticket.

type GolemExecutor

type GolemExecutor struct {
	// contains filtered or unexported fields
}

GolemExecutor runs tickets phase by phase with human approval gates.

func (*GolemExecutor) RunTicket

func (e *GolemExecutor) RunTicket(ctx context.Context, cfg *config.Config, c *client.Client, claim *client.ClaimResponse) error

RunTicket executes a claimed ticket:

  1. Pre-creates the local ticket with `golem ticket new` (scaffolding only, no Claude).
  2. Ensures the repo is initialized and the code graph is current.
  3. Runs three separate `claude --print` sessions — brainstorm, plan, implement — pausing between brainstorm→plan and plan→implement for human approval via the orchestrator UI. Tickets are NOT closed automatically; humans close via the UI.

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

Worker polls for available tickets, claims them, and runs them via Executor.

func New

func New(cfg *config.Config, c *client.Client, exec Executor) *Worker

New creates a new Worker. exec may be nil for testing (skips actual execution).

func (*Worker) HandleMessage

func (w *Worker) HandleMessage(msg ws.WSMessage)

HandleMessage processes a WebSocket push message from the orchestrator.

func (*Worker) SetWSClient

func (w *Worker) SetWSClient(wsc *client.WSClient)

SetWSClient attaches a WebSocket client for heartbeat pings.

func (*Worker) Shutdown

func (w *Worker) Shutdown()

Shutdown signals all running tickets to stop, waits up to 10 minutes for them to exit, then closes the stop channel and deregisters from the orchestrator.

func (*Worker) Start

func (w *Worker) Start()

Start registers with the orchestrator, resumes any in-progress tickets from before a restart, then begins the poll loop. It does not block.

Jump to

Keyboard shortcuts

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