fix(config): accept a single mapping for hook event lists#3546
Merged
Conversation
A hand-written user config with settings.hooks entries in mapping form
(stop: {type: command, ...}) instead of the documented list form failed
the whole config.yaml parse. Aliases and settings were then silently
dropped, so docker agent run <alias> fell back to the built-in default
agent, and before the GetRestoreTabs hardening the same parse failure
crashed the TUI at startup.
Hook event fields now use HookDefinitions and HookMatcherConfigs, slice
types that unmarshal from either a sequence or a single mapping (YAML
and JSON), mirroring the instruction_file scalar-or-list precedent.
They always marshal back as lists, the canonical documented form.
Fixes #3536
dgageot
approved these changes
Jul 9, 2026
Piyush0049
pushed a commit
to Piyush0049/docker-agent
that referenced
this pull request
Jul 15, 2026
fix(config): accept a single mapping for hook event lists
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.
Follow-up on the last comment of #3536: after the startup panic fix, the reported alias still did not load and runs fell back to the built-in default agent.
Fixes #3536
Root cause
settings.hooksevents written as a single mapping instead of the documented list failed the wholeconfig.yamlparse, so aliases and settings were silently dropped:Failure chain:
The startup panic fixed in 1a5ebd8 was a symptom of the same parse failure; this closes the remaining regression.
Change
HookDefinitions,HookMatcherConfigsinstruction_filescalar-or-list pattern inpkg/config/latest/types.goValidation
hooks_flexible_test.go)TestConfig_SingleMappingHooksKeepAliases)TestReadHookDropIn_SingleMapping)alias listshows the alias,run defaultresolves it,doctorreports the config as okgo test ./...,task lintVerification on the reporter's side is welcome: any other malformed section in the real config file would surface the same way and is out of scope here.