Skip to content

POST /workflows/variants/fork returns count=0 with HTTP 200 on all inputs #4177

@mmabrouk

Description

@mmabrouk

Found while testing the workflows endpoints against eu.cloud.agenta.ai for the v0.96 REST API migration docs (PR-6 Workflows).

POST /api/workflows/variants/fork responds HTTP 200 {"count": 0} regardless of the request body. No validation error, no server-side error raised to the client.

Repro

  1. Create a workflow, a variant with a unique slug, and commit at least one revision on that variant.
  2. Call fork:
curl -s -X POST "$AGENTA_HOST/api/workflows/variants/fork" \
  -H "Authorization: ApiKey $AGENTA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"workflow": {"workflow_id": "<artifact_id>", "workflow_variant_id": "<source_variant_id>", "workflow_variant": {"slug": "fork-experimental", "name": "experimental"}}}'

Response: HTTP 200 {"count": 0}.

Also tried with the core aliased shape (artifact_id / variant_id / variant) and with an empty body. All return the same.

Expected

Either a forked variant object, or a structured 4xx error pointing at the offending field.

Suspected cause

WorkflowsRouter.fork_workflow_variant delegates to workflows_service.fork_workflow_variant, which calls workflows_dao.fork_variant. fork_variant returns None when log_revisions(...) yields nothing. The source variant has revisions (verified via /workflows/revisions/log), so something upstream is dropping the variant_id supplied via the workflow wrapper — likely alias normalization on WorkflowFork / ArtifactFork isn't propagating workflow_variant_id -> variant_id for the fork payload.

At minimum the handler should 400 when no source revisions resolve from the supplied refs.

Impact

Fork via REST is unusable. Docs PR flags this and does not ship a worked fork example until it is fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BackendbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions