zot/internal/agent/extensions
patriceckhart 744685d68d fix(extensions): close ext.commands / ext.tools / lastFrameTime races
CI's `go test -race` flagged two races introduced over the recent
extension work:

1. ext.commands / ext.tools were appended to from the read-loop
   goroutine without a lock, while Commands() / Tools() / HasCommand
   read them under m.mu. Same for the toolIndex pre-check. Fix:
   take m.mu around the appends and the index dedup so writers and
   readers serialise on the same lock.

2. assumeReadyAfterIdle read ext.lastFrameTime once on entry without
   the per-extension lock (the read inside the loop already had it).
   Fix: take ext.mu for the initial snapshot too.

Verified locally with `go test -race ./...`; all packages pass.
The corresponding CI run for the scratchpad-persistence commit
failed for exactly these two races on linux + macos.
2026-04-19 15:27:09 +02:00
..
base64.go feat(extensions): phase 2 — extension-defined tools 2026-04-19 14:46:32 +02:00
events.go feat(extensions): phase 3 — event subscriptions + tool-call interception 2026-04-19 14:57:03 +02:00
manager.go fix(extensions): close ext.commands / ext.tools / lastFrameTime races 2026-04-19 15:27:09 +02:00
manager_test.go feat: extension system (subprocess + json-rpc, any language) 2026-04-19 14:09:43 +02:00
tool.go feat(extensions): phase 2 — extension-defined tools 2026-04-19 14:46:32 +02:00
tool_test.go feat(extensions): phase 2 — extension-defined tools 2026-04-19 14:46:32 +02:00