Skip to content

[fix] workflow-related fork issues#4211

Merged
jp-agenta merged 1 commit intorelease/v0.96.8from
fix/broken-workflows-related-methods
Apr 22, 2026
Merged

[fix] workflow-related fork issues#4211
jp-agenta merged 1 commit intorelease/v0.96.8from
fix/broken-workflows-related-methods

Conversation

@jp-agenta
Copy link
Copy Markdown
Member

@jp-agenta jp-agenta commented Apr 22, 2026

Description

POST /workflows/variants/fork silently returned {"count": 0} for any invalid/partial payload.

Made the trailing tip revision optional (fork now works when the user only supplies workflow_variant + a source ref), and converted the remaining misuses into a typed VariantForkError that the routers surface as HTTP 400 with a structured detail.

Same DAO backs workflows, applications, evaluators, and queries forks — all four endpoints are fixed by this change. Routers for workflows/applications/evaluators now translate VariantForkError → 400.

Cause

The shared fork_variant DAO is wrapped in @suppress_exceptions(), so the AttributeError raised when the caller omitted the optional revision / workflow_revision block was swallowed into None → empty response.

Fixes

  • core/git/types.py — new module with GitError / VariantForkError.
  • dbs/postgres/git/dao.py::fork_variant — validate inputs (missing variant, missing source ref, unresolved source revisions) with VariantForkError; guard the optional tip revision commit; @suppress_exceptions(exclude=[VariantForkError]).
  • apis/fastapi/{workflows,applications,evaluators}/router.py — catch VariantForkError → HTTPException(400, detail=...).
  • tests/pytest/acceptance/workflows/test_workflow_lineage.py — 4 new tests: fork without revision (succeeds, copies history), missing variant payload (400), missing source ref (400), unknown source (400).

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Apr 22, 2026 0:27am

Request Review

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working tests labels Apr 22, 2026
@jp-agenta jp-agenta merged commit 493d836 into release/v0.96.8 Apr 22, 2026
18 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

Railway Preview Environment

Image tag pr-4211-ba0cf02
Status Failed
Railway logs Open logs
Logs View workflow run
Updated at 2026-04-22T12:29:10.403Z

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

Labels

bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant