agent/pkg
Snider ba8de0c0bb fix(agent): purge sync.Once from pkg/agentic via core.Once (§14A)
Closes Mantis #863 ([agent] Phase 2: purge sync stdlib).

Per RFC plans/code/core/go/RFC.primitives-lifecycle.md §14A (landed core/go
dev 8995a80), swaps the four sync.Once usages to core.Once and the two
sync.Once{} reset-pattern callsites to core.Once.Reset():

pkg/agentic/statestore.go:
- Drop `import "sync"`.
- stateStoreRef.once: sync.Once → core.Once
- closeStateStore reset: `s.stateOnce = sync.Once{}` → `s.stateOnce.Reset()`

pkg/agentic/workspace_stats.go:
- Drop `import "sync"`.
- workspaceStatsRef.once: sync.Once → core.Once
- closeWorkspaceStatsStore reset: `s.workspaceStatsOnce = sync.Once{}` →
  `s.workspaceStatsOnce.Reset()`

pkg/agentic/prep.go:
- Drop `import "sync"`.
- PrepSubsystem.stateOnce + .workspaceStatsOnce: sync.Once → core.Once

The Reset() pattern matches stdlib semantics (see RFC §14A "Tradeoff: Once.
Reset semantics") — caller serialises via the existing closeStateStore /
closeWorkspaceStatsStore structure that nests Reset inside the lifecycle
inverse, so no concurrent Do races are introduced.

Net: 3 files, +7/-11. Mechanical line-edit per RFC §16 migration plan.

Audit re-check post-commit:
  grep -n '"sync"\|sync\.Once\|sync\.Mutex' pkg/agentic/{statestore,workspace_stats,prep}.go
  → empty (lib local variable named `sync` in mirror.go is unrelated; not
    in scope of this ticket).

Pre-flight verification: core.Once + Reset symbols verified present on
core/go dev 8995a80. Local AX-10 build blocked by the same pre-existing
workspace forge dep break that affects all consumers (root cause: fake
v0.8.0-alpha.1 pins per task #28); CI in healthy env will validate.

Co-Authored-By: Athena <athena@lthn.ai>
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-25 00:58:49 +01:00
..
agentic fix(agent): purge sync.Once from pkg/agentic via core.Once (§14A) 2026-04-25 00:58:49 +01:00
brain feat(ax-10): bring agent to v0.8.0-alpha.1 + CLI test scaffold 2026-04-24 23:48:34 +01:00
lib revert fcb9c189e5 2026-04-23 12:32:57 +01:00
messages revert fcb9c189e5 2026-04-23 12:32:57 +01:00
monitor feat(ax-10): bring agent to v0.8.0-alpha.1 + CLI test scaffold 2026-04-24 23:48:34 +01:00
runner revert fcb9c189e5 2026-04-23 12:32:57 +01:00
setup revert fcb9c189e5 2026-04-23 12:32:57 +01:00
.DS_Store revert fcb9c189e5 2026-04-23 12:32:57 +01:00