Skip to content

feat: provider/model selection for personas and runtime-aware env injection#794

Merged
wpfleger96 merged 1 commit into
mainfrom
wpfleger/phase3b-normalized-config
Jun 9, 2026
Merged

feat: provider/model selection for personas and runtime-aware env injection#794
wpfleger96 merged 1 commit into
mainfrom
wpfleger/phase3b-normalized-config

Conversation

@wpfleger96

@wpfleger96 wpfleger96 commented May 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Decouples provider/model configuration from goose-specific config files. Personas now carry an explicit provider field, and the desktop injects runtime-appropriate env vars when spawning agents. Pack imports filter derived provider/model env keys so stale values cannot shadow the structured fields after UI edits.

Rebased on top of #868 (Wes's Databricks-defaults-env-only PR) — all goose config compat code removed from sprout-agent.


Changes

sprout-agent

sprout-persona

  • resolve.rs: runtime_env_vars() branches on the runtime field to emit runtime-appropriate env var names (SPROUT_AGENT_MODEL/SPROUT_AGENT_PROVIDER for sprout-agent, GOOSE_MODEL/GOOSE_PROVIDER for goose)
  • New tests/e2e_env_flow.rs: 5 integration tests covering env var emission for both runtimes

desktop/src-tauri

  • types.rs: Add PersonaRecord.provider: Option<String> field
  • runtime.rs: Add runtime_metadata_env_vars() — injects model/provider env vars from discovery table metadata. Placed before build_databricks_defaults() and user env vars.
  • discovery.rs: model_env_var: Some("SPROUT_AGENT_MODEL") for sprout-agent runtime; stale doc comments updated to reflect vestigial MCP field and scaffolding supports_acp_model_switching field
  • migration.rs: Add reconcile_provider_mcp_commands() and migrate_persona_provider_to_runtime()
  • lib.rs: Wire reconcile_provider_mcp_commands() into app startup (between reconcile_persona_pack_paths and migrate_persona_provider_to_runtime)
  • persona_card.rs: Emit llmProvider in exported persona JSON
  • env_vars.rs: Add DERIVED_PROVIDER_MODEL_ENV_KEYS constant, is_derived_provider_model_key(), and filter_derived_provider_model_env_vars() — identifies env keys that are derived from structured fields and must not be persisted
  • env_vars/tests.rs: 6 regression tests for the derived-key filter
  • personas.rs: import_persona_pack now filters runtime_env_vars through filter_derived_provider_model_env_vars() before persisting to PersonaRecord.env_vars, preventing stale GOOSE_MODEL/GOOSE_PROVIDER values from shadowing structured fields after UI edits
  • commands/agents.rs: build_deploy_payload resolves effective_model and effective_provider from the persona's structured fields (with agent record override) and projects them into the deploy JSON

desktop/src (TypeScript)

  • PersonaDialog.tsx: Provider selection UI
  • personaDialogState.ts + test: provider field round-trip
  • tauriPersonas.ts, types.ts: provider field in API types

Env Var Precedence

In spawn_agent_child, env vars are set in this order (last write wins):

parent env
→ runtime_metadata_env_vars()   # SPROUT_AGENT_MODEL / SPROUT_AGENT_PROVIDER
→ build_databricks_defaults()   # DATABRICKS_HOST / DATABRICKS_MODEL (Block builds only)
→ persona env_vars              # user-defined, from persona pack (derived keys filtered at import)
→ agent env_vars                # user-defined, per-agent override

User intent (persona/agent env vars) always wins. Build-time Databricks defaults are a fallback for Block employees — OSS builds bake nothing (intentional).


Not in scope

  • OSS Databricks gap (no DATABRICKS_HOST for OSS users) — intentional, Block-only convenience feature
  • System prompt forwarding — not a bug; ACP delivers prompts at the protocol layer

@wpfleger96 wpfleger96 force-pushed the worktree-wpfleger+fix-model-picker-runtime-ux branch from 5172532 to 6c90bad Compare June 1, 2026 20:42
@wpfleger96 wpfleger96 force-pushed the wpfleger/phase3b-normalized-config branch from e50bdbf to 41ebf2b Compare June 1, 2026 20:42
@wpfleger96 wpfleger96 force-pushed the worktree-wpfleger+fix-model-picker-runtime-ux branch from 6c90bad to d54f3c0 Compare June 3, 2026 19:38
@wpfleger96 wpfleger96 force-pushed the wpfleger/phase3b-normalized-config branch from 41ebf2b to 75d3077 Compare June 3, 2026 19:38
@wpfleger96 wpfleger96 force-pushed the worktree-wpfleger+fix-model-picker-runtime-ux branch from d54f3c0 to 9842fec Compare June 4, 2026 22:42
@wpfleger96 wpfleger96 force-pushed the wpfleger/phase3b-normalized-config branch 2 times, most recently from 30b434a to a81cc76 Compare June 4, 2026 22:48
@wpfleger96 wpfleger96 marked this pull request as ready for review June 5, 2026 16:07
@wpfleger96 wpfleger96 requested a review from a team as a code owner June 5, 2026 16:07
@wpfleger96 wpfleger96 force-pushed the worktree-wpfleger+fix-model-picker-runtime-ux branch from 094d114 to 70f9c0b Compare June 5, 2026 16:07
@wpfleger96 wpfleger96 force-pushed the wpfleger/phase3b-normalized-config branch from a81cc76 to 04391d4 Compare June 5, 2026 16:08
@wpfleger96 wpfleger96 force-pushed the worktree-wpfleger+fix-model-picker-runtime-ux branch from 70f9c0b to 643f3ec Compare June 5, 2026 20:17
@wpfleger96 wpfleger96 force-pushed the wpfleger/phase3b-normalized-config branch from 28b27b9 to ed5d9f1 Compare June 5, 2026 20:18
@wpfleger96 wpfleger96 force-pushed the worktree-wpfleger+fix-model-picker-runtime-ux branch from 643f3ec to c9b0d56 Compare June 6, 2026 00:48
@wpfleger96 wpfleger96 force-pushed the wpfleger/phase3b-normalized-config branch from 9466fc1 to 66de98f Compare June 6, 2026 00:49
@wpfleger96 wpfleger96 force-pushed the worktree-wpfleger+fix-model-picker-runtime-ux branch from c9b0d56 to dffa75e Compare June 6, 2026 01:02
@wpfleger96 wpfleger96 force-pushed the wpfleger/phase3b-normalized-config branch from 66de98f to 60f95a2 Compare June 6, 2026 01:02
Base automatically changed from worktree-wpfleger+fix-model-picker-runtime-ux to main June 7, 2026 18:41
@wpfleger96 wpfleger96 force-pushed the wpfleger/phase3b-normalized-config branch 3 times, most recently from e607cbf to 7b3a192 Compare June 8, 2026 15:32
@wpfleger96 wpfleger96 changed the title feat: normalized config schema with PersonaRecord.provider and SPROUT_AGENT_MODEL feat: provider/model selection for personas and runtime-aware env injection Jun 8, 2026
@wpfleger96 wpfleger96 closed this Jun 8, 2026
@wpfleger96 wpfleger96 reopened this Jun 8, 2026
@wpfleger96 wpfleger96 force-pushed the wpfleger/phase3b-normalized-config branch 4 times, most recently from db8a098 to de81ed1 Compare June 9, 2026 16:06
@wpfleger96 wpfleger96 force-pushed the wpfleger/phase3b-normalized-config branch from de81ed1 to 0c44d4e Compare June 9, 2026 17:57
@wpfleger96 wpfleger96 enabled auto-merge (squash) June 9, 2026 20:14
…e env injection

Add structured provider and model fields to PersonaRecord, with
runtime-aware env injection at spawn and deploy time. Pack import
filters derived provider/model env vars to prevent stale env values
from shadowing the structured fields.

Signed-off-by: Will Pfleger <wpfleger@block.xyz>
@wpfleger96 wpfleger96 force-pushed the wpfleger/phase3b-normalized-config branch from 0c44d4e to ba28ea0 Compare June 9, 2026 20:31
@wpfleger96 wpfleger96 merged commit 9a98e60 into main Jun 9, 2026
16 checks passed
@wpfleger96 wpfleger96 deleted the wpfleger/phase3b-normalized-config branch June 9, 2026 20:42
tlongwell-block pushed a commit that referenced this pull request Jun 10, 2026
* origin/main:
  Fix post-compact handoff context for OpenAI providers (#931)
  chore(release): release version 0.3.15 (#936)
  fix: persona is source of truth at spawn + thread-depth conventions (#930)
  fix: skip avatar reconciliation for legacy agent records (#933)
  feat(desktop): add nest commit identity guidance with human sign-off (#929)
  feat: provider/model selection for personas and runtime-aware env injection (#794)
  fix: reconcile agent profile on startup when relay publish was missed (#921)
  Revamp first-run onboarding (#924)
  Update setup loading screen (#926)
  fix(dm): keep hidden DMs hidden across refetch via relay-signed visibility snapshot (NIP-DV) (#857)
  Maximize desktop window on launch (#925)
  feat: preview features (experiments settings UI) (#888)
  fix(updater): send no-cache header on update check to avoid stale manifest (#922)
  fix(desktop): refresh channel state after unarchive (#923)
  Add channel visibility & ephemeral TTL controls to manage sidebar (#911)
  ci(release): add Intel macOS (x86_64) DMG as a release target (#748)

Signed-off-by: npub1mprnacetjua2xx3p5eddmhxyk6wv929ymm5py8kd2xfxurxahspqqlgyta <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@sprout-oss.stage.blox.sqprod.co>

# Conflicts:
#	desktop/src/features/sidebar/ui/AppSidebar.tsx
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