Introducing a new way to review your PRs.

Read the announcement

tracer-cloud / opensre

The open-source agent for CI/CD reliability.

View on GitHub

25 documents · Updated Nov 23, 2026

docs / configuration-resolution

Configuration resolution and identity

Configuration resolution turns process inputs and saved local choices into validated runtime settings. It also gives each operational turn an owner, an acting user, and a storage scope so credentials, model access, usage reporting, and stored work use the same identity boundary. This page complements Configuration and security boundaries and State, evidence, and file storage.

Configuration sources

OpenSRE uses separate sources for process inputs, local preferences, setup choices, and host context. Runtime environment values affect the current process, while files under the OpenSRE home directory preserve local choices for later runs.

Process environment

The process environment is the main runtime input. OpenSRE loads a project .env file only for names that are not already set, so an explicit environment value remains authoritative. The loader accepts standard assignments and optional export prefixes. A bundled install can redirect the file path.

The local environment also supports a setup-store bridge for bundled installs. Persisted non-secret LLM provider and model choices can fill unset environment names when no explicit project environment path is set. This bridge does not replace explicit runtime values.

References: config/local_env.py• L14-16 config/local_env.py• L40-63 config/local_env.py• L82-123 config/env_assignment.py• L12-24

Deployment environment

The deployment environment is a runtime label that distinguishes production from development. It describes process hosting and does not identify a customer or actor. Hosted deployment settings also describe how a silo receives organization credentials, while ORGANIZATION_ID remains the serving identity.

References: config/environment.py• L1-10 config/…/tenancy.py• L1-29 config/…/tenancy.py• L36-52

Local settings

The local settings file is ~/…/config.yml, or the equivalent redirected OpenSRE home. It stores user preferences in named sections and preserves unrelated sections when one section changes. For interactive settings, command-line input takes priority over environment values, which take priority over local settings and built-in defaults.

References: config/local_settings.py• L1-10 config/local_settings.py• L26-70 config/repl_config.py• L63-86 config/repl_config.py• L131-177

Setup store

The setup store is ~/…/opensre.json, with an override for isolated runs. It records onboarding choices such as the local LLM target, provider, model, authentication method, and probe results. These values are durable setup metadata rather than request-time secrets.

The runtime uses this store only where its policy allows it. For example, a bundled install can use its local target to fill unset LLM environment values. Remote endpoint and operational scope choices remain setup data until the feature that uses them resolves them.

References: config/setup_store.py• L1-27 config/setup_store.py• L45-85 config/setup_store.py• L88-114

Terminal host context

Terminal host context describes where an interactive process runs and how its output should behave. Environment hints identify remote SSH sessions, graphical displays, Windows Subsystem for Linux, and the hosting terminal. Size and color hints help a child process render correctly when no terminal is attached.

This context also affects user-facing flows such as whether a browser can open locally or the user must complete a remote sign-in step. It is runtime context, not customer identity or credential ownership.

References: config/…/terminal_host.py• L1-24

Configuration vocabulary

Shared configuration names and defaults form a common process vocabulary. This vocabulary describes deployment, storage, model selection, access, runtime controls, integration targets, Kubernetes access, and bounded telemetry queries without making those settings part of the turn's principal.

Shared names and defaults

The shared constants package presents names from focused leaf modules through one public namespace. It loads a leaf only when a caller uses one of its names, while static re-exports keep those names visible to type checkers.

The most important names define boundaries rather than individual features:

  • Deployment identity: ORGANIZATION_ID identifies the organization served by a deployment. ENV describes the deployment process.
  • Storage identity: OPENSRE_HOME and OPENSRE_CONTEXT_ROOT select host and organization storage roots.
  • LLM selection: Provider, endpoint, model-tier, custom gateway, and API-key names describe which model path the process may use. Local model selection does not change OpenSRE account identity.
  • Integration access: Chat allowlists, token names, integration connection settings, Kubernetes kubeconfig, context, and namespace settings, and Neon project or branch settings describe which inbound systems, external tools, or database resources a deployment may use. Neon branch connection hosts come from the Neon control-plane response rather than from a fixed shared host setting.
  • Account and runtime controls: Account routes, autonomy levels, scheduler settings, gateway limits, memory settings, tool boundaries, and telemetry query bounds shape local and hosted execution without changing the turn's owner.

The shared catalog separates product telemetry controls from credentials that a user supplies for an integration. Telemetry investigation limits bound the time window, lookback, item count, response size, and result rows for opt-in evidence queries. A configuration name therefore does not by itself mean that its value belongs to the customer or to the product.

The catalog also carries controls for background work and skill delivery. Scheduler settings state whether the gateway hosts the scheduler, identify the running build, and give shared names to missed fires and work outcomes. Skill settings control the local skill source, signed release updates, trusted keys, release limits, and catalog version. These values coordinate runtime behavior, but they do not become part of the turn's principal.

References: config/…/__init__.py• L1-16 config/…/__init__.py• L808-822 config/…/__init__.py• L1509-1537 config/…/__init__.py• L1617-1675 config/…/exports.py• L1-12 config/…/exports.py• L355-360 config/…/exports.py• L642-651 config/…/kubernetes.py• L1-17 config/…/neon.py• L1-20 config/…/tool_discovery.py• L1-96 config/…/account.py• L8-72 config/…/repl_autonomy.py• L14-87 config/…/paths.py• L49-68 config/…/telemetry.py• L1-12 config/…/scheduler.py• L5-27 config/…/scheduler.py• L29-59 config/…/skills.py• L86-120

Interactive runtime controls

Interactive autonomy controls how much approval a REPL turn needs before it uses tools. The default is High, which allows all normal actions; lower levels ask before shell or mutation-capable tools, and Off asks for every tool type.

Autonomy is an approval policy, not a shell-command allowlist. Some tools remain approval-required at every level, and a session approval does not cover excluded arguments such as network access for generated Python code.

References: config/…/repl_autonomy.py• L1-6 config/…/repl_autonomy.py• L14-29 config/…/repl_autonomy.py• L49-87

LLM model settings

LLM settings describe the selected provider path and its model choices. The system supports a shared custom model setting plus explicit per-tier settings for custom OpenAI- and Anthropic-compatible gateways. These settings select models; they do not identify the account that owns a turn.

Custom gateway URLs preserve user paths for OpenAI-compatible clients. Anthropic-compatible clients remove one trailing /v1 because the client adds that path itself. Loopback hosts default to HTTP, while other hosts default to HTTPS.

References: config/…/llm.py• L20-36 config/…/llm.py• L74-119 config/…/llm.py• L121-161

Strict runtime configuration

Validated configuration prevents an unknown or incomplete setting from silently changing runtime behavior. StrictConfigModel rejects unknown fields and trims string values, while each runtime model adds rules for its own values.

LLM settings

LLMSettings resolves one configured provider, its model tiers, endpoint details, and request limits from the loaded environment. Provider names are checked against the supported catalog, and provider-specific values are checked only when that provider is active. Resolution does not silently try another provider.

The settings result describes the configured model path. Diagnostic views can report the provider, authentication path, and credential status without exposing secret values.

References: config/strict_config.py• L11-66 config/llm_settings.py• L109-159 config/llm_settings.py• L168-227 config/llm_settings.py• L230-377 config/llm_settings.py• L406-434

LLM credentials

LLM authentication is resolved when a request needs it. This keeps secret values out of general configuration objects and lets each provider use the authentication mode that fits its runtime.

Authentication paths

Provider selection and credential lookup are separate concerns. API-key providers use provider-specific names. Subscription providers use verified provider records and connection settings. Vendor CLI providers use CLI state, ambient providers use cloud credential chains, and local providers use a local model endpoint.

The main credential paths are:

  • Environment: An API key already present in the process.
  • Secure local storage: An owner-only local credentials file used when the environment has no key.
  • Subscription: A verified provider sign-in whose secret material stays behind the secret boundary.
  • CLI, ambient, or local runtime: Authentication handled by a vendor CLI, a cloud credential chain, or a local model host.

LLM_AUTH_METHOD is a retired selector. Environment synchronization removes it from older .env files instead of treating it as a second active route.

References: config/…/llm.py• L20-36 config/…/credentials.py• L27-91 config/…/credentials.py• L414-496

Credential status

Credential status is a prompt-safe view of provider configuration and availability. It does not read stored secret values. The connection view reports saved environment or metadata evidence without live CLI, ambient, network, or secret checks. The regular status view may check a vendor CLI or an ambient credential path, while request resolution is the separate operation that obtains an API key or confirms a keyless route.

For API-key providers, request resolution checks the process environment first and then the local credentials file. A missing key produces an actionable error for the selected provider. A failed request can mark saved metadata stale, so old metadata does not prove that a secret still works. Explicit verification runs request-time resolution and refreshes the reported result.

Ambient status can perform a real credential check. For example, Vertex AI needs usable application credentials and a project, while Bedrock needs an AWS region before it reports a usable ambient path. Local model status reports the configured local host as a keyless route.

References: config/…/credentials.py• L116-174 config/…/credentials.py• L206-249 config/…/credentials.py• L252-395 config/…/credentials.py• L414-463 config/…/credentials.py• L546-558

Provider records

Provider records store non-secret connection evidence in the OpenSRE home area. They let status commands report the provider, authentication kind, source, verification state, staleness, and user-facing detail without reading a token. Writes use a file lock and replace the file as one update so concurrent status or setup work does not mix records.

The records also keep a non-secret model catalog. A model catalog is a cached list of provider choices that can be read without network access or credential resolution. Invalid cached data is ignored, and saving models preserves the provider's other metadata.

References: config/…/records.py• L1-5 config/…/records.py• L21-85 config/…/records.py• L103-183 config/…/model_catalog.py• L1-36

Secret storage boundary

Secret storage is separate from public .env settings. Name-based sensitivity rules send sensitive values to secure local storage and non-sensitive values to .env. A rewrite also removes old sensitive assignments from .env, which helps clean up files created by older versions.

At request time, an API-key provider uses environment-first lookup and then the local credential store. Status can inspect metadata and availability without reading secret values; explicit request resolution is the point that obtains the value. When a key comes from the local credentials file, request resolution records that fallback source as verified non-secret metadata.

References: config/env_key_sensitivity.py• L1-47 config/env_file.py• L1-23 config/env_file.py• L161-198 config/…/store.py• L1-15 config/…/store.py• L56-88 config/…/credentials.py• L398-463 config/…/credentials.py• L510-533

Runtime identity

Runtime identity answers two related questions: who owns the data and credentials, and who is acting now. The system represents the answer as a principal plus an actor and carries it as a storage scope for one turn.

Principal and actor

A principal is the owner of credentials, integrations, and billing for an install context. It is an organization or an individual. An actor is the person taking the turn, so one organization can have many actors without mixing their private session data.

Chat transports resolve the organization from ORGANIZATION_ID and pair it with the platform user id as the actor. A missing organization identity stops a chat turn. CLI and interactive-shell work stays unbound because it has no customer-owned chat scope. A remote prompt with no actor uses the gateway's explicit remote-shell fallback.

Hosted account connections carry owner kind, owner id, default status, and retrieval origin. These markers keep an organization connection distinct from a member's personal connection and distinguish local retrieval from web-app retrieval. A hosted LLM request can also carry the acting member through the actor header contract used for usage attribution.

Hosted silos keep provisioning identity separate from serving identity. Control-plane markers show how a process was provisioned, while ORGANIZATION_ID says which organization it serves.

References: config/principal.py• L1-75 config/…/organization.py• L1-23 config/…/tenancy.py• L13-29 config/…/account.py• L12-18 config/…/account.py• L35-66 config/…/gateway.py• L57-71 gateway/…/principal.py• L24-79 gateway/…/principal.py• L18-38 gateway/…/principal.py• L32-71

Scope binding

StorageScope combines the principal and actor for one turn. Gateway ingress binds that scope around the turn, and storage helpers read it from the current execution context. The binding ends with the turn so one process can serve many actors in sequence.

Worker threads do not inherit this context automatically. Work sent to a thread pool must carry a copied scope context or storage code sees no scope and may use the wrong root. Credit attribution normally follows the actor in the scope, while background work can bind an explicit reporting actor for usage reporting only.

The flow from inbound identity to scoped storage is:

flowchart LR
    A[Inbound platform identity] --> B[Resolve organization principal]
    A --> C[Resolve platform actor]
    B --> D[Storage scope]
    C --> D
    D --> E[Bind for one turn]
    E --> F[Resolve session and storage roots]
    E --> G[Attribute hosted model spend]

References: config/scope_context.py• L1-50 config/…/gateway.py• L57-71 config/credit_attribution.py• L20-64 gateway/…/principal.py• L72-79

Storage roots

The active scope selects where customer-owned state is stored. An organization-scoped turn uses the configured context mount when that mount belongs to the same organization. Without a mount, local development nests the organization below the OpenSRE home. The actor then selects a private user area inside the organization root.

An unbound caller uses the host OpenSRE home rather than guessing a customer owner. Mount ownership checks reject a mismatch instead of writing one organization's data into another organization's volume. Organization knowledge and integration credentials use organization scope, while sessions, memory, and work items remain actor-scoped.

References: config/…/paths.py• L49-68 config/…/paths.py• L103-182 config/…/paths.py• L192-217 config/…/knowledge.py• L11-25 config/…/tenancy.py• L36-48

Resolution flow

Configuration and identity resolution are linked but not interchangeable. Configuration establishes what the process can use; inbound identity establishes whose data the operation may read or write. Together they form the runtime context passed to agent, integration, usage, storage, and bounded telemetry services.

When a process starts or a turn arrives, the broad sequence is:

  1. Load the selected .env file without replacing explicit process values.
  2. Apply allowed local setup defaults and read local settings where the feature needs them.
  3. Validate the active LLM and other strict settings.
  4. Resolve provider credentials at request time.
  5. Resolve the principal and actor for the operation.
  6. Bind the storage scope before code accesses scoped state.
  7. Carry the scope's actor, or an explicit background actor, into hosted usage attribution.

The sequence keeps public settings, secret values, tenant identity, and usage reporting in separate boundaries. Invalid configuration fails validation. Missing credentials fail request resolution. Missing or mismatched ownership fails scope resolution.

Change checklist

When these files or sections are changed, remember to consider these:

  • Changes to provider names, model settings, or authentication kinds must update the provider catalog, strict LLM settings, API-key names, provider records, and the public constants catalog together.
  • Changes to custom model or gateway settings must preserve the shared model vocabulary and the different URL rules for OpenAI-compatible and Anthropic-compatible clients.
  • Changes to API-key resolution must preserve environment-first lookup, local credential fallback, prompt-safe status, stale metadata, and actionable missing-credential errors.
  • Changes to provider status must keep configuration evidence separate from live verification and request-time secret resolution.
  • Changes to provider records or model catalogs must preserve the non-secret boundary and must not overwrite existing provider metadata.
  • Changes to environment assignment parsing or key sensitivity must stay aligned with both .env readers and writers and with secret lookup paths.
  • Changes to the constants catalog must update the leaf module, the export map, and the package's static type re-exports so runtime and type-checker views agree. This includes telemetry bounds and credentials as well as integration leaves such as Kubernetes and Neon and policy leaves such as tool discovery.
  • Changes to scheduler hosting, build stamps, missed-fire handling, or work outcome names must keep the scheduler, runners, and history views on the same shared contract.
  • Changes to skill release settings must keep the catalog version, trusted release keys, update controls, release limits, and server paths aligned so a valid skill release is accepted once and an unsafe release is not activated.
  • Changes to telemetry investigation limits or credentials must keep the public export map, static re-exports, and telemetry leaf aligned so query bounds and secret names resolve through the same package interface.
  • Changes to Neon integration settings must keep the control-plane API base, API-key name, and project and branch selectors aligned with the API's reported branch hosts.
  • Changes to Kubernetes settings must keep kubeconfig path or content, context, and namespace names aligned across the leaf module, export map, and static re-exports.
  • Changes to account identity markers must preserve actor forwarding, organization-versus-member ownership, default connection status, and local-versus-web-app origin.
  • Changes to autonomy levels must keep the displayed labels, approval sets, default level, and always-ask tool rules aligned.
  • Changes to terminal host detection must preserve the distinction between remote sign-in context, display availability, and terminal rendering hints.
  • Changes to principal or actor construction must preserve the transport boundary: chat platforms resolve inbound identity, while CLI and shell callers remain unbound.
  • Changes to context-root or organization handling must preserve the mount owner check and the distinction between deployment identity and per-turn scope.
  • Changes that move scoped work into a worker thread must carry the current context explicitly.

Important failure modes

TriggerConsequenceGuard
Unknown field or invalid provider in strict runtime settingsResolution stops instead of using an unintended valueStrict configuration rejects extras and LLM settings validate provider names
A selected API-key provider has no environment or local credentialThe request cannot authenticateRequest-time resolution checks environment, then secure local storage
A provider record is stale or malformedStatus can show old evidence, or cached model choices disappearRecords track verification and staleness; model catalog reads reject invalid data
Configuration evidence is treated as live authenticationA status view can claim only saved metadata while a request still failsUse explicit verification or request-time resolution for live checks
A custom gateway URL keeps the wrong /v1 shapeThe request can fail with a duplicated client pathUse the provider-specific URL normalizers
Sensitive environment value is sent to .env storageSecret data can be written to the wrong boundaryName-based sensitivity checks route secrets to secure local storage
Organization identity is missing for a chat turnThe turn is refused instead of receiving a guessed ownerTransport principal resolution fails closed
Bound organization differs from the mounted context ownerData could cross tenant boundariesContext-root ownership validation rejects the turn
Scoped turn runs in a worker without copied contextStorage code sees no current scopeWrap worker callables with the current scope context
A new constant is added to a leaf but not to the export map or static re-exportsRuntime callers or type checkers cannot see the same public nameKeep the leaf module, lazy export map, and static re-exports synchronized
Gateway and standalone scheduler settings enable the same scheduler loopA scheduled task can run twiceKeep the host-scheduler setting and scheduler service mode mutually exclusive
A skill release uses an unsupported catalog version or an untrusted signing keyThe release is not activatedKeep the supported version and trusted release-key set aligned with the release service
Telemetry query bounds or credentials are added to only one constants viewInvestigation code can miss the setting or type checking can disagree with runtimeAdd the name to the telemetry leaf, lazy export map, and static re-exports
Neon project or branch settings do not match the API-reported resourceDatabase or object-storage access can target the wrong resource or fail to connectResolve branch hosts from the Neon control plane and keep project and branch selectors together
Kubernetes names are added to only one constants viewIntegration setup can fail to resolve a kubeconfig, context, or namespace settingAdd each name to the Kubernetes leaf, lazy export map, and static re-exports
An autonomy label or approval set changes without the matching policy entryThe REPL can show one approval promise while enforcing anotherKeep level captions, ask sets, and always-ask exceptions in one aligned catalog
Changes to terminal host detection preserve the distinction between remote sign-in context, display availability, and terminal rendering hintsA user-facing flow can select the wrong sign-in or rendering pathKeep host, display, remote-session, and terminal-rendering signals separate
A principal or actor is constructed for an unbound CLI or shell callerLocal work can receive a guessed customer ownerKeep chat identity resolution at the transport boundary and leave CLI and shell callers unbound
Context-root or organization handling skips the mount owner checkOne organization's data can be written into another organization's volumeValidate mount ownership before resolving organization storage roots

Key files

FileWhy to read it
config/local_env.pyDefines project .env selection, load order, and setup-store defaults.
config/local_settings.pyOwns the shared local settings boundary.
config/setup_store.pyShows how onboarding choices and local targets persist.
config/strict_config.pyDefines common fail-fast configuration behavior.
config/llm_settings.pyConnects environment values to validated LLM runtime settings and diagnostics.
config/…/llm.pyDefines LLM names, credential names, model settings, and endpoint normalization rules.
config/…/credentials.pySeparates prompt-safe status, explicit verification, and request-time credential resolution.
config/…/records.pyDefines non-secret provider connection evidence and its persistence boundary.
config/…/model_catalog.pyDefines cached provider model choices without network or credential access.
config/principal.pyDefines principal, actor, and storage-scope identity objects.
config/scope_context.pyDefines per-turn scope binding and worker context propagation.
config/…/paths.pyMaps identity scope to host, organization, actor, integration, memory, and knowledge roots.
config/…/account.pyDefines account, actor-forwarding, hosted connection ownership, and account endpoint contracts.
config/…/neon.pyDefines the Neon control-plane endpoint and the environment names for API, project, and branch selection.
config/…/kubernetes.pyDefines the environment names used to select Kubernetes configuration, context, and namespace scope.
config/…/telemetry.pyDefines the telemetry credential name and bounds for investigation evidence queries.
config/…/tool_discovery.pyDefines shared bounds and outcome labels for progressive tool discovery.
config/…/repl_autonomy.pyDefines interactive approval levels and the tools that require approval.
config/…/scheduler.pyDefines scheduler hosting controls, timing bounds, and shared background-work outcome names.
config/…/skills.pyDefines onboarding skill names and the signed skill-release settings used by startup and prompt assembly.
config/…/terminal_host.pyDefines host, display, remote-session, and terminal-rendering environment hints.
config/…/exports.pyMaps public constant names to their lazy leaf modules.
config/…/__init__.pyProvides the package-level public and static type views of shared constants.
gateway/…/principal.pyIllustrates organization and workspace checks for a chat transport.