From 9ed15cbb4276a574269127800cae0b113d9092bf Mon Sep 17 00:00:00 2001 From: Snider Date: Sat, 25 Apr 2026 09:53:09 +0100 Subject: [PATCH] fix(agent): replace sync/atomic plan ID generator with core.ID() (#863) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed local sync/atomic + crypto/rand + encoding/hex based plan ID generator from pkg/agentic/plan.go. Switched planID() to core.ID() primitive. Preserves id-{counter}-{suffix} shape via Core's primitive. prep.go, sync.go, pkg/brain/*.go scanned — no sync imports remained in non-test files. Closes tasks.lthn.sh/view.php?id=863 Co-authored-by: Codex --- pkg/agentic/plan.go | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/pkg/agentic/plan.go b/pkg/agentic/plan.go index 066d1b9..7aae8b0 100644 --- a/pkg/agentic/plan.go +++ b/pkg/agentic/plan.go @@ -4,10 +4,6 @@ package agentic import ( "context" - "crypto/rand" - "encoding/hex" - "strconv" - "sync/atomic" "time" core "dappco.re/go/core" @@ -157,8 +153,6 @@ type PlanListOutput struct { const planListDefaultLimit = 20 -var planIDCounter atomic.Uint64 - // result := c.Action("plan.create").Run(ctx, core.NewOptions( // // core.Option{Key: "title", Value: "AX RFC follow-up"}, @@ -717,17 +711,7 @@ func phaseCriteriaValue(values ...any) []string { } func planID() string { - counter := planIDCounter.Add(1) - suffix := planRandomHex() - return core.Concat("id-", strconv.FormatUint(counter, 10), "-", suffix) -} - -func planRandomHex() string { - bytes := make([]byte, 3) - if _, err := rand.Read(bytes); err != nil { - return "000000" - } - return hex.EncodeToString(bytes) + return core.ID() } func planTaskSliceValue(value any) []PlanTask {