Skip to content

ateapi: backfill unset worker state during pod sync - #599

Open
Mesut Oezdil (mesutoezdil) wants to merge 1 commit into
agent-substrate:mainfrom
mesutoezdil:fix/worker-state-backfill
Open

ateapi: backfill unset worker state during pod sync#599
Mesut Oezdil (mesutoezdil) wants to merge 1 commit into
agent-substrate:mainfrom
mesutoezdil:fix/worker-state-backfill

Conversation

@mesutoezdil

@mesutoezdil Mesut Oezdil (mesutoezdil) commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #517.

#517 added a scheduler filter that skips any worker whose state is not STATE_ACTIVE:

if worker.GetState() != ateapipb.Worker_STATE_ACTIVE {
return false
}

But the syncer writes State only when it creates a worker record. The update path in syncWorkerToStore diffs Ip, SandboxClass and Labels and never touches State, and no other code path writes State onto an existing record.

The store is Redis backed, so worker records outlive an ate-api-server rollout, and worker pods are not recreated by that rollout either. Every worker record written before the State field existed therefore stays at STATE_UNSPECIFIED and is skipped by the scheduler for the whole life of its pod. On an existing cluster upgrading past #517, actor placement fails with ErrNoCapacity until each worker pod is deleted and recreated. The startup sync does not help, because the field diff computes changed == false and never writes.

Comment thread cmd/ateapi/internal/controlapi/syncer.go Outdated
@mesutoezdil
Mesut Oezdil (mesutoezdil) force-pushed the fix/worker-state-backfill branch 2 times, most recently from 3bd62d1 to 8ddf9a1 Compare August 26, 2026 07:11
Follow-up to agent-substrate#517, which added a scheduler filter that skips any
worker whose state is not STATE_ACTIVE. The syncer only writes State
when it creates a worker record; the update path in syncWorkerToStore
diffs Ip, SandboxClass and Labels and never touches State, and no
other code path writes it onto an existing record.

The store is Redis backed, so worker records outlive an ate-api-server
rollout, and worker pods are not recreated by that rollout either.
Every worker record written before the State field existed therefore
stays at STATE_UNSPECIFIED and is skipped by the scheduler for the
whole life of its pod. On an existing cluster upgrading past agent-substrate#517,
actor placement fails with ErrNoCapacity until each worker pod is
deleted and recreated. The startup sync does not help, since the
field diff computes changed == false and never writes.
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.

2 participants