RFC 020: Runtime Profiles for Variables and Secrets

Status: Draft Date: 2026-06-01 Owner: Dagu core Scope: Product and architecture design

Summary

Add Runtime Profiles as the user-facing way to select a named set of variables and secrets when starting, enqueueing, retrying, or composing Dagu workflows. A profile is not another secret type. A profile is a runtime selection layer above Dagu-managed secrets and future non-secret variables.

The primary user outcome is simple: keep one DAG file and run it against local, staging, or prod values without rewriting the DAG and without relying on brittle .env file choreography.

Problem

Today, users can define DAG-level env:, load dotenv: files, or declare secrets: entries. These mechanisms work, but they make environment switching awkward:

  • env: is part of the DAG definition, so switching values often means editing YAML.
  • dotenv: depends on local files and path conventions that are easy to drift between machines.
  • secrets: protects values, but it does not by itself express a complete runtime context such as local or prod.
  • Testing a DAG against different targets requires repetitive declarations such as LOG_LEVEL: ${LOG_LEVEL}.

The missing primitive is not a new YAML field. It is a managed runtime context that can be selected outside the DAG file.

Mental Model

Managed Secret

A managed secret is one protected value. It is write-only through UI/API and decrypted only for run execution.

Secret:
  ref: prod/db-password
  value: ********

Runtime Profile

A profile is a named bundle of plain variables and secret variables injected into a run.

Profile: prod
Variables:
  LOG_LEVEL=info
  REGION=ap-northeast-1
Secrets:
  DB_PASSWORD=********
  API_TOKEN=********
Managed secret = secure value storage Profile = runtime selection and injection layer DAG + selected profile -> resolved run environment -> step process

A profile can be backed by the existing Dagu-managed secret store. The user should not need to manually create global secret names and map each one back into a profile for the normal case. The normal case is: open a profile, add a key, choose whether it is a variable or a secret, and run with that profile.

User Experience

Create Profiles

A user opens Profiles in the Web UI and creates local, staging, and prod. Each profile contains two explicit sections:

Section Used For Visibility
Variables Non-sensitive runtime values such as LOG_LEVEL, REGION, CLICKHOUSE_HOST. Values are visible to users with profile read permission.
Secrets Sensitive runtime values such as tokens, passwords, and DSNs. Values are write-only and masked after save.

Run Without YAML Rewrites

dagu start --profile local etl.yaml
dagu start --profile prod etl.yaml

The DAG can use the environment normally:

steps:
  - name: load
    run: python load.py "$CLICKHOUSE_DSN_PY" "$LOG_LEVEL"

There is no repeated pass-through block such as LOG_LEVEL: ${LOG_LEVEL}. The profile injects LOG_LEVEL directly.

Inspect Run History

Run history should show metadata, not plaintext:

Profile: local
Resolved at: 2026-06-01 14:31:20 JST
Injected keys:
  LOG_LEVEL          variable
  CLICKHOUSE_HOST    variable
  CLICKHOUSE_DSN_PY  secret
  API_TOKEN          secret

Retry Defaults

Retry defaults to the previous attempt's profile name and resolves the latest values at retry attempt start. Profile selection is immutable across CLI, API, queue, scheduler, and subprocess retry paths. Profile overrides are not accepted for retries:

dagu retry 20260601T143120Z
Important latest-value behavior Dagu should not pin profile revisions in v1. The run history records the profile name and resolved key names. The actual values are the latest profile values at attempt start.

Workflow Examples

Before

env:
  - LOG_LEVEL: ${LOG_LEVEL}
  - CLICKHOUSE_HOST: ${CLICKHOUSE_HOST}

secrets:
  - name: CLICKHOUSE_DSN_PY
    provider: env
    key: CLICKHOUSE_DSN_PY

steps:
  - run: python foo.py "$CLICKHOUSE_DSN_PY"

After

steps:
  - run: python foo.py "$CLICKHOUSE_DSN_PY"

Selected Profile

Profile: local
Variables:
  LOG_LEVEL=debug
  CLICKHOUSE_HOST=localhost
Secrets:
  CLICKHOUSE_DSN_PY=********

Profile: prod
Variables:
  LOG_LEVEL=info
  CLICKHOUSE_HOST=clickhouse.internal
Secrets:
  CLICKHOUSE_DSN_PY=********

External Patterns

Popular workflow, CI, deployment, and developer tools converge on a few patterns. The Dagu design should take the useful parts and avoid copying their friction.

Tool Relevant Pattern Dagu Takeaway
CircleCI Contexts are named groups of environment variables injected at runtime. Named profile/context injection is a proven user model.
GitHub Actions Jobs can target environments, and environments can have variables, secrets, and protection rules. Environment selection and secret/variable grouping belong at run/job selection time.
GitLab CI/CD Variables can be scoped to environments and protected/masked. Same key can carry different values by runtime target, but masking is not containment.
Doppler A selected config is injected into a command with doppler run. CLI selection should be short and process-oriented: dagu start --profile local.
Prefect Variables are non-sensitive; blocks store typed configuration and secrets. Keep plain variables and secrets distinct, even if they are injected together.
Dagster Code can declare environment variable dependencies through EnvVar. Explicit dependencies are safer, but too verbose for Dagu's target use case.
Kubernetes and Argo Workflows ConfigMaps and Secrets can be injected as env vars or mounted files. Bulk injection is common, but values become readable by the process.
Netlify and Vercel Environment variables are scoped to production, preview, development, or deploy contexts. Contextual values are expected UX for switching targets.

Goals and Non-Goals

Goals

  • Let users switch runtime values without editing DAG YAML.
  • Reuse the existing managed secret store for secret values.
  • Add a foundation for first-class non-secret variables.
  • Apply the same profile consistently across start, enqueue, retry, scheduled runs, sub-DAGs, and distributed workers.
  • Keep plaintext secret values out of queue records, run history, status records, API responses, and coordinator task payloads.
  • Expose clear run provenance: profile name, selected key names, source type, and resolution time.

Non-Goals

  • Do not add workspace-specific profile scoping in v1.
  • Do not add pinned profile revisions in v1.
  • Do not require required_env or repeated pass-through entries in DAG YAML.
  • Do not replace external secret managers such as Vault, Kubernetes Secrets, or cloud secret managers.
  • Do not claim to prevent a workload from leaking a secret after Dagu intentionally gives it the secret.
  • Do not make .env files the primary environment management mechanism.

Proposed Decision

Add a global Profile resource. A profile contains environment-variable-shaped entries. Each entry has a key, type, and value source.

Profile:
  name: local
  description: Local development dependencies
  variables:
    LOG_LEVEL: debug
    CLICKHOUSE_HOST: localhost
  secrets:
    CLICKHOUSE_DSN_PY: ********
    API_TOKEN: ********

A run may select zero or one profile. If no profile is selected, Dagu keeps the existing behavior. If a profile is selected, Dagu resolves the profile at attempt start and inserts the entries into the run environment before step execution.

Main design rule The profile name is durable run metadata. Profile values are resolved at attempt start and are not persisted as plaintext.

Naming

Name Assessment
profile Best fit. Neutral, short, not confused with DAG env:, and usable for local/staging/prod.
context Good precedent from CircleCI and Kubernetes, but may conflict with execution context terminology.
target Useful for deployment, less clear for testing or data-source switching.
stage Too deployment-specific.
environment Too easy to confuse with environment variables and YAML env:.

Public surfaces should use profile. Internal code can use runtimeprofile or profile depending on package context. API fields should use profile or profileName.

Data Model

Profile

{
  "id": "prf_...",
  "name": "local",
  "description": "Local development values",
  "status": "ACTIVE",
  "createdAt": "...",
  "updatedAt": "...",
  "createdBy": "...",
  "updatedBy": "..."
}

Profile Entry

{
  "profileId": "prf_...",
  "key": "CLICKHOUSE_DSN_PY",
  "kind": "SECRET",
  "value": null,
  "secretRef": "internal profile secret reference",
  "updatedAt": "..."
}
Field Rule
name Unique global slug. Recommended validation: lowercase letters, numbers, hyphen, underscore, and dot.
key Valid environment variable name: starts with a letter or underscore, then letters, numbers, or underscore.
kind VARIABLE or SECRET.
value Plain variable value. Stored as normal profile data.
secretRef Pointer to existing Dagu-managed secret storage. Not exposed as a stable public ref in v1.

Run Metadata

{
  "profileName": "local",
  "profileResolvedAt": "...",
  "profileInjectedKeys": [
    {"key": "LOG_LEVEL", "kind": "VARIABLE"},
    {"key": "CLICKHOUSE_DSN_PY", "kind": "SECRET"}
  ]
}

Do not store resolved values. Do not store secret revision pins. Do not store decrypted secret value hashes unless there is a concrete audit requirement; even hashes can create comparison and correlation problems.

Storage

Dagu should keep the storage split aligned with the current secret system:

Data Storage Plaintext Allowed?
Profile metadata <data_dir>/profiles or equivalent collection backend Yes
Profile plain variables Profile store Yes
Profile secret values Existing encrypted Dagu secret store at <data_dir>/secrets No durable plaintext
Run profile selection Queue/status/history metadata Profile name and key names only
Resolved runtime values In-memory execution environment only Yes, only inside runtime process boundary

The file backend should be one implementation of the profile store. The interface should remain collection-oriented so a database backend can use the same logical model later.

Resolution

Attempt Start Flow

Run request - DAG file/ref - params - selected profile name Attempt start 1. Load DAG. 2. Load dotenv and DAG env using existing behavior. 3. Resolve DAG secrets using existing behavior. 4. Resolve selected profile from profile store. 5. Decrypt profile secrets through existing secret store. 6. Build runtime EnvScope layers. 7. Start steps. Durable records - store profile name - store injected key names and kinds - never store plaintext values

Precedence

Insert the profile layer above DAG-level env/dotenv and below explicit DAG secrets:

  1. Step environment values.
  2. Output variables from dependency steps.
  3. DAG-declared secrets:.
  4. Profile secrets.
  5. Profile variables.
  6. DAG-level env:, dotenv:, params, and runtime metadata.
  7. Filtered process environment.

This makes profiles useful as runtime overrides while preserving the stronger intent of explicit DAG secrets:.

Collision Rules

  • A profile cannot contain the same key in both Variables and Secrets.
  • Profile keys must not start with DAGU_.
  • Profile keys that override DAG env: are allowed and shown in the run preview.
  • Profile keys that collide with DAG secrets: are allowed only if explicit DAG secrets win and the preview shows the override source.
  • A future strict mode can fail on collisions, but v1 should prioritize practical switching.

Execution Patterns

Pattern Profile Behavior Failure Mode
start CLI/API passes profile name. Values resolve at attempt start. Missing/disabled profile fails before steps start.
enqueue Queue record stores profile name only. Values resolve when dequeued and executed. If the profile changes before execution, latest values are used. If removed, the attempt fails.
retry Defaults to previous attempt's profile name. --profile can override. If previous profile no longer exists, retry requires an explicit replacement profile or fails.
Scheduled run Uses a saved default profile outside the DAG file, or no profile if unset. Missing profile fails the scheduled attempt before steps start.
Sub-DAG local Child inherits parent profile by default. Child fails if inherited profile cannot be resolved in the child execution context.
Sub-DAG distributed Task carries inherited profile name, not values. Worker must resolve via coordinator/runtime resolver or fail closed.
Distributed shared-volume Worker resolves profile through the common Dagu store or resolver. Store access or secret decrypt errors fail before steps start.
Distributed shared-nothing Worker asks coordinator/runtime resolver for the selected profile values at attempt start. If resolver is unavailable or unauthorized, worker fails the attempt before steps start.

Distributed Resolver Contract

To keep shared-nothing and shared-volume behavior consistent, add one runtime resolution boundary:

ResolveRuntimeProfile(taskId, attemptId, profileName) -> {
  variables: map[string]string,
  secrets: map[string]string,
  metadata: injected keys and kinds
}

Local execution can implement this by calling local stores directly. Distributed workers can call the coordinator. The coordinator validates that the worker owns the task before returning any plaintext.

Do not put plaintext values in coordinator tasks Coordinator task payloads, queue records, previous status records, and workflow bundle metadata must carry only profileName and non-secret metadata.

UI Design

Navigation

Add a top-level or settings-level page named Profiles. Avoid naming it "Environments".

Profile List

Column Purpose
Name local, staging, prod.
Status Active, disabled, protected.
Entries Counts for variables and secrets.
Last updated Human-readable update time and user.
Recent runs Links to run history filtered by profile name.

Profile Detail

Use tabs or segmented controls for Variables, Secrets, Usage, and Settings.

  • Variables table: key, value, updated by, updated at.
  • Secrets table: key, masked value marker, updated by, updated at, rotate action.
  • Usage table: recent runs and DAGs that selected the profile.
  • Settings: description, disabled state, protected state.

Run Dialog

Manual start, retry, and enqueue dialogs get a Profile dropdown. The dropdown includes No profile plus active profiles. Selecting a profile shows a compact preview:

local
  Variables: LOG_LEVEL, CLICKHOUSE_HOST
  Secrets: CLICKHOUSE_DSN_PY, API_TOKEN

Latest values will be resolved when the attempt starts.

Run History

Add a profile section to run detail pages. Display only profile name, resolution time, and key names. Secret values stay masked and unrecoverable through the UI.

UI Mockups

These mockups show the intended product shape. They are not final visual design, but they define the key surfaces, density, labels, and information hierarchy.

Profiles Index

Dagu Web UI Settings / Profiles
Dagu
Dashboard
DAGs
Runs
Profiles
Secrets
Settings

Profiles

Runtime values selected when a DAG run starts.

New profile
3Active profiles
18Variables
7Secrets
Runtime profiles Search profiles
Name Status Variables Secrets Last updated Recent use
local Active 6 2 Today 14:18 etl.clickhouse
staging Active 5 2 Yesterday 19:02 sync.customers
prod Protected 7 3 May 30 09:44 daily.pipeline

Profile Detail

Dagu Web UI Profiles / local
Dagu
Dashboard
DAGs
Profiles
Secrets

local

Local development dependencies and non-prod tokens.

Disable Add key
Variables Secrets Usage Settings
Key Value Source Updated
LOG_LEVEL debug Variable Today 14:18
CLICKHOUSE_HOST localhost Variable Today 14:18
CLICKHOUSE_DSN_PY ******** Secret Today 13:50
API_TOKEN ******** Secret May 29 10:11

Run impact

  • Selected by default
    None
  • Recent DAGs
    etl.clickhouse, sync.customers
  • Resolution
    Latest values at attempt start
  • Secret storage
    Dagu-managed encrypted store

Start Run Dialog

Dagu Web UI DAG / etl.clickhouse / Start

etl.clickhouse

Graph preview

extract transform load

Start DAG

Run with a selected runtime profile.

etl.clickhouse
local
local will inject 4 keys
  • Variables: LOG_LEVEL, CLICKHOUSE_HOST
  • Secrets: CLICKHOUSE_DSN_PY, API_TOKEN
  • Values resolve when this attempt starts.
date=2026-06-01
Cancel Start

Run History Profile Panel

Dagu Web UI Run / etl.clickhouse / 20260601T143120Z

etl.clickhouse

Attempt finished successfully in profile local.

Success
[14:31:20] resolving profile local [14:31:20] injected variables: LOG_LEVEL, CLICKHOUSE_HOST [14:31:20] injected secrets: CLICKHOUSE_DSN_PY, API_TOKEN [14:31:21] starting step extract [14:31:22] output: connected to ClickHouse [14:31:25] completed

Runtime profile

  • Name
    local
  • Resolved at
    2026-06-01 14:31:20 JST
  • Values
    Latest at attempt start
LOG_LEVELVariable
CLICKHOUSE_HOSTVariable
CLICKHOUSE_DSN_PYSecret
API_TOKENSecret

API and CLI

CLI

dagu profile list
dagu profile create local
dagu profile set-var local LOG_LEVEL debug
printf '%s' "$CLICKHOUSE_DSN_PY" | dagu profile set-secret local CLICKHOUSE_DSN_PY --value-stdin
dagu profile delete-key local LOG_LEVEL

dagu start --profile local foo.yaml
dagu enqueue --profile staging foo.yaml
dagu retry --profile prod <run-id>

The CLI may support import/export later, but import from .env should be a convenience operation, not the runtime model.

REST API Sketch

GET    /api/v1/profiles
POST   /api/v1/profiles
GET    /api/v1/profiles/{name}
PATCH  /api/v1/profiles/{name}
DELETE /api/v1/profiles/{name}

PUT    /api/v1/profiles/{name}/variables/{key}
DELETE /api/v1/profiles/{name}/variables/{key}

PUT    /api/v1/profiles/{name}/secrets/{key}
DELETE /api/v1/profiles/{name}/secrets/{key}

Run Request Extension

{
  "dag": "foo.yaml",
  "params": "...",
  "profile": "local"
}

Coordinator Task Extension

{
  "definition": "...",
  "previousStatus": "...",
  "profile": "local"
}

Security

Trust Boundary

Dagu can prevent plaintext profile secrets from appearing in Dagu durable state, UI responses, API responses, logs, queue payloads, and coordinator task payloads. Dagu cannot prevent a trusted workload from reading or exfiltrating a secret after the secret is injected into the process environment.

Permissions

Action Suggested Permission
View profile metadata and key names Viewer and above.
View plain variable values Developer/operator/manager/admin, subject to existing settings.
Create or edit profiles Manager/admin by default.
Set or rotate profile secrets Manager/admin by default.
Run with a profile Anyone allowed to run the DAG and allowed to use the selected profile.

Protected Profiles

Add a protected flag as a small but useful guard. Protected profiles can require higher roles or confirmation for manual use. This mirrors the idea behind protected deploy environments without adding a full policy engine in v1.

Masking

Profile secret values must be added to the existing masking set. Profile variables are not masked unless explicitly marked secret. Empty secret values should not create masker entries.

Migration

Existing DAGs

Existing DAGs continue to work. env:, dotenv:, and secrets: remain valid. Profiles are opt-in.

Existing Managed Secrets

Existing managed secrets remain usable through DAG secrets:. A later enhancement can let a profile secret reference an existing managed secret. The v1 default UX should still allow users to create profile-owned secret keys directly inside the profile page.

Import From Dotenv

Optional import is useful for onboarding:

dagu profile import-dotenv local .env

The import command copies keys into Dagu-managed profile storage. It does not make .env the source of truth.

Testing

Unit Tests

  • Profile name validation.
  • Profile key validation.
  • Variable/secret duplicate rejection within a profile.
  • Precedence layering with DAG env, dotenv, profile vars, profile secrets, DAG secrets, outputs, and step env.
  • Secret masking set includes profile secrets.

Integration Tests

  • start --profile local injects variables and secrets.
  • enqueue --profile local stores profile name and resolves latest values at execution.
  • retry defaults to previous profile name and resolves latest values.
  • retry --profile other overrides the previous profile name.
  • Sub-DAG inherits profile locally.
  • Distributed worker receives profile name and resolves values through the runtime resolver.
  • Run history contains key names but no plaintext secret values.
  • Logs mask profile secret values.

Regression Tests Inspired By Issue 2234

Include retry tests that combine runtime-loaded values with retry restoration. The previous dotenv retry bug happened because first-run dotenv behavior and retry restore behavior were tested separately. Profile tests should explicitly cover first attempt and retry attempt environment reconstruction.

Task List

Implementation should keep the profile name in the run attempt model from the first task. Local-only support must not be merged as a finished feature if retry, enqueue, and distributed execution still need incompatible metadata changes.

1. Core Model and Store

  • Add profile domain types: profile metadata, entry kind, variable entry, secret entry, status, protected flag.
  • Add profile store interface and file-backed implementation under the configured data directory.
  • Store plain variables in the profile store.
  • Store profile secret values through the existing encrypted Dagu-managed secret store.
  • Keep profile-owned secret refs internal; do not expose storage refs as a stable public API.
  • Validate profile names, entry keys, duplicate keys, reserved DAGU_ prefix, and profile status transitions.

2. Runtime Resolver

  • Add a single runtime profile resolver interface used by local execution and distributed execution.
  • Resolve latest profile values at attempt start.
  • Return variables, secrets, and non-secret metadata about injected keys.
  • Never return plaintext values to API/UI list or detail endpoints.
  • Add profile secrets to the existing masking path before step output can be written.
  • Enforce the precedence order: step env, outputs, DAG secrets, profile secrets, profile variables, DAG env/dotenv/params/runtime metadata, filtered process env.

3. Run Attempt Metadata

  • Add profileName to start, enqueue, retry, scheduler, sub-DAG, and coordinator task request paths.
  • Persist profile name, profile resolution time, and injected key names/kinds in run metadata.
  • Do not persist profile values, decrypted secret values, or resolved secret hashes.
  • Make retry default to the previous attempt's profile name unless --profile overrides it.
  • Make enqueue store only the profile name and resolve latest values when the attempt starts.

4. Authorization and User Management

  • Add profile actions to user management: read profile metadata, read variable values, write profiles, write profile secrets, use profile, and use protected profile.
  • Implement canUseProfile(actor, profile) as the shared gate for all run entrypoints.
  • Call the gate from start, enqueue, retry, scheduled run creation/execution, inherited sub-DAG execution, and distributed profile resolution.
  • Make protected profiles usable only by admin/manager or the explicit protected-profile permission.
  • Record audit events for profile create/update/delete, secret set/rotate/delete, and run-with-profile decisions.
  • Keep per-secret ACL out of v1; profile-level permission is the unit of access.

5. CLI and API

  • Add CLI commands for profile list, create, update, disable, set variable, set secret, delete key, and inspect metadata.
  • Add --profile to start, enqueue, retry, dry, and any equivalent command path.
  • Add REST endpoints for profile CRUD and entry CRUD.
  • Extend run request/response schemas with profile name and injected key metadata.
  • Ensure API responses never include plaintext secret values after write.

6. Distributed Execution

  • Extend coordinator task metadata with profileName only.
  • Add coordinator/runtime resolver API for workers to resolve assigned task profile values at attempt start.
  • Validate task lease/assignment before returning plaintext profile secrets to a worker.
  • Fail closed when a worker asks for a profile that does not match the assigned task.
  • Require secure worker transport or fail closed for profiles containing secrets in distributed mode.
  • Keep shared-volume and shared-nothing behavior equivalent by routing both through the same resolver contract.

7. Sub-DAGs and Scheduling

  • Make sub-DAGs inherit the parent profile by default.
  • Add an explicit override path only if the current sub-DAG executor already has a clean option surface for it.
  • Add schedule metadata for the selected default profile, outside the DAG YAML.
  • Recheck profile state and use permission when a scheduled attempt starts.

8. Web UI

  • Add Profiles navigation, list page, profile detail page, and create/edit flows.
  • Show Variables, Secrets, Usage, and Settings sections on profile detail.
  • Add profile selector and injected-key preview to start, enqueue, retry, and schedule configuration flows.
  • Show protected profile lock/confirmation in run dialogs.
  • Show profile name, resolution time, and injected key names/kinds in run history.
  • Hide secret plaintext everywhere except the one-time write path.

9. Documentation and Migration

  • Document the mental model: managed secret is value storage; profile is runtime selection.
  • Document latest-at-attempt-start behavior for start, enqueue, retry, schedule, and sub-DAGs.
  • Document profile access as secret access.
  • Document distributed-mode requirements for profile secrets.
  • Add migration examples from env: LOG_LEVEL: ${LOG_LEVEL}, dotenv:, and DAG secrets:.

Completion Proof

The feature is not finished until these checks pass. The proof should be attached to the PR description with exact commands, relevant log snippets, and screenshots for UI flows.

Functional Proof

Scenario Proof Required
Profile injects undeclared values A DAG with no env: or secrets: declarations reads $LOG_LEVEL and $CLICKHOUSE_DSN_PY from the selected profile.
Start resolves latest values Update a profile value, run dagu start --profile local, and show the new value is used.
Enqueue resolves at execution Enqueue with profile, change profile before the worker/scheduler executes it, and show the executed attempt uses the latest value.
Retry restores profile name Run with profile, update profile value, retry without --profile, and show retry uses the previous profile name with latest value.
Retry override works Retry a run with --profile staging and show the retry uses staging, not the original profile.
Precedence is correct One integration test proves step env overrides outputs/DAG secrets/profile values and profile values override DAG env/dotenv.
Masking works A step prints a profile secret and Dagu-managed logs/history show only the masking token.
Run metadata is safe Inspect queue/status/history files or API responses and show profile name/key names exist but plaintext secret values do not.
Sub-DAG inheritance works Parent DAG runs a child DAG; child reads inherited profile variable and secret without redeclaring them.
Distributed shared-volume works Distributed worker receives profile name, resolves values at attempt start, and completes without plaintext in task payload.
Distributed shared-nothing works Worker resolves through coordinator/runtime resolver, and a mismatched profile/task lease request fails closed.
Protected profile is enforced User without protected-profile permission cannot start, enqueue, retry, schedule, or resolve distributed work with prod.
UI flow works Screenshots show profile creation, variable entry, secret entry, run profile selector, protected profile confirmation, and run history metadata.

Required Automated Checks

  • Unit tests for profile validation, store behavior, resolver behavior, precedence, masking, and authorization gates.
  • CLI integration tests for start --profile, enqueue --profile, and retry --profile.
  • Retry regression test that combines profile-loaded values with restored attempt state.
  • Sub-DAG integration test for inherited profile values.
  • Distributed integration tests for shared-volume and shared-nothing resolution paths.
  • API tests proving secret values are write-only and never returned in profile responses.
  • UI tests for profile CRUD, profile selector, protected profile confirmation, and run history display.
  • Security tests proving unauthorized profile use fails for all entrypoints and resolver calls.

Manual Inspection Checklist

  • Search durable output files for the literal secret used in tests; no queue, status, history, log, audit, or task file may contain it.
  • Inspect coordinator task payloads and confirm they contain profileName only.
  • Inspect API responses for profile list/detail and run detail; secret values must be absent or masked.
  • Verify browser screenshots at desktop and narrow viewport widths do not truncate key labels or overlap controls.
  • Verify product docs state that profile access is equivalent to access to all secrets inside that profile.

PR Completion Statement

Proof of completion:
- Local start/enqueue/retry with profile: PASS
- Sub-DAG inheritance: PASS
- Distributed shared-volume/shared-nothing profile resolution: PASS
- Protected profile authorization across all entrypoints: PASS
- Secret masking and durable-state scan: PASS
- API/UI secret non-disclosure: PASS
- UI screenshots attached: PASS
- Docs updated: PASS

Risks

Risk Impact Mitigation
Latest values reduce reproducibility. A retry or queued run can use values different from the original request time. Make latest-at-attempt-start explicit in UI, CLI help, and run history.
Bulk injection hides dependencies. A DAG may depend on profile keys that are not obvious in YAML. Preview injected key names and record them in history. Add diagnostics before strict required-key features.
Secrets in env can be leaked by workload. A malicious or careless command can print or upload the secret. Document the trust boundary. Mask logs. Use protected profiles and RBAC for profile use.
Distributed shared-nothing workers lack local profile data. Workers could behave differently from local execution. Resolve through coordinator/runtime resolver and fail closed when unavailable.
Name collision confusion. Users may not know which layer won. Use clear precedence, run preview, and history metadata.
Environment size limits. Large profiles can exceed OS process environment limits. Enforce reasonable limits and fail with a clear message before process launch.

Phasing

Phase 1: Core Runtime Profiles

  • Profile store.
  • Plain variables and profile-owned secrets.
  • CLI and API CRUD.
  • start, enqueue, and retry selection.
  • Run metadata and masking.

Phase 2: UI

  • Profiles list and detail pages.
  • Run dialog profile selector.
  • Run history profile panel.
  • Protected profile UI guard.

Phase 3: Distributed and Sub-DAG Hardening

  • Coordinator resolver API.
  • Worker authorization for runtime resolution.
  • Sub-DAG inheritance tests for local and distributed execution.

Deferred

  • Workspace-scoped profiles.
  • Profile revision pinning.
  • Required-key contracts.
  • External secret manager references inside profile entries.
  • Import/export and diff tooling.

Open Questions

  1. Should scheduled runs have a per-DAG default profile stored in Dagu metadata, or should scheduled profile selection require an explicit user setting in the scheduler UI?
  2. Should profile use permission be separate from DAG run permission in v1, or should protected profiles be the only new authorization control?
  3. Should profile variables be visible to all users who can view a profile, or should plain variables have a hidden option distinct from secrets?
  4. Should dagu dry --profile local resolve secrets by default, matching current dry behavior, or offer a metadata-only mode for safer previews?

Sources

External product patterns were checked against official documentation:

Current Dagu behavior referenced in this design comes from local Dagu docs for workflow secrets and environment variables, plus RFC 019 for the team secret integration layer.