Skip to content

fix: prevent duplicate worker registration - #8

Merged
wrightpt merged 1 commit into
mainfrom
agent/worker-singleton-guard
Jul 14, 2026
Merged

wrightpt merged 1 commit into
mainfrom
agent/worker-singleton-guard

Conversation

@wrightpt

Copy link
Copy Markdown
Owner

Summary

  • exit normal CLI startup cleanly when AgentMemory is already serving livez
  • acquire worker.pid atomically before any iii registration
  • reject a second live worker and safely reclaim stale pidfiles

Root cause

A duplicate worker can register the same function and HTTP trigger IDs against the live iii engine. When the duplicate exits, iii unregisters those shared routes while the original process remains active, leaving systemd green but REST endpoints at 404.

Validation

  • npm test: 140 files, 1,468 tests passed
  • build passed
  • live duplicate CLI exited 0 without touching the worker
  • direct duplicate worker exited 1 before registration
  • original live health endpoint remained HTTP 200 after both adversarial checks

@wrightpt
wrightpt merged commit b88c00f into main Jul 14, 2026
@wrightpt
wrightpt deleted the agent/worker-singleton-guard branch July 14, 2026 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant