ENG-3771: add lab project commands#677
Conversation
4002bde to
41a36df
Compare
ac843d0 to
dbe9200
Compare
|
@mrmoxon thoughts on folding this into the setup flow? ie default = single project that shares name with workspace folder, overridable + switchable. a bit worried about abstraction creep, feels like we can have these coupled until users explicitly want to decouple |
Defo agree, am making the |
|
Addressed the setup-flow point: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 530dca9. Configure here.
| ensure_active_project_scope( | ||
| config.team_id, | ||
| config, | ||
| action="create and set an active project", |
There was a problem hiding this comment.
Redundant no-op scope validation before project creation
Low Severity
The first ensure_active_project_scope(config.team_id, config, ...) call passes config.team_id as both the project_team_id argument and then compares it against config.team_id inside the function. Since project_team_id == config.team_id is tautologically True, this call can never raise and is dead code. The second call after projects_client.create(...) is the meaningful guard (validating the API-returned project.team_id), making the first one purely redundant.
Reviewed by Cursor Bugbot for commit 530dca9. Configure here.


Linear: ENG-3771
Summary
Adds Lab Project support to the Prime CLI and eval client so users can set up a projectized Lab workspace, create/select/clear/inspect/update projects, and attach artifacts to projects from the terminal.
UX
prime lab setupnow folds projects into the normal setup flow. When the user is authenticated and no active workspace project exists, setup creates a default project named after the workspace folder and makes it active in.prime/lab/context.json. Users can bind an existing project withprime lab setup --project <project-id-or-slug>, choose the generated project name withprime lab setup --project-name "Alphabet Sort Baselines", or keep setup local-only withprime lab setup --no-project. If the user is not authenticated or the Projects API is unavailable, local setup still succeeds and prints the follow-upprime project createpath.Projects remain compatible with existing Lab flows. Users who do not create or select a project can keep running
prime train,prime eval push, andprime eval runas they do today; without an active project, those commands run without project attachment. Once a workspace has an active project, new training runs and evaluations attach to it by default. Users can override that per command with--project <project-id-or-slug>or opt out explicitly with--no-project. Active project context is local to the workspace and ignored when the CLI team or API base URL does not match the current config.Active project context follows the active CLI account context. A personal CLI context can only set a personal project as active; a team CLI context can only set a project from that same team as active.
--team-idis still supported for explicit one-off team operations such as listing, showing, creating with--no-use, assigning, or removing, but it does not switch futureprime train/prime evalcommands into that team. Users should runprime switch <team-slug-or-id>or setPRIME_TEAM_ID=<team-id>before making a team project active.Active project lookup is anchored to the nearest Lab workspace marker, so nested paths such as
outputs/evals/...still resolve the workspace project, but nested Lab workspaces do not accidentally inherit a parent workspace's active project.A typical projectized workspace flow looks like:
For team-owned projects, switch to the team first so setup creates the default project in that team context:
Users can still switch projects with
prime project use <project-id>, stop default attachment withprime project clear, and organize existing artifacts withprime project assign/prime project removefor runs, evals, and adapters.Details
prime projectcommands for creating/listing/showing/using/checking current/clearing/updating/assigning/removing a project.prime lab setup, with--project,--project-name, and--no-projectcontrols.project current --output jsonstable if API detail fetch fails by returningproject: nulland separate cachedcontextmetadata.assign, and clear-or-specific removal viaremove.prime-evalsREADME.Not in this PR
prime project environments, is left for a follow-up backend-backed endpoint.Validation
uv run pytest packages/prime/tests/test_lab_setup.py -quv run pytest packages/prime/tests/test_lab_setup.py packages/prime/tests/test_projects_cli.py packages/prime/tests/test_eval_push.py packages/prime/tests/test_hosted_eval.py packages/prime/tests/test_rl_api.py -quv run pytest packages/prime/tests packages/prime-evals/tests -q(797 passed, 4 skipped)uv run ruff check packages/prime/src/prime_cli/lab_setup.py packages/prime/src/prime_cli/utils/projects.py packages/prime/src/prime_cli/commands/projects.py packages/prime/tests/test_lab_setup.pyuv run ruff format --check packages/prime/src/prime_cli/lab_setup.py packages/prime/src/prime_cli/utils/projects.py packages/prime/src/prime_cli/commands/projects.py packages/prime/tests/test_lab_setup.pyuv run ty check packages/prime/src packages/prime-evals/srcgit diff --check--team-id <team-id> --no-use, confirmed no context file was written, confirmed personal context rejectsproject use <team-project> --team-id <team-id>, then confirmed matchingPRIME_TEAM_ID=<team-id>allowsproject useand writes a team-scoped.prime/lab/context.json.Note
Medium Risk
Touches default attachment behavior for training and eval commands and team-scoped active project rules; mistakes could attach artifacts to the wrong project, but changes are opt-out via
--no-projectand heavily tested.Overview
This PR adds Lab Projects end-to-end: a new
prime projectcommand group, workspace-scoped active project context, and optional project attachment across training and eval flows.CLI & workspace context. New
ProjectsClientandprime projectcommands (create, list, show, use, current, update, clear, assign/remove for runs, evals, adapters). Active project is stored in.prime/lab/context.json(gitignored), resolved from the nearest Lab workspace, and scoped to the current API base URL and team.prime lab setupcan create or bind a default project (--project,--project-name,--no-project) without blocking local setup when unauthenticated or the API fails.Training & deployments. Hosted training runs accept
project_idon create and viaupdate_run_project(add/remove/clear, optional adapter moves). Adapters getupdate_adapter_projectwith the same operation model.Evaluations.
prime-evalsgainsproject_idon create and assign/clear onupdate_evaluation(clear_projectsendsproject_id: null).prime eval push/prime eval run(local and hosted) and post-run hub upload honor--project/--no-projectand the active project by default.CI & docs. GitHub Actions bumps
checkoutto v6 and pinssetup-uvto 0.11.15 with cache disabled. READMEs document projectized Lab workflows.Tests cover setup project flows, CLI project commands, eval/train payload wiring, and scope/boundary rules for active context.
Reviewed by Cursor Bugbot for commit 530dca9. Bugbot is set up for automated code reviews on this repo. Configure here.