Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/onenot8/issueLoop/llms.txt

Use this file to discover all available pages before exploring further.

The IssueLoop Go client wraps the IssueLoop HTTP bridge with typed methods for the most common operations, plus a generic RPC method that gives you access to every function in the Python API. The Go package is a pure HTTP client — it does not embed Python or require any native dependencies beyond the standard library.

Installation

The module path comes from go.mod:
module github.com/onenot8/issueLoop/clients/go
Add the package to your Go module with:
go get github.com/onenot8/issueLoop/clients/go/issueloop

Creating a client

Import the package and call NewClient. Pass an empty string to use the default address (http://127.0.0.1:8787), or supply a full base URL to connect to a custom host or port.
import "github.com/onenot8/issueLoop/clients/go/issueloop"

// Default: http://127.0.0.1:8787
client := issueloop.NewClient("")

// Custom port
client := issueloop.NewClient("http://127.0.0.1:9000")
NewClient returns a *Client configured with a 30-second HTTP timeout. The underlying http.Client is exposed as client.HTTP if you need to override it.

The Ticket struct

All ticket-returning methods use the Ticket struct, which maps directly to the JSON shape returned by the server:
type Ticket struct {
    ID                string  `json:"id"`
    Repo              string  `json:"repo"`
    Priority          string  `json:"priority"`
    Status            string  `json:"status"`
    ErrorSummary      string  `json:"error_summary"`
    RawLogRef         string  `json:"raw_log_ref"`
    Command           *string `json:"command"`
    TestID            *string `json:"test_id"`
    Attempts          int     `json:"attempts"`
    EscalationSummary *string `json:"escalation_summary"`
    ProposedFix       *string `json:"proposed_fix"`
    CreatedAt         string  `json:"created_at"`
    ResolvedAt        *string `json:"resolved_at"`
    DispensedAt       *string `json:"dispensed_at"`
}
Optional fields (Command, TestID, EscalationSummary, ProposedFix, ResolvedAt, DispensedAt) are pointer types so you can distinguish between “not set” and a zero value.

Typed methods

The client provides typed methods covering the core ticket workflow and the most frequently used API functions.

Health & config

// Health checks the /health REST endpoint.
// Returns map[string]string{"status": "ok"} when the server is up.
func (c *Client) Health() (map[string]string, error)

// HealthCheck runs the Python-side internal health check via RPC.
func (c *Client) HealthCheck() (map[string]interface{}, error)

// ListRepos returns all repo names known to the database.
func (c *Client) ListRepos() ([]string, error)

Ticket lifecycle

// GetTopError claims and returns the highest-priority pending ticket for repo.
// Returns nil (not an error) when there are no pending tickets.
func (c *Client) GetTopError(repo string) (*Ticket, error)

// GetAllErrors returns every open ticket for repo.
func (c *Client) GetAllErrors(repo string) ([]Ticket, error)

// Resolve marks a ticket as resolved.
func (c *Client) Resolve(ticketID string) error

// Fail marks a ticket as failed.
func (c *Client) Fail(ticketID string) error

Bug query

// GetAllBugs returns all tickets for repo via RPC.
func (c *Client) GetAllBugs(repo string) ([]Ticket, error)

// GetUnresolvedBugs returns tickets that are not yet done or failed.
func (c *Client) GetUnresolvedBugs(repo string) ([]Ticket, error)

// GetBug fetches a single ticket by its ID.
func (c *Client) GetBug(ticketID string) (*Ticket, error)

Scan & test

// ScanRepo builds a file inventory for the directory at repoPath.
func (c *Client) ScanRepo(repoPath string) (map[string]interface{}, error)

// RunTests runs test_manifest.json commands for repoName and returns results.
func (c *Client) RunTests(repoName string) ([]map[string]interface{}, error)

// CreateTickets splits failing log entries for repoName into tickets via LLM.
func (c *Client) CreateTickets(repoName string) ([]Ticket, error)

Fix-apply

// Escalate escalates a ticket with a human-readable reason string.
func (c *Client) Escalate(ticketID string, reason string) (*Ticket, error)

// ProposeFix stores a proposed patch or shell command on a ticket.
func (c *Client) ProposeFix(ticketID string, patchOrCommand string) (*Ticket, error)

// ApplyFix applies the stored fix and re-runs the ticket's associated test.
func (c *Client) ApplyFix(ticketID string) (map[string]interface{}, error)

// CheckPermission reports whether cmd is on the allowlist for repo.
func (c *Client) CheckPermission(cmd string, repo string) (bool, error)

Database & maintenance

// GetDatabaseStats returns size and record counts for repo.
func (c *Client) GetDatabaseStats(repo string) (map[string]interface{}, error)

// Cleanup deletes resolved/failed tickets older than olderThanDays days.
// Pass nil for olderThanDays to use the server-side default.
// Returns the number of tickets removed.
func (c *Client) Cleanup(olderThanDays *int, repo string) (int, error)
Putting it together — a typical workflow:
client := issueloop.NewClient("")

// Confirm the server is reachable
if _, err := client.Health(); err != nil {
    log.Fatalf("issueloop server not available: %v", err)
}

// Claim the next ticket
ticket, err := client.GetTopError("myrepo")
if err != nil {
    log.Fatal(err)
}
if ticket == nil {
    fmt.Println("no pending tickets")
    return
}

fmt.Printf("[%s] %s\n", ticket.Priority, ticket.ErrorSummary)

// ... apply your fix logic ...

if err := client.Resolve(ticket.ID); err != nil {
    log.Fatal(err)
}

Generic RPC

RPC calls any Python API function by name and unmarshals the result into an arbitrary out value. This covers the full issueloop.__all__ surface — everything not already wrapped by a typed method.
func (c *Client) RPC(name string, params map[string]interface{}, out interface{}) error
ParameterDescription
namePython function name, e.g. "get_unresolved_bugs"
paramsMap of keyword arguments matching the Python function’s parameters
outPointer to the Go value to unmarshal the result into; pass nil to discard
The server returns {"result": ..., "error": "...", "error_type": "..."}. RPC returns a non-nil error if either the HTTP request fails or the server returns an error field. Example — call get_unresolved_bugs:
var bugs []issueloop.Ticket
err := client.RPC(
    "get_unresolved_bugs",
    map[string]interface{}{"repo": "myrepo"},
    &bugs,
)
if err != nil {
    log.Fatal(err)
}

for _, b := range bugs {
    fmt.Printf("%s  %s\n", b.ID, b.ErrorSummary)
}
Example — call search_bugs:
var results []issueloop.Ticket
err := client.RPC(
    "search_bugs",
    map[string]interface{}{
        "repo":  "myrepo",
        "query": "AttributeError",
    },
    &results,
)
Example — call export_bugs and discard the result:
err := client.RPC(
    "export_bugs",
    map[string]interface{}{"repo": "myrepo", "path": "/tmp/bugs.json"},
    nil,
)
The Go client requires the Python IssueLoop server to be running first. Start it with issueloop serve (or issueloop serve --port <n> for a custom port) before creating a Client. See the HTTP Server page for server startup details and the full list of available RPC function names.

Build docs developers (and LLMs) love