Skip to content

Conversation

@qstearns
Copy link
Contributor

@qstearns qstearns commented Nov 10, 2025

Adds a dialog to attach environments to sources

UX

Affordance to access functionality is currently buried behind:

image

The interface for attaching an environment is implemented in this modal:

image
  • We use a combobox
  • We try to preview what variables will be set to make more mistakes more obvious
  • Currently pretty ugly, but banking on the UX moving to a new location shortly before I figure out a good hierarchy for presenting. Happy to knock any quick fixes to make this present better if people feel strongly

Things to pay Attention To

  • Moved sources components to new directory, but also changed the modal paradigm (separate content components, used zustand for state management)
  • I ported all of the Dialogs and Dropdown Menu's to the moonshine versions of those components. I couldn't visually tell the difference and there were some really nasty interplay issues. Hoping this is a nice stability move

Considerations

  • Might consider adding a confirmation button considering this action is a pretty serious one
  • UX is quite ugly at the moment. Preferring to follow up with a dedicated sources page instead of burying behind a dialog
  • Blocked on this moonshine PR: feat(Combobox): add create to combobox moonshine#319

@qstearns qstearns requested a review from a team as a code owner November 10, 2025 16:56
@changeset-bot
Copy link

changeset-bot bot commented Nov 10, 2025

🦋 Changeset detected

Latest commit: c341462

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
dashboard Minor
server Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Nov 10, 2025

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

Project Deployment Preview Comments Updated (UTC)
gram Ready Ready Preview Comment Nov 10, 2025 11:53pm
gram-docs-redirect Ready Ready Preview Comment Nov 10, 2025 11:53pm
gram-landing-redirect Ready Ready Preview Comment Nov 10, 2025 11:53pm

@qstearns qstearns force-pushed the quinn/source-environments branch from e1c6218 to 2f9e885 Compare November 10, 2025 17:57
@qstearns qstearns force-pushed the quinn/source-environments branch from 2f9e885 to 6173181 Compare November 10, 2025 18:16
@qstearns qstearns changed the base branch from main to quinn/add-source-environments-table November 10, 2025 18:22
@qstearns qstearns force-pushed the quinn/source-environments branch from 6173181 to 7d03814 Compare November 10, 2025 18:31
@qstearns qstearns force-pushed the quinn/add-source-environments-table branch from 303753a to c665eb6 Compare November 10, 2025 18:32
@qstearns qstearns force-pushed the quinn/source-environments branch from 7d03814 to 5cc8a5f Compare November 10, 2025 18:51
@qstearns qstearns force-pushed the quinn/source-environments branch from 5cc8a5f to cbc03e8 Compare November 10, 2025 19:23
…e such that all tool calls originating from that source will have those environment variables apply
ciEnv.Set(k, v)
}
}

// IMPORTANT: MCP servers accessed in a public manner or not gram authenticated, there is no concept of using stored environments for them
if envSlug != "" && payload.authenticated {
storedEnvVars, err := env.Load(ctx, payload.projectID, gateway.Slug(envSlug))
Copy link
Member

Choose a reason for hiding this comment

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

It feels like this is where your code should hook in. Like we should only ever be loading one environment (I think?) so we either need to load the attached one or the one requested by the envSlug

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is more or less how the delineation between user and system configuration works in this system. The idea is that if environment is specified by slug that's a means of using gram environments to specify user configuration, which might be entirely disjoint from system configuration

@@ -111,11 +138,6 @@ func handleToolsCall(
ciEnv.Set(k, v)
Copy link
Member

Choose a reason for hiding this comment

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

What is supposed to happen when a user provides an env var that overrides one from an attached env?

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps maliciously

Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't worry about introducing that. It's not an increase in scope. The user won't be able to set anything they already aren't able to today.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to address both comments, we definitely want to load both environments, but environments loaded by slug and user supplied variables should be filtered by variables that are available in the tool call plan.

We do want to prefer client variables over server variables but only those explicitly provided in the spec

move oauth token into environement resolution

exclude server url when system environments are used

pass through all environment variables not specified by plan
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.

4 participants