Skip to content

fix(cli): warn when runtime.adapter.type is ignored - #2534

Merged
tkircsi merged 1 commit into
agntcy:mainfrom
uveshm003:fix/warn-ignored-adapter-type
Nov 23, 2026
Merged

tkircsi merged 1 commit into
agntcy:mainfrom
uveshm003:fix/warn-ignored-adapter-type

Conversation

@uveshm003

Copy link
Copy Markdown
Contributor

Fixes #2530

This follows the fix suggested in the issue. The precedence doesn't change.

  • runtime.adapter.type no longer has a default (BindEnv instead of SetDefault), so a non-empty value means someone set it.
  • EffectiveAdapterTypes returns docker as the last resort instead of nil. A --config file that sets neither key still starts docker alone, as it does today.
  • startRuntimeDiscovery logs a warning when adapter_types overrides adapter.type. The check is "the list is set", not "the list lacks this type", so ADAPTER_TYPE=process warns even though process is in the default list.
  • The comment above adapter_types in daemon.config.yaml names DIRECTORY_DAEMON_RUNTIME_ADAPTER_TYPES.

Testing

  • go test ./cmd/daemon/... in cli. New cases in runtime_test.go:

    • the singular variable with the shipped config: still docker and process, reported as ignored;
    • the shipped config alone: nothing ignored;
    • a --config file with neither key: docker.
  • golangci-lint v2.14.0 with the repo config: 0 issues.

  • dirctl daemon start with DIRECTORY_DAEMON_RUNTIME_ENABLED=true DIRECTORY_DAEMON_RUNTIME_ADAPTER_TYPE=process:

    level=WARN msg="runtime.adapter.type is ignored because runtime.adapter_types is set; choose runtimes with runtime.adapter_types (DIRECTORY_DAEMON_RUNTIME_ADAPTER_TYPES, comma-separated)" component=daemon adapter_type=process adapter_types="[docker process]"
    

    Without the variable there's no warning, and docker and process start as before.

DIRECTORY_DAEMON_RUNTIME_ADAPTER_TYPE=process sets runtime.adapter.type,
but EffectiveAdapterTypes prefers runtime.adapter_types, which the
shipped config always sets. The daemon kept starting docker and process
and said nothing about the discarded setting.

The precedence stays the same. runtime.adapter.type loses its default,
so a value now means someone set it, and the daemon logs a warning
naming the variable that works when the list overrides it.
EffectiveAdapterTypes falls back to docker itself, so a --config file
that sets neither key still runs docker alone. The shipped config's
comment names both variables.

Fixes agntcy#2530

Signed-off-by: Uvesh Menpur <[email protected]>
@uveshm003
uveshm003 requested a review from a team as a code owner November 23, 2026 13:24
@github-actions github-actions Bot added the size/S Denotes a PR that changes 50-199 lines label Nov 23, 2026

@tkircsi tkircsi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @uveshm003 for turning this around so fast! Nice fix — matches what the issue proposed, and the two halves work well together: dropping the default for runtime.adapter.type is what keeps the warning quiet on a normal start, and the docker fallback preserves today's behaviour. I confirmed no shipped config ever carried both keys, so nobody gets a spurious warning. Tests and lint clean on my side too.

@codecov

codecov Bot commented Nov 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cli/cmd/daemon/start.go 25.0% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@tkircsi
tkircsi added this pull request to the merge queue Nov 23, 2026
Merged via the queue into agntcy:main with commit 53a25a8 Nov 23, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes 50-199 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]:DIRECTORY_DAEMON_RUNTIME_ADAPTER_TYPE is silently ignored

2 participants