feat: docker-agent.yaml config autodiscovery#2482
feat: docker-agent.yaml config autodiscovery#2482joshbarrington wants to merge 3 commits intodocker:mainfrom
Conversation
|
@aheritier would be good to get a review when you have time. |
4a4fb85 to
e43f7e6
Compare
|
@dgageot this is ready when you have time for review. Currently it just leverages an agent to write the config file when running |
|
Hi @joshbarrington, thanks for the contribution! I'm not sure I would mix the work on default agents with the creator agent. Also, maybe it's better to consider |
|
@dgageot point 2 in issue #2435 is scaffolding with This just means the output file will save as My interpretation of the issue implied the |
|
@dgageot let me know what you think. |
aheritier
left a comment
There was a problem hiding this comment.
Review Summary
The implementation is clean, well-tested, and CI is green. However, before merging, we need to align on the discovery algorithm design — the current scope (CWD-only) leaves important UX questions unanswered that will be harder to change later once users depend on the behavior.
✅ What's good
- Clean separation:
autodiscoverConfigFile()is isolated and testable - Proper precedence: explicit arg > autodiscovery > built-in default
.yamltakes priority over.yml— good deterministic behavior- Tests cover the key scenarios (discover yaml, yml, precedence, explicit override)
- CI passes (build, lint, tests, license)
🚫 Blocking: Discovery scope needs design decision
The current implementation only checks the current working directory. This raises critical questions:
1. Should discovery walk up the directory tree?
Most tools with config autodiscovery (git, eslint, docker-compose with --project-directory, rustfmt, etc.) traverse upward from CWD until they find a config or hit /. If a user runs docker agent from /project/src/services/, should we find /project/docker-agent.yaml?
Recommendation: For v1, CWD-only is acceptable if clearly documented, but we should at minimum document this as a known limitation and track upward traversal as a follow-up. The docker-compose analogy in the issue suggests users will expect to run from subdirectories.
2. Should .agents/ folder be checked?
Per @dgageot's suggestion — while not required for MVP, if we later add .agents/ support, it changes the search order. We should decide now whether the algorithm is:
CWD/docker-agent.yaml → CWD/docker-agent.yml → fallback
or:
CWD/docker-agent.yaml → CWD/docker-agent.yml → CWD/.agents/docker-agent.yaml → CWD/.agents/docker-agent.yml → fallback
This doesn't need implementation now, but the design should be decided so we don't paint ourselves into a corner.
3. Relative path resolution when discovered from a parent directory
The good news: fileSource.ParentDir() already returns filepath.Dir(path), meaning relative paths in the config resolve relative to the config file's location, not CWD. This is correct behavior and will work well if we add upward traversal later.
Non-blocking suggestions
See inline comments below.
Additional design input from @aheritierSummarizing the open design questions that need resolution before merge: Discovery Algorithm — What should the final behavior be?Option A (current PR): CWD-only lookup Option B: CWD + Option C: Recursive upward traversal (like git/eslint) Context from @aheritier:
My analysis on relative paths:Good news — Recommendation:
@joshbarrington @dgageot — would appreciate alignment on which option to target for v1. |
|
@aheritier thanks for the review. Happy to continue with your recommendations (and add the comment), or integrate points 2 and 3 into this PR. @dgageot let us know your thoughts and I can proceed accordingly. |
Closes: #2435
This allows auto config file discovery for
docker-agent.yamlanddocker-agent.ymlin the current working directory.Currently docker agent new leverages an agentic "creator" to build and write the config yaml file to disk. Here we specificy the fixed name in the instruction as opposed to the arbitrary name it previously would generate.