Remove resource pools, leases and wait queues

Drop the resource allocation feature end to end: store tables and migration, runner scheduling and cleanup, protocol types and commands, CLI commands, TUI screens, tests and docs. Existing databases open cleanly and definitions carrying a retired resources block still validate.
This commit is contained in:
2026-10-19 22:27:27 +01:00
parent a676b30ff0
commit 72aecd8b1f
45 changed files with 282 additions and 3954 deletions
+15 -34
View File
@@ -3,31 +3,22 @@ package protocol
import "git.a-wan.net/alan/pipelines/internal/buildinfo"
const (
Ping = "ping"
Pong = "pong"
Error = "error"
Submit = "submit"
Submitted = "submitted"
List = "list_pipelines"
PipelineList = "pipelines"
GetPipeline = "get_pipeline"
Pipeline = "pipeline"
ListTemplates = "list_templates"
Templates = "templates"
Validate = "validate"
Validated = "validated"
InspectResource = "inspect_resource"
ResourceInspectionResult = "resource_inspection"
ReconcileResource = "reconcile_resource"
ResourceReconciled = "resource_reconciled"
InspectResourcePool = "inspect_resource_pool"
ResourcePoolInspection = "resource_pool_inspection"
ConfigureResourcePool = "configure_resource_pool"
ResourcePoolConfigured = "resource_pool_configured"
Ping = "ping"
Pong = "pong"
Error = "error"
Submit = "submit"
Submitted = "submitted"
List = "list_pipelines"
PipelineList = "pipelines"
GetPipeline = "get_pipeline"
Pipeline = "pipeline"
ListTemplates = "list_templates"
Templates = "templates"
Validate = "validate"
Validated = "validated"
)
type Stage struct {
Resources *StageResources `json:"resources,omitempty"`
Limits *StageLimits `json:"limits,omitempty"`
Memory map[string]string `json:"memory,omitempty"`
Notify *NotificationPolicy `json:"notify,omitempty"`
@@ -42,12 +33,6 @@ type Stage struct {
Blocks map[string]string `json:"blocks,omitempty"`
}
// StageResources declares one capacity-one resource, local to this store authority.
type StageResources struct {
Exclusive string `json:"exclusive"`
Pool string `json:"pool"`
}
// Limits are enforced by the runner and never included in the model prompt.
type StageLimits struct {
MaxVisits int `json:"max_visits"`
@@ -211,10 +196,6 @@ type Message struct {
// RunEvent is the server-pushed run state delta (see runevents.go) and
// RunIDs the optional subscribe scope, so a client asks for the runs it
// displays. Both are optional so older peers ignore them.
RunEvent *RunEventFrame `json:"run_event,omitempty"`
RunIDs []int64 `json:"run_ids,omitempty"`
Resource string `json:"resource,omitempty"`
ResourceInspection *ResourceInspection `json:"resource_inspection,omitempty"`
ResourceRecovery *ResourceRecoveryRequest `json:"resource_recovery,omitempty"`
ResourcePool *ResourcePool `json:"resource_pool,omitempty"`
RunEvent *RunEventFrame `json:"run_event,omitempty"`
RunIDs []int64 `json:"run_ids,omitempty"`
}
-66
View File
@@ -1,66 +0,0 @@
package protocol
type ResourceInspection struct {
Resource string `json:"resource"`
Owner *ResourceOwner `json:"owner,omitempty"`
Waiters []ResourceWaiter `json:"waiters,omitempty"`
Audits []ResourceRecoveryAudit `json:"audits,omitempty"`
Pool *ResourcePool `json:"pool,omitempty"`
}
// ResourceTarget is bounded, non-secret metadata for the concrete member that
// was selected. Credentials and capabilities are intentionally absent.
type ResourceTarget struct {
Member string `json:"member"`
Metadata map[string]string `json:"metadata,omitempty"`
}
type ResourcePoolMember struct {
Member string `json:"member"`
Metadata map[string]string `json:"metadata,omitempty"`
Enabled bool `json:"enabled"`
Quarantined bool `json:"quarantined,omitempty"`
}
type ResourcePool struct {
Name string `json:"name"`
Members []ResourcePoolMember `json:"members"`
}
type ResourceOwner struct {
RunID int64 `json:"run_id"`
Stage string `json:"stage"`
Sequence int `json:"sequence"`
CleanupConfirmed bool `json:"cleanup_confirmed"`
Quarantined bool `json:"quarantined"`
AgentActive bool `json:"agent_active"`
}
type ResourceWaiter struct {
RunID int64 `json:"run_id"`
Stage string `json:"stage"`
Sequence int `json:"sequence"`
QueuedAt string `json:"queued_at"`
}
type ResourceRecoveryAudit struct {
Resource string `json:"resource"`
RunID int64 `json:"run_id"`
Stage string `json:"stage"`
Sequence int `json:"sequence"`
Actor string `json:"actor"`
Source string `json:"source"`
Evidence string `json:"evidence"`
Result string `json:"result"`
CreatedAt string `json:"created_at"`
}
type ResourceRecoveryEvidence struct {
CleanupConfirmed bool `json:"cleanup_confirmed"`
NoMutatingAction bool `json:"no_mutating_action"`
Summary string `json:"summary"`
}
type ResourceRecoveryRequest struct {
Resource string `json:"resource"`
RunID int64 `json:"run_id"`
Stage string `json:"stage"`
Sequence int `json:"sequence"`
Evidence *ResourceRecoveryEvidence `json:"evidence,omitempty"`
Actor string `json:"actor"`
}
-29
View File
@@ -1,29 +0,0 @@
package protocol
import (
"encoding/json"
"strings"
"testing"
)
func TestResourceWaitOlderClientCompatibility(t *testing.T) {
data, err := json.Marshal(RunSummary{ID: 1, Status: RunStatusQueued, ResourceWait: &ResourceWait{Resource: "X", Stage: "review", Sequence: 2, QueuedSince: "now"}})
if err != nil {
t.Fatal(err)
}
var old struct {
ID int64 `json:"id"`
Status string `json:"status"`
}
if err := json.Unmarshal(data, &old); err != nil || old.Status != "queued" {
t.Fatal("old client no longer waits", old, err)
}
clear, err := json.Marshal(RunEventFrame{RunID: 1, ResourceWaitSet: true})
if err != nil || !strings.Contains(string(clear), `"resource_wait_set":true`) {
t.Fatal("no explicit clear", string(clear), err)
}
var current RunSummary
if err := json.Unmarshal([]byte(`{"id":2,"status":"running"}`), &current); err != nil || current.ResourceWait != nil {
t.Fatal("missing field changed old payload", err)
}
}
+2 -5
View File
@@ -24,11 +24,8 @@ const (
// from the frame instead of re-reading the whole list. They repeat on every
// frame (pipeline identity never changes mid-run).
type RunEventFrame struct {
// ResourceWaitSet makes a nil ResourceWait an explicit cache clear.
ResourceWaitSet bool `json:"resource_wait_set,omitempty"`
ResourceWait *ResourceWait `json:"resource_wait,omitempty"`
RunID int64 `json:"run_id"`
Workspace string `json:"workspace,omitempty"`
RunID int64 `json:"run_id"`
Workspace string `json:"workspace,omitempty"`
// PipelineID, Name, Title and Version identify the run's pipeline and its
// operator-facing title, so a new run's row can be built without a fetch.
PipelineID int64 `json:"pipeline_id,omitempty"`
+8 -31
View File
@@ -118,10 +118,9 @@ type SessionExport struct {
}
type RunSummary struct {
ResourceWait *ResourceWait `json:"resource_wait,omitempty"`
ID int64 `json:"id"`
PipelineID int64 `json:"pipeline_id"`
Name string `json:"name"`
ID int64 `json:"id"`
PipelineID int64 `json:"pipeline_id"`
Name string `json:"name"`
// Title is the operator-facing, bounded single-line description of what the
// run is for, generated from its prompt. It is never empty for a new run;
// historical rows predating the title column may omit it.
@@ -146,19 +145,6 @@ type RunSummary struct {
StageModels map[string]string `json:"stage_models,omitempty"`
}
// ResourceWait is bounded public queue metadata. Ownership credentials stay private.
type ResourceWait struct {
Resource string `json:"resource"`
Stage string `json:"stage"`
Sequence int `json:"sequence"`
QueuedSince string `json:"queued_since"`
}
// ResourceCleanupConfirmedKey lets a stage report failed restoration without
// pretending that tool idleness also proves the resource is ready. An explicit
// false (or malformed value) vetoes release; it never authorizes release alone.
const ResourceCleanupConfirmedKey = "resource_cleanup_confirmed"
// Label is the operator-facing name of a run: the generated Title when the
// server stored one, otherwise the pipeline Name (historical rows predate
// titles). It is the single definition shared by the CLI and TUI.
@@ -169,14 +155,6 @@ func (r RunSummary) Label() string {
return r.Name
}
// StatusLabel separates resource contention from a human decision everywhere.
func (r RunSummary) StatusLabel() string {
if r.ResourceWait != nil {
return "Waiting for resource " + r.ResourceWait.Resource
}
return r.Status
}
type RunStep struct {
Control *ControlEvidence `json:"control,omitempty"`
FileChanges *StageFileChanges `json:"file_changes,omitempty"`
@@ -331,12 +309,11 @@ type MemoryRead struct {
}
type ControlEvidence struct {
Visit int `json:"visit"`
MaxVisits int `json:"max_visits"`
LimitReached bool `json:"limit_reached,omitempty"`
ModelTarget string `json:"model_target,omitempty"`
Memory map[string]MemoryRead `json:"memory,omitempty"`
ResourceTarget *ResourceTarget `json:"resource_target,omitempty"`
Visit int `json:"visit"`
MaxVisits int `json:"max_visits"`
LimitReached bool `json:"limit_reached,omitempty"`
ModelTarget string `json:"model_target,omitempty"`
Memory map[string]MemoryRead `json:"memory,omitempty"`
}
// StageFileChanges is observed workspace evidence, not a model's claim of authorship.