actioncontinuation

package
v1.13.10-rc.2 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package actioncontinuation stores local, payload-free approval suspension records and exact-once resume leases. The authority owns approval votes and certificates; this package owns only the node-side fact that a particular adapter action may be attempted at most once after approval.

Index

Constants

View Source
const (
	SchemaVersion  uint16 = 1
	MaxRecordBytes        = 64 << 10
)

Variables

View Source
var (
	ErrNotFound       = errors.New("actioncontinuation: continuation not found")
	ErrConflict       = errors.New("actioncontinuation: continuation conflict")
	ErrAlreadyClaimed = errors.New("actioncontinuation: continuation already claimed")
	ErrExpired        = errors.New("actioncontinuation: continuation expired")
)

Functions

func Fingerprint

func Fingerprint(tenantID, agentID, action, resource, payloadHash, adapterID, resumeToken string) string

Fingerprint is deterministic for the exact side effect and local resume token. None of its inputs are recoverable from the resulting identifier.

func RecordID

func RecordID(fingerprint, transactionID string) string

RecordID adds the authority transaction identity, allowing a later, intentional repetition of the same side effect to open a new workflow after the prior one completed without overwriting its evidence.

Types

type Record

type Record struct {
	Version             uint16                       `json:"version"`
	ID                  string                       `json:"id"`
	Fingerprint         string                       `json:"fingerprint"`
	TenantID            string                       `json:"tenant_id"`
	AgentID             string                       `json:"agent_id"`
	ActionID            string                       `json:"action_id"`
	Action              string                       `json:"action"`
	Resource            string                       `json:"resource"`
	PayloadHash         string                       `json:"payload_hash"`
	AdapterID           string                       `json:"adapter_id"`
	ResumeToken         string                       `json:"resume_token"`
	InitialDecision     actionhook.DecisionReference `json:"initial_decision"`
	ApprovalTransaction string                       `json:"approval_transaction_id"`
	State               State                        `json:"state"`
	CreatedAt           int64                        `json:"created_at"`
	ExpiresAt           int64                        `json:"expires_at"`
	AttemptedAt         int64                        `json:"attempted_at,omitempty"`
	FinishedAt          int64                        `json:"finished_at,omitempty"`
	FailureCode         string                       `json:"failure_code,omitempty"`
}

Record contains no payload, prompt, secret, local path, or peer address. ResumeToken is adapter-local and never uploaded to the authority.

func NewPending

func NewPending(tenantID, agentID string, envelope actionhook.Envelope, reference actionhook.DecisionReference, transactionID string, expiresAt time.Time) (Record, error)

NewPending constructs the canonical continuation identity. ActionID is the original hook action ID for trace correlation; it is not used for lookup, because a later process creates a new envelope ID when resuming.

func (Record) Validate

func (record Record) Validate() error

type State

type State string
const (
	StatePending   State = "pending"
	StateExecuting State = "executing"
	StateSucceeded State = "succeeded"
	StateFailed    State = "failed"
	StateInvalid   State = "invalid"
)

type Store

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

func Open

func Open(directory string) (*Store, error)

func (*Store) ClaimResume

func (store *Store) ClaimResume(ctx context.Context, id string) (Record, string, error)

ClaimResume atomically publishes an exclusive lease before returning a permit. A crash after this point is fail-closed: the lease is intentionally never deleted, so the side effect cannot be attempted twice ambiguously.

func (*Store) FindActive

func (store *Store) FindActive(ctx context.Context, fingerprint string) (Record, error)

FindActive returns the one continuation that still controls an exact side effect. Successful records are historical and do not prevent a deliberate later repetition. Pending, executing, and failed records remain active; a failed/ambiguous execution therefore needs a different adapter resume token before it can be attempted again.

func (*Store) Finish

func (store *Store) Finish(ctx context.Context, id, leaseToken string, succeeded bool, failureCode string) (Record, error)

func (*Store) Get

func (store *Store) Get(ctx context.Context, id string) (Record, error)

func (*Store) PutPending

func (store *Store) PutPending(ctx context.Context, candidate Record) (Record, error)

PutPending uses an exclusive create, so two CLI processes cannot replace each other's approval transaction for the same exact action.

Jump to

Keyboard shortcuts

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