Skip to content

Add tests for backend_type propagation across agent lifecycle #1239

Description

@geoffjay

Summary

Add test coverage verifying that backend_type is correctly set when agents are
spawned, restarted, and reconciled. The existing test harness in
crates/orchestrator/tests/ already constructs ApiState with
backend_type: BackendType::Tmux but no tests assert the value flows through
to the agent record.

Context

Existing tests in conversation_persistence.rs and system_agent_http.rs
create ApiState with a hardcoded BackendType::Tmux. After #1235 and #1236
land, the AgentManager itself will be responsible for setting the backend
type on agents. Tests should verify:

  1. A spawned agent's backend_type matches the backend in use
  2. A restarted agent's backend_type is updated if the backend changed
  3. The reconciliation backfill (Backfill backend_type for existing agents during startup reconciliation #1237) corrects stale values
  4. The API response (AgentResponse) carries the correct backend_type

Acceptance Criteria

  • Add a unit test in crates/orchestrator/ (or integration test in
    crates/orchestrator/tests/) that spawns an agent via the API and asserts
    response.backend_type == Some("tmux") (or whichever test backend is used)
  • Add a test that verifies backend_type is persisted to storage correctly
    (read back from DB after spawn)
  • Add a test that verifies AgentResponse::from(agent) preserves the
    backend_type field
  • If feasible, add a test with a mock backend that returns a non-tmux
    backend_name() to verify the value is not hardcoded
  • cargo test passes

Key Files

  • crates/orchestrator/tests/system_agent_http.rs -- existing test harness
    with ApiState construction (line 114)
  • crates/orchestrator/tests/conversation_persistence.rs -- another test
    harness example (line 118)
  • crates/orchestrator/src/types.rs -- AgentResponse::from(Agent) impl
  • crates/orchestrator/src/manager.rs -- spawn_agent(), restart_agent()

Blocked By

Stack Base

Stack on: feature/autonomous-pipeline
Blocked by: #1236
Parallel: no ordering constraint with #1237 or #1238 (test files only)

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity:mediumMedium scope: <200 lines, 1-2 filesenhancementNew feature or requestneeds-testsArea needs dedicated test coveragetriagedIssue has been triaged, ready for planning or implementation

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions