Skip to content

[9.4](backport #6829) fix: report server capabilities in OpAMP responses#6832

Open
mergify[bot] wants to merge 1 commit into9.4from
mergify/bp/9.4/pr-6829
Open

[9.4](backport #6829) fix: report server capabilities in OpAMP responses#6832
mergify[bot] wants to merge 1 commit into9.4from
mergify/bp/9.4/pr-6829

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify bot commented Apr 13, 2026

What is the problem this PR solves?

The OpAMP spec requires the server to report its capabilities bitmask in the first ServerToAgent response. Fleet-server was not setting this field, so agents could not discover what the server supports.

How does this PR solve the problem?

Send the serverCapabilities bitmask (AcceptsStatus, AcceptsEffectiveConfig) in the ServerToAgent response when an agent enrolls or reconnects from a non-active status (offline, disconnected). Active agents (online, error, degraded) do not receive capabilities on every message to reduce response size. An isActiveStatus helper determines which statuses are considered active.

Design Checklist

  • I have ensured my design is stateless and will work when multiple fleet-server instances are behind a load balancer.
  • I have or intend to scale test my changes, ensuring it will work reliably with 100K+ agents connected.
  • I have included fail safe mechanisms to limit the load on fleet-server: rate limiting, circuit breakers, caching, load shedding, etc.

Checklist

  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool

Related issues

* feat: report server capabilities in OpAMP responses

Send the server capabilities bitmask (AcceptsStatus, AcceptsEffectiveConfig)
in the first ServerToAgent response when an agent enrolls or reconnects from
a non-active status (offline, disconnected). Active agents (online, error,
degraded) do not receive capabilities on every message.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Define disconnected status as a part of openapi.yml

Define disconnected status as a part of openapi.yml so that opamp agent
checkin statuses are defined alongside existing statuses

* Fix linter warnings

* Silence linter

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
(cherry picked from commit bc20c8b)

# Conflicts:
#	docs/opamp.md
#	internal/pkg/api/handleOpAMP.go
#	internal/pkg/api/handleOpAMP_test.go
@mergify mergify bot added backport conflicts There is a conflict in the backported pull request labels Apr 13, 2026
@mergify
Copy link
Copy Markdown
Contributor Author

mergify bot commented Apr 13, 2026

Cherry-pick of bc20c8b has failed:

On branch mergify/bp/9.4/pr-6829
Your branch is up to date with 'origin/9.4'.

You are currently cherry-picking commit bc20c8b.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   changelog/fragments/1776103950-report-opamp-server-capabilities.yaml
	modified:   internal/pkg/api/openapi.gen.go
	modified:   model/openapi.yml
	modified:   pkg/api/types.gen.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   docs/opamp.md
	both modified:   internal/pkg/api/handleOpAMP.go
	both modified:   internal/pkg/api/handleOpAMP_test.go

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify bot added the backport label Apr 13, 2026
@mergify mergify bot requested a review from a team as a code owner April 13, 2026 22:51
@mergify mergify bot added the conflicts There is a conflict in the backported pull request label Apr 13, 2026
@mergify mergify bot requested review from samuelvl and ycombinator April 13, 2026 22:51
@github-actions github-actions bot added bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team labels Apr 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 13, 2026

🔍 Preview links for changed docs

@github-actions
Copy link
Copy Markdown
Contributor

Vale Linting Results

Summary: 2 errors, 1 warning, 1 suggestion found

❌ Errors (2)
File Line Rule Message
docs/opamp.md 3 Elastic.ConflictMarkers Do not commit Git merge conflict markers in source code.
docs/opamp.md 4 Elastic.ConflictMarkers Do not commit Git merge conflict markers in source code.
⚠️ Warnings (1)
File Line Rule Message
docs/opamp.md 35 Elastic.Latinisms Latin terms and abbreviations are a common source of confusion. Use 'for example' instead of 'e.g'.
💡 Suggestions (1)
File Line Rule Message
docs/opamp.md 15 Elastic.Ellipses In general, don't use an ellipsis.

The Vale linter checks documentation changes against the Elastic Docs style guide.

To use Vale locally or report issues, refer to Elastic style guide for Vale.

Comment on lines +38 to 45
<<<<<<< HEAD
kOpAMPMod = "opAMP"
=======
kOpAMPMod = "opAMP"
serverCapabilities = uint64(protobufs.ServerCapabilities_ServerCapabilities_AcceptsStatus |
protobufs.ServerCapabilities_ServerCapabilities_AcceptsEffectiveConfig)
>>>>>>> bc20c8b (fix: report server capabilities in OpAMP responses (#6829))
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Critical api/handleOpAMP.go:38

Unresolved git merge conflict markers (<<<<<<< HEAD, =======, >>>>>>> bc20c8b) at lines 38-45 will cause a compilation failure. The Go compiler cannot parse these conflict markers as valid syntax. Resolve the conflict by keeping the server capabilities constant and the AgentDisconnect handling logic from the incoming change.

-<<<<<<< HEAD
-	kOpAMPMod = "opAMP"
-=======
 	kOpAMPMod          = "opAMP"
 	serverCapabilities = uint64(protobufs.ServerCapabilities_ServerCapabilities_AcceptsStatus |
 		protobufs.ServerCapabilities_ServerCapabilities_AcceptsEffectiveConfig)
->>>>>>> bc20c8b (fix: report server capabilities in OpAMP responses (#6829))
Also found in 1 other location(s)

docs/opamp.md:3

Unresolved git merge conflict markers are being committed to docs/opamp.md. Lines 3 (&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD), 4 (=======), and 59 (&gt;&gt;&gt;&gt;&gt;&gt;&gt; bc20c8b (fix: report server capabilities in OpAMP responses (#6829))) contain conflict markers that should have been resolved before committing. This will render the documentation malformed and confusing to users viewing the file.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file internal/pkg/api/handleOpAMP.go around lines 38-45:

Unresolved git merge conflict markers (`<<<<<<< HEAD`, `=======`, `>>>>>>> bc20c8b`) at lines 38-45 will cause a compilation failure. The Go compiler cannot parse these conflict markers as valid syntax. Resolve the conflict by keeping the server capabilities constant and the `AgentDisconnect` handling logic from the incoming change.

Evidence trail:
File: internal/pkg/api/handleOpAMP.go, lines 38-43 (viewed at REVIEWED_COMMIT). The conflict markers `<<<<<<< HEAD`, `=======`, and `>>>>>>> bc20c8b` are present in the const block, which will cause Go compilation failure.

Also found in 1 other location(s):
- docs/opamp.md:3 -- Unresolved git merge conflict markers are being committed to `docs/opamp.md`. Lines 3 (`<<<<<<< HEAD`), 4 (`=======`), and 59 (`>>>>>>> bc20c8b (fix: report server capabilities in OpAMP responses (#6829))`) contain conflict markers that should have been resolved before committing. This will render the documentation malformed and confusing to users viewing the file.

@mergify
Copy link
Copy Markdown
Contributor Author

mergify bot commented Apr 14, 2026

This pull request is now in conflicts. Could you fix it @mergify[bot]? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b mergify/bp/9.4/pr-6829 upstream/mergify/bp/9.4/pr-6829
git merge upstream/9.4
git push upstream mergify/bp/9.4/pr-6829

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bug Something isn't working conflicts There is a conflict in the backported pull request Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant