Skip to content

fix(frontend): add explicit project_id to evaluation scenarios POST#4085

Merged
junaway merged 1 commit intorelease/v0.95.1from
fix/eval-scenarios-missing-project-id
Mar 31, 2026
Merged

fix(frontend): add explicit project_id to evaluation scenarios POST#4085
junaway merged 1 commit intorelease/v0.95.1from
fix/eval-scenarios-missing-project-id

Conversation

@mmabrouk
Copy link
Copy Markdown
Member

@mmabrouk mmabrouk commented Mar 31, 2026

Summary

  • Fixes human evaluation creation failing with "Entity with same keys already exists" when a workspace has multiple projects
  • The createScenarios call was missing project_id in the query string, causing the auth middleware to resolve the default project instead of the current one
  • This led to a FK violation (project_id, run_id) since the run belongs to a different project than what auth resolved

Root Cause

In usePreviewEvaluations, the runs endpoint (line 417) and results endpoint (line 499) both explicitly pass ?project_id=${projectId}, but the scenarios endpoint did not. Without it, the auth middleware falls back to get_default_project_id_from_workspace() which returns the first project created — not the one the user is viewing.

Fix

Added explicit project_id query parameter to the scenarios POST, matching the pattern already used by runs and results.


Open with Devin

The createScenarios call in usePreviewEvaluations was missing project_id
in the query string. When a workspace has multiple projects, the auth
middleware falls back to the default project instead of the one the user
is viewing. This causes a FK violation (project_id, run_id) because the
run belongs to a different project than the one resolved by auth.

The runs and results endpoints already pass project_id explicitly — this
aligns the scenarios endpoint to match.
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 2026

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

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Mar 31, 2026 10:26am

Request Review

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 31, 2026
@dosubot dosubot bot added the bug Something isn't working label Mar 31, 2026
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

Railway Preview Environment

Status Destroyed (PR closed)

Updated at 2026-03-31T10:36:13.857Z

@junaway junaway changed the base branch from main to release/v0.95.1 March 31, 2026 10:35
@junaway junaway merged commit cd1a4de into release/v0.95.1 Mar 31, 2026
24 of 25 checks passed
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:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants