Skip to content

Conversation

@mizhm
Copy link
Contributor

@mizhm mizhm commented Jan 1, 2026

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @mizhm, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the core-api by integrating gRPC for critical worker-related functionalities. It establishes a robust communication channel for workers to register, maintain their status, and fetch jobs, moving towards a more scalable and performant distributed system architecture. The changes include new gRPC service definitions, a custom authentication guard for workers, and the necessary configurations to enable gRPC microservices within the NestJS application.

Highlights

  • gRPC Integration: Implemented gRPC microservices for worker management and job registry, enabling efficient inter-service communication within the core-api.
  • Worker Authentication: Introduced a new GrpcWorkerTokenGuard to secure gRPC endpoints by validating worker tokens, ensuring only authorized workers can access services.
  • Job Distribution via gRPC: Added a Next gRPC method in JobsRegistryService allowing workers to request and receive new jobs efficiently.
  • Worker Lifecycle Management: Implemented Join and Alive gRPC methods in WorkersService for streamlined worker registration and continuous heartbeat functionality.
  • Protocol Buffer Definitions: New .proto files (workers.proto and jobs_registry.proto) were added to formally define the gRPC service contracts and message structures.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
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

This pull request introduces gRPC endpoints for worker management and job retrieval, which is a great step towards a more efficient communication layer. The changes include new proto files, updates to the main application to run a gRPC microservice, and new gRPC method handlers in the controllers.

My main concern is with the implementation of GrpcWorkerTokenGuard, which is currently a stub and presents a critical security vulnerability by not validating tokens. I've provided a detailed comment and a suggested implementation to fix this.

Additionally, I've made a couple of minor suggestions for improving code clarity and debuggability in the WorkersController.

@mizhm mizhm marked this pull request as ready for review January 2, 2026 14:51
@mizhm mizhm requested review from Copilot and l1ttps January 2, 2026 14:51
@mizhm mizhm marked this pull request as draft January 2, 2026 14:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds gRPC support to the core API, enabling workers to communicate with the job registry service via gRPC in addition to the existing REST API. The implementation introduces bidirectional streaming capabilities for worker health checks and unary RPCs for job management.

Key changes include:

  • New gRPC service definitions for worker registration/health checks and job registry operations
  • gRPC method implementations alongside existing REST endpoints in both Workers and JobsRegistry controllers
  • Authentication guard for validating worker tokens in gRPC requests
  • Data transformation logic to handle gRPC message format conversions

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
core-api/src/proto/workers.proto Defines WorkersService with Join (unary) and Alive (bidirectional streaming) RPCs
core-api/src/proto/jobs_registry.proto Defines JobsRegistryService with Next and Result RPCs, plus comprehensive message types for job data
core-api/src/modules/workers/workers.controller.ts Adds grpcJoin and grpcAlive$ methods to handle gRPC worker registration and health checks
core-api/src/modules/jobs-registry/jobs-registry.controller.ts Adds next and result gRPC methods with worker token authentication for job retrieval and result submission
core-api/src/modules/jobs-registry/dto/jobs-registry.dto.ts Adds Transform decorator and Expose decorators to handle gRPC-specific data transformations
core-api/src/main.ts Configures and starts gRPC microservice with Transport.GRPC
core-api/src/common/guards/grpc-worker-token.guard.ts Implements authentication guard that validates worker tokens from gRPC metadata

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mizhm mizhm marked this pull request as ready for review January 2, 2026 16:12
Copy link
Member

@l1ttps l1ttps left a comment

Choose a reason for hiding this comment

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

Thanks @mizhm for this excellent PR! The gRPC integration for worker management and job distribution looks great.

I particularly like:

  1. The clean separation of concerns with dedicated proto files for workers and jobs
  2. The proper authentication implementation with GrpcWorkerTokenGuard securing the endpoints
  3. The stream-based heartbeat implementation for worker alive checks
  4. How the gRPC services integrate well with the existing NestJS structure
  5. The comprehensive proto definitions that cover all the necessary data types

The implementation addresses the need for efficient worker communication and job distribution. The worker lifecycle management (Join/Alive) and job distribution (Next/Result) are well-implemented.

Great work on adding this important infrastructure for the distributed system!

@l1ttps l1ttps merged commit 440a38c into main Jan 4, 2026
9 checks passed
@mizhm mizhm deleted the feat/job-grpc branch January 4, 2026 09:31
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.

3 participants