Skip to content

feat(frontend): team picker on create flows + per-surface last-used default - #13637

Open
ntindle wants to merge 5 commits into
feat/org-role-dropdownfrom
feat/team-picker-creates
Open

feat(frontend): team picker on create flows + per-surface last-used default#13637
ntindle wants to merge 5 commits into
feat/org-role-dropdownfrom
feat/team-picker-creates

Conversation

@ntindle

@ntindle ntindle commented Jul 22, 2026

Copy link
Copy Markdown
Member

Why

SECRT-2488 / SECRT-2462: the decided create-time model — explicit team picker on every create flow, defaulting to last-used per surface — existed nowhere. Every resource silently landed org-home.

What

  • TeamPicker (shared, components/contextual/TeamPicker/): Select of Organization + my teams; per-surface last-used default persisted in a new Key.CREATE_SURFACE_TEAMS localStorage map; renders nothing for solo users.
  • Wired into 7 create flows: builder save-new, fork/duplicate, library folder create, library upload, both schedule dialogs (agent modal + builder cron), API key create.
  • Transport: per-request X-Team-Id header via a minimal custom-mutator extension (explicit pick wins over global org-context headers; the store's retired activeTeamID is never touched). Backend resolves it through get_request_contextctx.team_id, with feat(backend): accept explicit team_id on create/save flows #13540's explicit body params as the follow-up transport once the batch's OpenAPI regenerates.
  • Flagged, not wired (no UI moment or no backend param): marketplace one-tap AddToLibrary, implicit copilot session creation, store submission ownership. Backend alignment PR (separate, in batch) covers API-key ctx fallback + fork/folder ctx honoring.

Testing

18 tests: picker behavior (7), last-used helpers (7), API-key dialog header on/off (2), fork header carry (2); plus all 32 existing tests importing touched files. format/lint/types clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Jm3mCG9okfdGtAXtFaDF9A


Note

Medium Risk
Changes tenancy headers on multiple create paths (graphs, schedules, folders, API keys); incorrect header handling could mis-assign ownership, though behavior is covered by new mutator and dialog tests.

Overview
Introduces a shared TeamPicker (Organization vs user teams, hidden for solo users) backed by useCreateTeamSelection, which seeds each surface from a create-surface-teams localStorage map and exposes getTeamRequestInit for Orval mutations.

Wired into: builder save-new (picker only when no flowID), read-only duplicate/fork, builder cron schedule, library folder create, library upload, agent schedule modal, and API key create—with surface-specific labels where needed (e.g. “Restrict to team”, “Duplicate into team”).

Transport: create calls pass X-Team-Id on the request; custom-mutator now lets an explicit team id override nav context, and an empty sentinel forces org-home by stripping the team header (so “Organization” still wins when a team is active in the shell). useSaveGraph / useDuplicateGraph / API key hook apply the same pattern on graph create and fork.

Tests cover picker behavior, last-used helpers, mutator header rules, and integration checks that fork/API-key create send or omit X-Team-Id as expected.

Reviewed by Cursor Bugbot for commit f6b3d6b. Bugbot is set up for automated code reviews on this repo. Configure here.

…efault (SECRT-2488)

Add a shared TeamPicker (contextual) that lists Organization (org-home) plus
the user's teams, hidden entirely for solo users. Selecting a team stamps the
create call's ownership via a per-request X-Team-Id header (no create-request
body accepts a team field), captured in custom-mutator so the explicit pick
wins over the store's org context. Per-surface last-used team is remembered in
a new localStorage map. Teams remain badges/filters, never a context switch —
the global activeTeamID is untouched.

Wired: builder save-new, builder fork/duplicate, builder cron schedule,
library folder create, library agent upload, schedule-agent modal, API key
create (team restriction).

Co-Authored-By: Claude Opus <noreply@anthropic.com>
@ntindle
ntindle requested a review from a team as a code owner July 22, 2026 03:27
@ntindle
ntindle requested review from Pwuts and Swiftyos and removed request for a team July 22, 2026 03:27
@github-project-automation github-project-automation Bot moved this to 🆕 Needs initial review in AutoGPT development kanban Jul 22, 2026
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • dev

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 55d47f26-28d6-4a48-afbd-217d012e1c77

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/team-picker-creates

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the platform/frontend AutoGPT Platform - Front end label Jul 22, 2026
@ntindle

ntindle commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

/batch

Comment thread autogpt_platform/frontend/src/app/api/mutators/custom-mutator.ts
@autogpt-batch-bot autogpt-batch-bot Bot added the batch PR is queued in the batch-deploy rollup (batch-bot source of truth) label Jul 22, 2026
@autogpt-batch-bot autogpt-batch-bot Bot mentioned this pull request Jul 22, 2026
11 tasks
@autogpt-batch-bot

Copy link
Copy Markdown

🤖 Added #13637 to the batch. Current batch (9): #13638, #13604, #13603, #13599, #13574, #13541, #13540, #13530, #13637.

Deploying the combined preview (#13537); /batch-merge lands them together.

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.52055% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.14%. Comparing base (8718b3c) to head (f6b3d6b).

Additional details and impacted files
@@                    Coverage Diff                     @@
##           feat/org-role-dropdown   #13637      +/-   ##
==========================================================
- Coverage                   76.15%   76.14%   -0.01%     
==========================================================
  Files                        2733     2737       +4     
  Lines                      202181   202239      +58     
  Branches                    19659    19673      +14     
==========================================================
+ Hits                       153962   154002      +40     
- Misses                      43940    43958      +18     
  Partials                     4279     4279              
Flag Coverage Δ
platform-frontend 49.68% <92.85%> (+0.07%) ⬆️
platform-frontend-e2e 31.16% <58.97%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Platform Backend 82.68% <ø> (ø)
Platform Frontend 53.15% <94.52%> (+0.02%) ⬆️
AutoGPT Libs ∅ <ø> (∅)
Classic AutoGPT 28.43% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ntindle

ntindle commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

/batch orgs

1 similar comment
@ntindle

ntindle commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

/batch orgs

@autogpt-batch-bot autogpt-batch-bot Bot added the batch:orgs batch-bot batch membership label Jul 22, 2026
@autogpt-batch-bot autogpt-batch-bot Bot mentioned this pull request Jul 22, 2026
24 tasks
@autogpt-batch-bot

Copy link
Copy Markdown

🤖 Added #13637 to batch orgs. Batch orgs (13): #13650, #13649, #13641, #13638, #13637, #13604, #13603, #13599, #13574, #13541, #13540, #13530, #13496.

Deploying the combined preview (#13651); /batch-merge lands them together.

ntindle and others added 2 commits July 22, 2026 14:45
Address review on the create-flow team picker:

- Choosing Organization (org-home) now drops the active-team context header
  instead of silently inheriting the nav team. getTeamRequestInit sends an
  empty X-Team-Id sentinel that customMutator reads to suppress the
  store-derived team header (and strips before it reaches the backend).
- useCreateTeamSelection clamps a stale last-used team even when the user
  has no teams (solo), guarded by the store's isLoaded flag so it never
  clears mid-load, and now also resets the persisted value so a remount
  can't resurrect the deleted id.

Co-Authored-By: Claude Opus <noreply@anthropic.com>
…eat/team-picker-creates

Clean forward-merge (inherits OrgTeamProvider resolution).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NBwmh7CkHiF8vKLBf2GWTU
…e useSupabase→useAuth (keep branch's test additions)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NBwmh7CkHiF8vKLBf2GWTU

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f6b3d6b. Configure here.

setTeamId,
hasTeams: teams.length > 0,
teamRequestInit: getTeamRequestInit(teamId),
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale team id in create header

Medium Severity

teamRequestInit is built from raw teamId state while useTeamPicker shows Organization whenever the id is not in the current team list. After a stale last-used id (or before clamp runs), the picker can display org-home while the create mutation still sends that obsolete id in X-Team-Id until the effect updates state.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f6b3d6b. Configure here.

@github-actions github-actions Bot added the cla: signed CLA signed by all contributors label Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

batch:orgs batch-bot batch membership batch PR is queued in the batch-deploy rollup (batch-bot source of truth) cla: signed CLA signed by all contributors platform/frontend AutoGPT Platform - Front end size/xl

Projects

Status: 🆕 Needs initial review
Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant