Skip to content

run daemon and client from a single binary#900

Merged
ericcurtin merged 5 commits into
docker:mainfrom
areebahmeddd:feat/merge-dmr
May 4, 2026
Merged

run daemon and client from a single binary#900
ericcurtin merged 5 commits into
docker:mainfrom
areebahmeddd:feat/merge-dmr

Conversation

@areebahmeddd
Copy link
Copy Markdown
Contributor

@areebahmeddd areebahmeddd commented May 2, 2026

Summary

Closes #899

  • Moved server startup logic from main.go into pkg/server for reuse
  • Updated cmd/dmr into a Cobra CLI that runs the service in-process and exposes common commands
  • Removed the old wrapper that spawned model-runner and delegated to model-cli
  • Updated build-dmr to enable CGO_ENABLED=1 and embed git version via -ldflags

AI 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:

go build -tags=novllm ./...
make validate-all

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

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 Version variable 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 Run function logs server errors but returns nil, masking fatal failures from the supervisor.

What looks good

  • The extraction of server logic into a dedicated package improves modularity and testability.

Comment thread main.go
Comment thread pkg/server/server.go
Comment thread pkg/server/server.go
@ericcurtin
Copy link
Copy Markdown
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...

@areebahmeddd areebahmeddd marked this pull request as ready for review May 4, 2026 11:55
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

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.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ericcurtin ericcurtin merged commit 9eee443 into docker:main May 4, 2026
8 checks passed
@areebahmeddd areebahmeddd deleted the feat/merge-dmr branch May 4, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merge the functionality of the existing model-runner and model-cli into a single dmr executable

2 participants