Skip to content

feat: Create projects inside a project group on bt functions push - #395

Merged
Luca Forstner (lforst) merged 2 commits into
mainfrom
lforst/project-group-push
Oct 1, 2026
Merged

Luca Forstner (lforst) merged 2 commits into
mainfrom
lforst/project-group-push

Conversation

@lforst

@lforst Luca Forstner (lforst) commented Oct 1, 2026 •

Copy link
Copy Markdown
Member
  • bt functions push can create missing projects when you pass --create-missing-projects. Before this PR, it always created them at the top level of the org, even if the user's code said the project should be in a project group.
  • The JS and Python runners (the helper scripts that load the user's code and report the functions back to the CLI) now read a project's group name and pass it on as project_group_name.
    • JS reads projectGroupName from the project reference, and Python reads project_group_name from the Project object. On SDK versions without project groups, the field is simply missing and nothing changes.
  • When the CLI creates a missing project, it now sends project_group_name to the create-project API, so the project lands in the right group.
  • If the same project name is given two different group names in one push, the push now fails early and names both groups. Before, the CLI had no way to notice this.
  • Group names only matter when a project is created. Projects that already exist, and functions that point to a project by ID, are not moved or changed.
  • If creating a project fails, the error now includes the reason from the API. Before, it only said "failed to create project". This makes errors like an unknown project group much easier to debug.
  • Other commands that create projects (bt projects create, bt switch, sync, datasets) work exactly as before and don't set a group.

Definitions can declare a project group via the JS SDK's
`projects.create({ name, projectGroupName })`. The functions runner forwards
it as `project_group_name`, and push passes it to `POST /v1/project` when it
creates a missing project, so users who only hold project-creation permission
on a group can push into new projects.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T15:10:53.619106Z 7faf421 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7faf421477

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

kind: "function_event",
project_id: projectId,
project_name: projectName,
project_group_name: selector.project_group_name,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve groups for nested project references

When a prompt or function event references a different missing project—for example, a legacy tool whose project came from projects.create({ name, projectGroupName })—resolver.resolve() serializes that nested reference only as project_id: "name:...", while this field carries the group only for the event's owning project. Rust discovers the nested name via collect_project_name_placeholders_checked, but finds no corresponding group and calls create_project with None, so users who can create projects only within that group still cannot push this valid definition. Carry group metadata for every project passed through the resolver, rather than only for the top-level entry.

Useful? React with 👍 / 👎.

@AbhiPrasad

Copy link
Copy Markdown
Member

lemme merge the python pr in, then we can do it for python too.

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Latest downloadable build artifacts for this PR commit 00673e5d0e73:

Available artifact names
  • artifacts-build-local-x86_64-pc-windows-msvc
  • artifacts-build-local-aarch64-pc-windows-msvc
  • artifacts-build-global
  • artifacts-build-local-x86_64-unknown-linux-gnu
  • artifacts-build-local-x86_64-apple-darwin
  • cargo-dist-cache
  • artifacts-build-local-aarch64-unknown-linux-gnu
  • artifacts-build-local-x86_64-unknown-linux-musl
  • artifacts-build-local-aarch64-apple-darwin
  • artifacts-plan-dist-manifest

Luca Forstner (lforst) added a commit to braintrustdata/braintrust-sdk-javascript that referenced this pull request Oct 1, 2026
- Braintrust organizes projects into "project groups", and a user can
have permission to create projects inside a group without being allowed
to create projects anywhere else in the organization.
- A recent unreleased change added a `projectGroupName` option to
`initLogger`, `init`, `initDataset` and `Eval`.
When the named project didn't exist yet, it was created inside that
group.
- The problem is that loggers resolve their project every time they
start up, not just once.
- Passing a group switches the backend from a cheap, cached lookup to an
uncached "create or verify group membership" call that locks the whole
group's database row.
- In production that means every logger cold start, across every service
logging into that group, waits on the same lock.
- If the project already exists outside the group, or is later moved out
of it, the backend rejects the call, so logging fails because of a
permissions change rather than a code change.
- Creating a project is really a one-time setup step, so this PR takes
`projectGroupName` back out of `initLogger`, `init`, `initDataset` and
`Eval`.
  They now send the same requests as before the earlier change.
- The option now lives on the push and publish path instead:
`projects.create({ name: "my-project", projectGroupName: "my-group" })`.
- Previously `projects.create()` only took a project name or id, and
`braintrust push` / `project.publish()` always created missing projects
at the organization level.
- Now those commands pass the group along when they register the
project, so a missing project is created inside that group.
- The standalone `bt` CLI reads the same SDK project definitions, and
braintrustdata/bt#395 makes `bt functions push` pass the group along
too.
- The earlier change hasn't been released, so removing the option from
the logger, experiment and dataset entrypoints doesn't break anyone.
@lforst
Luca Forstner (lforst) merged commit afb869d into main Oct 1, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants