feat(desktop): schema-certified env scaffolding for agent snapshots - #3845
Draft
monotykamary wants to merge 1 commit into
Draft
feat(desktop): schema-certified env scaffolding for agent snapshots#3845monotykamary wants to merge 1 commit into
monotykamary wants to merge 1 commit into
Conversation
Unify env/credential handling across snapshots, runs, and chat-completions with a schema-certified contract path: - definition.environment exports env key NAMES as import scaffolding (sorted, reserved/malformed filtered); values stay non-serializable. - definition.environmentValues accepts import-only value hints from external producers (e.g. a control plane shipping an OpenAI-compatible API route). Secret-named keys are dropped to blank scaffolding, undeclared keys ignored, count/per-value capped at decode; Buzz export never writes the field. Preview surfaces pre-filled keys. - Run-scoped env overlay merges into agent_runtime_env for declared keys across every run mode, incl. contract-less/legacy imports. - agent_runtime_env is the single consumer-visible truth surface for declared env values; contract terms fire only when schemas exist. - env.get_credential resolves through the central credential-name normalizer (fail-closed on ambiguous input). - Persona and loop export/import propagate scaffolding; the env vars module remains the only keeper of secret-bearing literals. - egress_guard inventories follow the persona-import module split. cargo test --lib: 2021 passed, 0 failed cargo clippy --lib --all-features: clean cargo fmt --check: clean Signed-off-by: Inloop.Studio <170839203+inloopstudio@users.noreply.github.com>
Contributor
|
huge diff. if you can carve the schema-certified path into its own pr, review will go a lot faster |
monotykamary
marked this pull request as draft
July 31, 2026 15:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Unify env/credential handling across snapshots, runs, and chat-completions, with a schema-certified contract path — and let an external control plane ship an agent manifest whose non-secret configuration (e.g. an OpenAI-compatible API route) arrives pre-wired, while credentials still stay out of snapshot files by construction.
env_varsschema; scaffolds hold key names only (definition.environment), never selected values, wrapper or not.definition.environmentValues— import-only value hints for non-secret config. Buzz's own export never writes this field. At import, every hint must reference a key also declared inenvironment; keys whose name marks a credential (e.g.*_API_KEY,*_TOKEN) are dropped to blank scaffolding so a producer can never smuggle a live secret into a manifest. Both count- and per-value-capped at decode (MAX_SNAPSHOT_ENV_KEYS/MAX_ENV_VALUE_BYTES). Motivating case: a hosted control plane exportsOPENAI_COMPAT_BASE_URLso the imported agent starts pointed at the right endpoint; only the API key is pasted by the owner. The import preview surfaces which keys arrive pre-filled.agent_runtime_envfor declared keys, keeping schema-owned contracts intact across every run mode — including contract-less exported imports and legacy keyless snapshots.agent_runtime_envis the only consumer-visible truth surface for declared env values (canonical resolution path) — but only where the values fit the declared schema. Selected credential names are recycled as the snapshot's own values, never as provider-scoped storage.env.get_credentialresolves through the central credential-name normalizer, so ambiguous inputs uniformly fail closed instead of edge-case-matching a real credential.snapshot_json, imports back through the shared splitter, and legacy top-levelenv_varsblobs round-trip partner-aware.Key invariants preserved:
agent_runtime_envreads.env.*andagent_env.*API contracts are untouched.Related issue
None found (searched open PRs/issues for environment/snapshot overlap). Producer-side counterpart (external control plane emitting
environmentValueshints): app.inloop.studio PR #476.Testing
cargo test --lib— full suite green (2,000+ tests), including new coverage for:env.get_credentialresolution edgesegress_guardinventories updated for the persona-import module splitAlso
cargo clippy --lib --all-featuresclean andcargo fmt --checkclean.