Skip to content

feat(apps): declare envMappings for every app; make field required#18

Merged
matoushavlena merged 1 commit intomainfrom
feat/env-mappings-all-apps
Apr 22, 2026
Merged

feat(apps): declare envMappings for every app; make field required#18
matoushavlena merged 1 commit intomainfrom
feat/env-mappings-all-apps

Conversation

@Tomas2D
Copy link
Copy Markdown

@Tomas2D Tomas2D commented Apr 22, 2026

Problem

envMappings on AppDefinition was optional, and only the Google Workspace family (gmail + the google-* apps) declared one. Granting any other connection — GitHub, GitHub Enterprise, YouTube, Resend, Spotify — through /api/connections returned envMappings: null, so the consuming platform (e.g. Humr) had no env contract to inject into the agent pod. The gateway already knew how to authenticate requests to those hosts (see apps/gateway/src/apps.rs), but agents ran with no credential env set, so tools like gh never picked up the token.

The omission was easy to miss because the field was optional — a new provider could ship without anyone noticing there was no env wired up.

Changes

  • AppDefinition.envMappings is now required, so a new app cannot ship without declaring the env contract its CLI/SDK consumers expect.
  • githubEnvMappingsGH_TOKEN, shared by github and github-enterprise (mirrors the googleWorkspaceEnvMappings pattern).
  • youtube reuses googleWorkspaceEnvMappings (same Google OAuth token).
  • resendRESEND_API_KEY.
  • spotifySPOTIFY_ACCESS_TOKEN.

No route changes needed — /api/connections already joins envMappings from the registry, so every row will now carry a non-null array for known providers.

Test plan

  • pnpm check (lint + types + prettier + cargo fmt)
  • pnpm test (gateway Rust tests, 192 passing)
  • Smoke-test in a consumer (Humr): grant GitHub, confirm GH_TOKEN=humr:sentinel is injected into the agent pod and gh auth status works through the gateway

Previously only the Google Workspace family declared envMappings, so
granting GitHub, YouTube, Resend, or Spotify in a consumer (e.g. Humr)
produced no pod env — the consumer would run the agent with no env
contract, despite the gateway already knowing how to inject auth for
those hosts. The omission was easy to miss because the field was
optional.

- Make `envMappings` required on `AppDefinition` so a new app cannot
  ship without declaring the env contract its CLI/SDK consumers expect.
- Add `githubEnvMappings` (GH_TOKEN) shared by github + github-enterprise.
- YouTube reuses googleWorkspaceEnvMappings (same Google OAuth token).
- Resend declares RESEND_API_KEY; Spotify declares SPOTIFY_ACCESS_TOKEN.

No route changes — `/api/connections` already joins `envMappings` from
the registry, so every connection row will now carry a non-null value
for known providers.

Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
@Tomas2D Tomas2D requested a review from matoushavlena April 22, 2026 15:23
Tomas2D added a commit to kagenti/humr that referenced this pull request Apr 22, 2026
When a user granted an app connection (GitHub, Google, etc.), there was
no indication in the dialog that doing so would inject env vars into
the agent pod — only granted *secrets* contributed to the "Inherited"
list, and app rows didn't show their declared env names at all. Users
had to exec into the pod to discover the contract.

- ConnectionsPicker: app rows now render their declared env names
  under the label, matching how secret rows display them.
- EditAgentSecretsDialog: granted-app envMappings flow into the
  Environment tab's "Inherited · managed elsewhere" list, deduped
  against user-edited entries so the "Custom" override path still wins.

Depends on kagenti/onecli#18 — once that ships, every app connection
returns a non-null envMappings array and the UI lights up for all of
them (not just Google Workspace).

Signed-off-by: Tomas Dvorak <toomas2d@gmail.com>
@matoushavlena matoushavlena merged commit 3d81d94 into main Apr 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants