Skip to content

fix(ateapi): retry stored-worker scan in syncer startup - #772

Open
Anish Ramasekar (aramase) wants to merge 1 commit into
agent-substrate:mainfrom
aramase:aramase/i/fix_609_orphan_reconcile_retry
Open

fix(ateapi): retry stored-worker scan in syncer startup#772
Anish Ramasekar (aramase) wants to merge 1 commit into
agent-substrate:mainfrom
aramase:aramase/i/fix_609_orphan_reconcile_retry

Conversation

@aramase

Copy link
Copy Markdown
Contributor

Fixes #609

The startup stored-worker scan (enqueueStoredWorkers) returned on the first ListWorkers error, skipping orphan cleanup until the next restart. The #674 workqueue only retries per-key reconciles, not this initial scan, so retry the scan with capped wait.Backoff until it succeeds or the context is cancelled.

  • Tests pass
  • Appropriate changes to documentation are included in the PR

// cleanup until the next restart if the store stayed briefly unavailable; the
// retry runs in the background startup goroutine (off the serving path) and, on
// a lasting outage, issues at most one cheap failing list per Cap interval.
func (s *WorkerPoolSyncer) listAllStoredWorkers(ctx context.Context) ([]*ateapipb.Worker, error) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add the retry logic around the API call, and then just process 1 page of workers at a time so we don't need to load all workers into memory?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. It now reads and enqueues one page at a time, so we never hold all workers in memory, and the retry wraps the single ListWorkers call with capped backoff and reuses the same page cursor instead of restarting from page 0. Enqueue is incremental now, so a mid-scan cancel keeps the pages already queued and the rest get picked up next startup. Added a multi-page test that fails a later page once and checks every worker still gets enqueued.

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.

[P2] Startup orphan reconciliation aborts on ListWorkers pagination error — ghost workers persist

2 participants