statuscomment

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package statuscomment posts agent start/completion status comments on issues and pull requests via the forge abstraction.

Unlike internal/sticky, which manages persistent bot comments that accumulate history across multiple runs (e.g. review output), statuscomment manages transient lifecycle markers: a start comment created when the agent begins, updated or replaced on completion, and deleted on cancellation. The two packages share the HTML-marker convention but have different lifecycles and placement heuristics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notifier

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

Notifier manages status comment lifecycle for a single agent run.

func New

func New(client forge.Client, cfg config.StatusNotificationConfig,
	owner, repo string, number int, runURL, sha, runID string) *Notifier

New creates a Notifier. The runID is embedded in the HTML marker comment so multiple concurrent runs on the same issue don't collide.

func (*Notifier) PostCompletion

func (n *Notifier) PostCompletion(ctx context.Context, description, status string) error

PostCompletion posts or edits a completion comment. status should be "success", "failure", or "cancelled".

Cancellation deletes the start comment (if one exists), leaving no trace on the timeline. No completion comment is posted.

For success/failure, placement follows three rules:

  1. If the agent posted output after the start comment (a bot-authored comment that is not a status marker), the start comment is updated in place — the agent's output is the visible forward signal and a separate end comment would be redundant.
  2. If no agent output was posted and the start comment is still the last entry on the timeline, the start comment is updated in place.
  3. Otherwise (other activity pushed past the start, but no agent output), a new completion comment is posted so the user sees the result while reading forward.

func (*Notifier) PostStart

func (n *Notifier) PostStart(ctx context.Context, description string) error

PostStart posts a start comment on the issue/PR.

func (*Notifier) SetWarnFunc

func (n *Notifier) SetWarnFunc(f func(string, ...any))

SetWarnFunc sets a function called for non-fatal warnings (e.g. API errors during fail-open operations). Defaults to a no-op.

Jump to

Keyboard shortcuts

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