run daemon and client from a single binary#900
Merged
Conversation
Signed-off-by: Areeb Ahmed <areebahmed0709@gmail.com>
Contributor
There was a problem hiding this comment.
Code Review
Review: Refactor dmr and extract server package
Summary
This PR refactors the dmr tool to use cobra and migrates the core daemon logic into a reusable pkg/server package. While the modularization is a positive step, there are critical issues with error handling and a missing variable declaration that will prevent successful compilation and operation.
Critical
- main.go:20: The
Versionvariable is used but not declared in the package, which will cause a linker error. - pkg/server/server.go:186: Calling
os.Exit(1)inside a library package prevents graceful cleanup; errors should be returned to the caller. - pkg/server/server.go:334: The
Runfunction logs server errors but returnsnil, masking fatal failures from the supervisor.
What looks good
- The extraction of server logic into a dedicated package improves modularity and testability.
Contributor
|
You are on the right track... I will give this a detailed review, once all the builds are green and this is moved out of draft... |
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new Run function in pkg/server is quite large and mixes configuration, logging setup, backend wiring, and serving logic; consider breaking it into smaller helpers (e.g., logging setup, service construction, HTTP/TLS listener setup) to improve readability and make targeted behavior easier to test.
- OnBackendError currently calls ExitFunc directly, which makes the server package less reusable as a library; you might instead propagate backend init failures via a returned error (or a channel) so callers can decide how to handle fatal startup conditions.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new Run function in pkg/server is quite large and mixes configuration, logging setup, backend wiring, and serving logic; consider breaking it into smaller helpers (e.g., logging setup, service construction, HTTP/TLS listener setup) to improve readability and make targeted behavior easier to test.
- OnBackendError currently calls ExitFunc directly, which makes the server package less reusable as a library; you might instead propagate backend init failures via a returned error (or a channel) so callers can decide how to handle fatal startup conditions.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
ericcurtin
approved these changes
May 4, 2026
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.
Summary
Closes #899
main.gointopkg/serverfor reusecmd/dmrinto a Cobra CLI that runs the service in-process and exposes common commandsmodel-runnerand delegated tomodel-clibuild-dmrto enableCGO_ENABLED=1and embed git version via-ldflagsAI Model Disclosure
Used VS Code Copilot (Claude Sonnet 4.6) to understand the issue context and help generate a fix. Changes were self-reviewed and verified with: