Skip to content

Backfill backend_type for existing agents during startup reconciliation #1237

@geoffjay

Description

@geoffjay

Summary

Existing agents in the database have incorrect backend_type values (hardcoded
"tmux" from before the fix). The startup reconciliation loop should detect and
correct stale backend_type values so that agents created before the fix are
reported accurately.

Context

AgentManager::reconcile() in crates/orchestrator/src/manager.rs (line 393)
already iterates over all running agents at startup and checks their session
health. This is the natural place to also fix stale backend_type values.

After #1236 lands, newly spawned agents will have the correct backend_type.
But agents that were persisted before the fix will still have "tmux" (or
None) in the database. This issue handles the data migration aspect.

Acceptance Criteria

  • In reconcile_agent(), check if agent.backend_type differs from
    self.backend.backend_name() and update it if so
  • Log a warning when correcting a stale backend_type value (include
    agent ID, old value, new value)
  • Persist the corrected value via self.storage.update(&agent)
  • Only update agents whose sessions are confirmed alive (don't touch
    stopped/failed agents that might have legitimately run on a different backend)
  • cargo clippy and cargo fmt pass

Key Files

  • crates/orchestrator/src/manager.rs -- reconcile_agent() method (line 434)

Blocked By

Stack Base

Stack on: feature/autonomous-pipeline
Blocked by: #1236

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcomplexity:smallSmall scope: <50 lines, single filetriagedIssue has been triaged, ready for planning or implementation

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions