agentsession

package
v2.25.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package agentsession owns deferred cleanup of coding-agent provider sessions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessNextCleanup

func ProcessNextCleanup(
	ctx context.Context,
	ownerWorkerID string,
	queue *CleanupQueue,
	repository *persis.DAGRunRepository,
	deleteSession SessionDeleter,
) (bool, error)

ProcessNextCleanup processes one eligible job.

func RunCleanupLoop

func RunCleanupLoop(
	ctx context.Context,
	ownerWorkerID string,
	queue *CleanupQueue,
	repository *persis.DAGRunRepository,
	deleteSession SessionDeleter,
)

RunCleanupLoop processes eligible jobs until ctx is cancelled.

Types

type CleanupJob

type CleanupJob struct {
	Root          ir.DAGRunRef            `json:"root"`
	Resource      ir.AgentSessionResource `json:"resource"`
	ID            string                  `json:"id"`
	ClaimToken    string                  `json:"claimToken,omitempty"`
	ClaimedBy     string                  `json:"claimedBy,omitempty"`
	LastError     string                  `json:"lastError,omitempty"`
	ClaimedAt     int64                   `json:"claimedAt,omitempty"`
	NextAttemptAt int64                   `json:"nextAttemptAt,omitempty"`
	Attempts      int                     `json:"attempts,omitempty"`
}

CleanupJob is a durable request to remove one provider session.

type CleanupQueue

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

CleanupQueue persists provider cleanup until the owning execution host completes it.

func NewCleanupQueue

func NewCleanupQueue(col persis.Collection) *CleanupQueue

NewCleanupQueue creates a cleanup queue backed by col.

func (*CleanupQueue) Claim

func (q *CleanupQueue) Claim(ctx context.Context, ownerWorkerID string, lease time.Duration) (*CleanupJob, error)

Claim reserves the next eligible cleanup job for ownerWorkerID.

func (*CleanupQueue) Complete

func (q *CleanupQueue) Complete(ctx context.Context, ownerWorkerID, id, claimToken string) error

Complete removes a claimed cleanup job.

func (*CleanupQueue) EnqueueDAGRunRemoval

func (q *CleanupQueue) EnqueueDAGRunRemoval(ctx context.Context, root ir.DAGRunRef, resources []ir.AgentSessionResource) error

EnqueueDAGRunRemoval records cleanup for all Dagu-owned sessions retained by root.

func (*CleanupQueue) Release

func (q *CleanupQueue) Release(ctx context.Context, ownerWorkerID, id, claimToken, message string) error

Release records a failed cleanup and makes it eligible for a later retry.

type SessionDeleter

type SessionDeleter func(context.Context, ir.AgentSessionResource) error

SessionDeleter removes one provider resource from its owning host.

Jump to

Keyboard shortcuts

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