From 17e7aef87164db1f7ceacd21c32deb1024ae3869 Mon Sep 17 00:00:00 2001 From: kami Date: Sun, 26 Jul 2026 20:34:38 +0400 Subject: [PATCH] wire configured quota limits into routing --- cmd/orchestra/main.go | 9 +++++++++ internal/registry/registry.go | 1 + progress.md | 2 ++ 3 files changed, 12 insertions(+) diff --git a/cmd/orchestra/main.go b/cmd/orchestra/main.go index 2c8b1a7..ef0becd 100644 --- a/cmd/orchestra/main.go +++ b/cmd/orchestra/main.go @@ -42,6 +42,15 @@ func main() { log.Fatalf("load orchestra config: %v", err) } rt = &router.Router{Store: s, Registry: rr, Reachability: registry.TCPReachability{}, Timeout: time.Second, Retry: router.RetryPolicy{MaxAttempts: 3, Backoff: time.Minute}} + limits := map[string]float64{} + for _, h := range rr.Herdrs() { + if h.QuotaLimit > 0 { + limits[h.ID] = h.QuotaLimit + } + } + if len(limits) > 0 { + rt.Availability = router.QuotaAvailability{Store: s, Limits: limits, Window: 7 * 24 * time.Hour} + } if repo, root := os.Getenv("ORCHESTRA_REPO"), os.Getenv("ORCHESTRA_WORKTREE_ROOT"); repo != "" && root != "" { adapters := map[string]herdr.Adapter{} for _, h := range rr.Herdrs() { diff --git a/internal/registry/registry.go b/internal/registry/registry.go index 1b22f28..06cefd7 100644 --- a/internal/registry/registry.go +++ b/internal/registry/registry.go @@ -34,6 +34,7 @@ type Herdr struct { Protocol string `json:"protocol,omitempty"` Capabilities []string `json:"capabilities"` Concurrency int `json:"concurrency"` + QuotaLimit float64 `json:"quota_limit,omitempty"` } type Config struct { Projects []Project `json:"projects"` diff --git a/progress.md b/progress.md index a8a25bb..6f49092 100644 --- a/progress.md +++ b/progress.md @@ -71,6 +71,8 @@ Rotation now honors an optional herdr turn-boundary probe (`pane.status`) before Federation control-plane foundations now include worker registration, heartbeat updates, TTL-based offline status, and `/v1/federation/workers` plus per-worker heartbeat endpoints. Remote event/lease transport and remote worktree ownership remain to be layered on this registry. +Configured herdr `quota_limit` values are now wired into router availability using the rolling-window 80% conservative filter; previously the quota implementation existed but was not active in server routing. + Recommended order: 1. Add the orchestration coordinator: lease → worktree → harness session → bootstrap → lifecycle events.