Skip to content

Improvements to command plugin and service#1641

Merged
dhurley merged 14 commits intomainfrom
remove-requests-in-progress-check
Apr 24, 2026
Merged

Improvements to command plugin and service#1641
dhurley merged 14 commits intomainfrom
remove-requests-in-progress-check

Conversation

@dhurley
Copy link
Copy Markdown
Collaborator

@dhurley dhurley commented Apr 21, 2026

Proposed changes

There are a few places where things can be improved in the command plugin and service which are detailed below.

  1. The handleSubscribeError function was updated to always reconnect if there is any error not just an unavailable error.
  2. A lock was added to the agent config as this would change during runtime and multiple functions could read this while its being updated.
  3. The requests in progress check was removed. This check could lead to a scenario where a request never completes when a connection reset is in progress. The check was unnecessary anyways since if there is any gRPC error while processing a request it will eventually recovery once the new connection is established.
  4. The monitorSubscribeChannel goroutine exits if an invalid request comes from an auxiliary server. This was fixed to drop the request and continue monitoring the channel.
  5. There was a potential deadlock in the config apply request queue when multiple messages were being added to the channel.

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • If applicable, I have updated any relevant documentation (README.md)
  • If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

@github-actions github-actions Bot added the chore Pull requests for routine tasks label Apr 21, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

❌ Patch coverage is 88.88889% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.11%. Comparing base (c89a90f) to head (2a3d288).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
internal/command/command_service.go 91.91% 6 Missing and 2 partials ⚠️
internal/command/command_plugin.go 80.76% 5 Missing ⚠️
internal/config/config.go 77.77% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1641      +/-   ##
==========================================
+ Coverage   85.07%   85.11%   +0.04%     
==========================================
  Files         105      105              
  Lines       13691    13702      +11     
==========================================
+ Hits        11647    11663      +16     
+ Misses       1529     1524       -5     
  Partials      515      515              
Files with missing lines Coverage Δ
.../watcher/credentials/credential_watcher_service.go 87.71% <100.00%> (ø)
internal/config/config.go 88.28% <77.77%> (-0.10%) ⬇️
internal/command/command_plugin.go 70.80% <80.76%> (+0.64%) ⬆️
internal/command/command_service.go 81.60% <91.91%> (+1.77%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c89a90f...2a3d288. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dhurley dhurley marked this pull request as ready for review April 21, 2026 10:26
@dhurley dhurley requested a review from a team as a code owner April 21, 2026 10:26
Comment thread internal/command/command_plugin.go Outdated
Comment thread internal/command/command_service.go Outdated
Comment thread internal/command/command_service.go Outdated
Comment thread internal/command/command_service.go Outdated
Comment thread internal/config/flags.go
Copy link
Copy Markdown

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 refactors parts of the command plugin/service to improve reconnection behavior and reduce the risk of deadlocks/races during runtime config updates and config-apply request handling.

Changes:

  • Removes the “requests in progress” gating/timeout and related config/flags.
  • Adds RWMutex protection around agent config access and adjusts command plugin/service to read config via accessors.
  • Adjusts subscribe/channel monitoring behavior (continue on invalid auxiliary requests) and refactors config-apply request queue handling to avoid deadlocks.

Reviewed changes

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

Show a summary per file
File Description
internal/command/command_service.go Concurrency/reconnect behavior changes, config locking/accessor, config-apply queue refactor.
internal/command/command_plugin.go Uses config accessor + continues monitoring on invalid auxiliary requests.
internal/command/command_service_test.go Removes tests tied to removed “requests in progress” logic.
internal/config/types.go Removes ConnectionResetTimeout from GRPC config struct.
internal/config/defaults.go Removes default for reset timeout.
internal/config/flags.go Removes CLI flag key for reset timeout.
internal/config/config.go Removes flag registration + viper resolution for reset timeout.
internal/watcher/credentials/credential_watcher_service.go Logging level/context tweak when credential changes are detected.
test/types/config.go Updates test config builder to match removed config field.

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

Comment thread internal/watcher/credentials/credential_watcher_service.go Outdated
Comment thread internal/command/command_service.go Outdated
Comment thread internal/command/command_service.go Outdated
Comment thread internal/command/command_service.go
Comment thread internal/command/command_service.go
@Akshay2191 Akshay2191 self-requested a review April 22, 2026 10:20
@dhurley dhurley merged commit 21c4dd8 into main Apr 24, 2026
62 of 67 checks passed
@dhurley dhurley deleted the remove-requests-in-progress-check branch April 24, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Pull requests for routine tasks dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants