Skip to content

orchestrator: failing step never marked failed — stays in running forever #145

Open

Description

@jack-o-brown

Bug

In backend/app/faros/runtime/orchestrator.py:60-105, the per-step loop sets status="running" (line 65), executes the capability, verifies, and only then sets status="completed". If capability.execute(...) raises, or verification.status != "passed" raises a ValueError, control flows directly to the outer except Exception (line 120) which marks the run as failed — but never touches the step record.

Repro

  1. Plan a run with executionMode=execute such that idea_refinement fails (e.g. provider key missing).
  2. GET /api/faros/runs/{run_id} (registered at faros_api.py:81).
  3. Observed payload:
{
  "status": "failed",
  "error_message": "...",
  "steps": [
    {"node_id": "idea", "status": "running", "started_at": "..."},
    {"node_id": "experiment", "status": "pending"},
    ...
  ]
}

Expected: the idea step is failed with the verification details, or at least ended_at populated.

Workaround

None at the data-store layer; the file is the source of truth. Operators currently have to grep events.json to figure out which node actually died.

Fix

Wrap the inner body in try/except and call state_store.update_step(run_id, node.id, {"status": "failed", "ended_at": ..., "error": str(exc)}) before re-raising. Approximate diff:

try:
    result = capability.execute(context, node_inputs)
    verification = self.verifier.verify(node.capability, result)
    if verification.status != "passed":
        raise ValueError(verification.message)
    ...
except Exception:
    self.state_store.update_step(run_id, node.id, {
        "status": "failed",
        "ended_at": datetime.utcnow().isoformat(),
        "verification": getattr(verification, "model_dump", lambda: {})(),
    })
    raise

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions