Skip to content

Comments

[Fleet] Implement agent upgrade rollback#247398

Merged
jillguyonnet merged 13 commits intoelastic:mainfrom
jillguyonnet:fleet/agent-upgrade-rollback
Jan 6, 2026
Merged

[Fleet] Implement agent upgrade rollback#247398
jillguyonnet merged 13 commits intoelastic:mainfrom
jillguyonnet:fleet/agent-upgrade-rollback

Conversation

@jillguyonnet
Copy link
Contributor

@jillguyonnet jillguyonnet commented Dec 23, 2025

Summary

Closes https://github.com/elastic/ingest-dev/issues/6212

This PR adds Fleet support for Elastic Agent upgrade rollback (main issue: https://github.com/elastic/ingest-dev/issues/3971).

Key points:

  • Feature is behind enableAgentRollback feature flag
  • Feature is only available for Enterprise license
  • New single agent upgrade rollback API endpoint: POST /api/fleet/agents/{agentId}/rollback
  • New bulk agent upgrade rollback API endpoint: POST /api/fleet/agents/bulk_rollback
  • Upgrade rollback generates an UPGRADE type agent action with rollback: true and the rollback version set by the agent
  • For multiple agents, one action per rollback version is generated
  • Single agent and bulk upgrade rollback available from Fleet UI

Screenshots

Single agent confirmation modal:
Screenshot 2025-12-23 at 16 06 09

Multiple agents confirmation modal:
Screenshot 2025-12-23 at 16 02 29

Action result example:
Screenshot 2025-12-23 at 16 01 24

If action was correctly created and rollback failed, it shows in the agent's upgrade details:
Screenshot 2025-12-23 at 15 40 41

Testing

Properly testing agent rollback is not straightforward right now as the feature is new and requires a "rollbackable" upgrade. See elastic/elastic-agent#11143 for steps.

Alternatively, the agent document can be directly edited with fake upgrade rollback information in order to test that Fleet behaves correctly (the action will fail in this case).

Scenarios to check:

  • Single agent
    • If no upgrade rollback, UI element should be disabled and API request should fail fast
    • Same if agent has expired rollback
    • If agent has a valid rollback, an UPGRADE type action should be created with rollback: true and the correct rollback version
  • Multiple agents
    • Should work with list of agent ids (manual selection in the UI)
    • Should work with agent kuery (select all in the UI)
    • If agents have different rollback versions, there should be one action per version
    • Agents not found and agents with no (valid) rollback should generate corresponding action errors

Checklist

Identify risks

This is a new experimental feature behind the enableAgentRollback feature flag and leaves existing flows largely untouched.

Release note

Adds capability for rolling back a recent upgrade of a Fleet-managed Elastic Agent upgrade using Fleet UI or API.

@jillguyonnet jillguyonnet self-assigned this Dec 23, 2025
@jillguyonnet jillguyonnet added Team:Fleet Team label for Observability Data Collection Fleet team release_note:feature Makes this part of the condensed release notes backport:skip This PR does not require backporting labels Dec 23, 2025
@kibanamachine
Copy link
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#10238

[✅] x-pack/platform/test/fleet_api_integration/config.agent.ts: 25/25 tests passed.

see run history

@jillguyonnet jillguyonnet marked this pull request as ready for review December 24, 2025 15:07
@jillguyonnet jillguyonnet requested review from a team as code owners December 24, 2025 15:07
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

Comment on lines 316 to 321
schema.arrayOf(
schema.object({
valid_until: schema.string(),
version: schema.string(),
})
)

Check warning

Code scanning / CodeQL

Unbounded array in schema validation Medium

This schema.arrayOf() call does not specify a maxSize. Unbounded input can cause Denial of Service (DoS) vulnerabilities. Consider adding { maxSize: N } as the second argument.

export const PostBulkAgentRollbackRequestSchema = {
body: schema.object({
agents: schema.oneOf([schema.arrayOf(schema.string()), schema.string()]),

Check warning

Code scanning / CodeQL

Unbounded array in schema validation Medium

This schema.arrayOf() call does not specify a maxSize. Unbounded input can cause Denial of Service (DoS) vulnerabilities. Consider adding { maxSize: N } as the second argument.
};

export const PostBulkAgentRollbackResponseSchema = schema.object({
actionIds: schema.arrayOf(schema.string()),

Check warning

Code scanning / CodeQL

Unbounded array in schema validation Medium

This schema.arrayOf() call does not specify a maxSize. Unbounded input can cause Denial of Service (DoS) vulnerabilities. Consider adding { maxSize: N } as the second argument.
@nchaulet nchaulet self-requested a review January 2, 2026 14:45
@nchaulet
Copy link
Member

nchaulet commented Jan 2, 2026

@elasticmachine merge upstream

Comment on lines 31 to 37
if (agent.unenrollment_started_at || agent.unenrolled_at) {
throw new AgentRollbackError('cannot roll back an unenrolling or unenrolled agent');
}

if (isAgentUpgrading(agent)) {
throw new AgentRollbackError('cannot roll back an upgrading agent');
}
Copy link
Member

Choose a reason for hiding this comment

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

wdyt of moving this to the application service sendRollbackAgentAction this way it will be safer to use by other plugins

@jillguyonnet
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@florent-leborgne florent-leborgne left a comment

Choose a reason for hiding this comment

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

LGTM for API docs and a few copy nits

{isSingleAgent ? (
<FormattedMessage
id="xpack.fleet.rollbackAgents.singleAgentDescription"
defaultMessage="This action will roll back the agent running on ''{hostName}'' to version {version}. This action can not be undone. Are you sure you wish to continue?"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
defaultMessage="This action will roll back the agent running on ''{hostName}'' to version {version}. This action can not be undone. Are you sure you wish to continue?"
defaultMessage="You are about to roll back the agent running on ''{hostName}'' to version {version}. This action cannot be undone."

We usually don't need the "are you sure" part if the confirm/cancel actions are clearly presented

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! FYI in case this should be reviewed at some stage, there seems to be 27 existing occurrences of "are you sure" in Fleet codebase.

) : (
<FormattedMessage
id="xpack.fleet.rollbackAgents.multipleAgentsDescription"
defaultMessage="This action will roll back agents to their previous version. This action can not be undone. Are you sure you wish to continue?"
Copy link
Contributor

@florent-leborgne florent-leborgne Jan 5, 2026

Choose a reason for hiding this comment

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

Suggested change
defaultMessage="This action will roll back agents to their previous version. This action can not be undone. Are you sure you wish to continue?"
defaultMessage="You are about to roll back agents to their previous version. This action cannot be undone."

name: (
<FormattedMessage
id="xpack.fleet.agentList.rollbackOneButton"
defaultMessage="Rollback"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
defaultMessage="Rollback"
defaultMessage="Roll back"

Other buttons next to this one seem to be verbs as well

Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

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

🚀

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
fleet 1384 1385 +1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
fleet 1565 1570 +5

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
fleet 2.1MB 2.1MB +3.4KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
fleet 111 112 +1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
fleet 180.1KB 180.9KB +877.0B
Unknown metric groups

API count

id before after diff
fleet 1698 1704 +6

History

cc @jillguyonnet

Copy link
Contributor

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

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

I'm not seeing any new usage of TaskManager APIs, and given this is using a framework (ActionRunner) around TM, I'd assume this is ok. LMK if otherwise.

One concern I have is not using our provided AbortController in the task runners, so check to see if the task has been cancelled during it's run.

@jillguyonnet
Copy link
Contributor Author

Thanks for your review @pmuellr

One concern I have is not using our provided AbortController in the task runners, so check to see if the task has been cancelled during it's run.

I had a look and this looks like a implementation gap we can address. I filed a tech debt issue for it: #247971

@jillguyonnet jillguyonnet merged commit f4ab534 into elastic:main Jan 6, 2026
13 checks passed
@jillguyonnet jillguyonnet deleted the fleet/agent-upgrade-rollback branch January 6, 2026 16:34
dej611 pushed a commit to dej611/kibana that referenced this pull request Jan 8, 2026
## Summary

Closes elastic/ingest-dev#6212

This PR adds Fleet support for Elastic Agent upgrade rollback (main
issue: elastic/ingest-dev#3971).

Key points:
* Feature is behind `enableAgentRollback` feature flag
* Feature is only available for Enterprise license
* New single agent upgrade rollback API endpoint: `POST
/api/fleet/agents/{agentId}/rollback`
* New bulk agent upgrade rollback API endpoint: `POST
/api/fleet/agents/bulk_rollback`
* Upgrade rollback generates an `UPGRADE` type agent action with
`rollback: true` and the rollback version set by the agent
* For multiple agents, one action per rollback version is generated
* Single agent and bulk upgrade rollback available from Fleet UI

### Screenshots

Single agent confirmation modal:
<img width="1919" height="773" alt="Screenshot 2025-12-23 at 16 06 09"
src="https://github.com/user-attachments/assets/6b3948b6-b530-4c18-b2b8-8763234ae75d"
/>

Multiple agents confirmation modal:
<img width="1919" height="773" alt="Screenshot 2025-12-23 at 16 02 29"
src="https://github.com/user-attachments/assets/1b7e36b2-7c67-4b17-aae5-75a86fb7e015"
/>

Action result example:
<img width="1919" height="881" alt="Screenshot 2025-12-23 at 16 01 24"
src="https://github.com/user-attachments/assets/f84eb8bb-fc55-4fb7-ac22-48042da87718"
/>

If action was correctly created and rollback failed, it shows in the
agent's upgrade details:
<img width="1919" height="881" alt="Screenshot 2025-12-23 at 15 40 41"
src="https://github.com/user-attachments/assets/3aa51fcb-12ac-4c59-920f-6d685605fe09"
/>

### Testing

Properly testing agent rollback is not straightforward right now as the
feature is new and requires a "rollbackable" upgrade. See
elastic/elastic-agent#11143 for steps.

Alternatively, the agent document can be directly edited with fake
upgrade rollback information in order to test that Fleet behaves
correctly (the action will fail in this case).

Scenarios to check:
* Single agent
* If no upgrade rollback, UI element should be disabled and API request
should fail fast
   * Same if agent has expired rollback
* If agent has a valid rollback, an `UPGRADE` type action should be
created with `rollback: true` and the correct rollback version
* Multiple agents
   * Should work with list of agent ids (manual selection in the UI)
   * Should work with agent kuery (select all in the UI)
* If agents have different rollback versions, there should be one action
per version
* Agents not found and agents with no (valid) rollback should generate
corresponding action errors

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

### Identify risks

This is a new experimental feature behind the `enableAgentRollback`
feature flag and leaves existing flows largely untouched.

## Release note

Adds capability for rolling back a recent upgrade of a Fleet-managed
Elastic Agent upgrade using Fleet UI or API.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
devamanv pushed a commit to devamanv/kibana that referenced this pull request Jan 12, 2026
## Summary

Closes elastic/ingest-dev#6212

This PR adds Fleet support for Elastic Agent upgrade rollback (main
issue: elastic/ingest-dev#3971).

Key points:
* Feature is behind `enableAgentRollback` feature flag
* Feature is only available for Enterprise license
* New single agent upgrade rollback API endpoint: `POST
/api/fleet/agents/{agentId}/rollback`
* New bulk agent upgrade rollback API endpoint: `POST
/api/fleet/agents/bulk_rollback`
* Upgrade rollback generates an `UPGRADE` type agent action with
`rollback: true` and the rollback version set by the agent
* For multiple agents, one action per rollback version is generated
* Single agent and bulk upgrade rollback available from Fleet UI

### Screenshots

Single agent confirmation modal:
<img width="1919" height="773" alt="Screenshot 2025-12-23 at 16 06 09"
src="https://github.com/user-attachments/assets/6b3948b6-b530-4c18-b2b8-8763234ae75d"
/>

Multiple agents confirmation modal:
<img width="1919" height="773" alt="Screenshot 2025-12-23 at 16 02 29"
src="https://github.com/user-attachments/assets/1b7e36b2-7c67-4b17-aae5-75a86fb7e015"
/>

Action result example:
<img width="1919" height="881" alt="Screenshot 2025-12-23 at 16 01 24"
src="https://github.com/user-attachments/assets/f84eb8bb-fc55-4fb7-ac22-48042da87718"
/>

If action was correctly created and rollback failed, it shows in the
agent's upgrade details:
<img width="1919" height="881" alt="Screenshot 2025-12-23 at 15 40 41"
src="https://github.com/user-attachments/assets/3aa51fcb-12ac-4c59-920f-6d685605fe09"
/>

### Testing

Properly testing agent rollback is not straightforward right now as the
feature is new and requires a "rollbackable" upgrade. See
elastic/elastic-agent#11143 for steps.

Alternatively, the agent document can be directly edited with fake
upgrade rollback information in order to test that Fleet behaves
correctly (the action will fail in this case).

Scenarios to check:
* Single agent
* If no upgrade rollback, UI element should be disabled and API request
should fail fast
   * Same if agent has expired rollback
* If agent has a valid rollback, an `UPGRADE` type action should be
created with `rollback: true` and the correct rollback version
* Multiple agents
   * Should work with list of agent ids (manual selection in the UI)
   * Should work with agent kuery (select all in the UI)
* If agents have different rollback versions, there should be one action
per version
* Agents not found and agents with no (valid) rollback should generate
corresponding action errors

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

### Identify risks

This is a new experimental feature behind the `enableAgentRollback`
feature flag and leaves existing flows largely untouched.

## Release note

Adds capability for rolling back a recent upgrade of a Fleet-managed
Elastic Agent upgrade using Fleet UI or API.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@jillguyonnet jillguyonnet removed the backport:skip This PR does not require backporting label Jan 15, 2026
@kibanamachine kibanamachine added the backport:skip This PR does not require backporting label Jan 15, 2026
@jillguyonnet jillguyonnet added backport:version Backport to applied version labels v9.3.0 and removed backport:skip This PR does not require backporting v9.4.0 labels Jan 15, 2026
@kibanamachine kibanamachine added backport:skip This PR does not require backporting and removed backport:version Backport to applied version labels labels Jan 15, 2026
@jillguyonnet
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
9.3

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

jillguyonnet added a commit to jillguyonnet/kibana that referenced this pull request Jan 15, 2026
## Summary

Closes elastic/ingest-dev#6212

This PR adds Fleet support for Elastic Agent upgrade rollback (main
issue: elastic/ingest-dev#3971).

Key points:
* Feature is behind `enableAgentRollback` feature flag
* Feature is only available for Enterprise license
* New single agent upgrade rollback API endpoint: `POST
/api/fleet/agents/{agentId}/rollback`
* New bulk agent upgrade rollback API endpoint: `POST
/api/fleet/agents/bulk_rollback`
* Upgrade rollback generates an `UPGRADE` type agent action with
`rollback: true` and the rollback version set by the agent
* For multiple agents, one action per rollback version is generated
* Single agent and bulk upgrade rollback available from Fleet UI

### Screenshots

Single agent confirmation modal:
<img width="1919" height="773" alt="Screenshot 2025-12-23 at 16 06 09"
src="https://github.com/user-attachments/assets/6b3948b6-b530-4c18-b2b8-8763234ae75d"
/>

Multiple agents confirmation modal:
<img width="1919" height="773" alt="Screenshot 2025-12-23 at 16 02 29"
src="https://github.com/user-attachments/assets/1b7e36b2-7c67-4b17-aae5-75a86fb7e015"
/>

Action result example:
<img width="1919" height="881" alt="Screenshot 2025-12-23 at 16 01 24"
src="https://github.com/user-attachments/assets/f84eb8bb-fc55-4fb7-ac22-48042da87718"
/>

If action was correctly created and rollback failed, it shows in the
agent's upgrade details:
<img width="1919" height="881" alt="Screenshot 2025-12-23 at 15 40 41"
src="https://github.com/user-attachments/assets/3aa51fcb-12ac-4c59-920f-6d685605fe09"
/>

### Testing

Properly testing agent rollback is not straightforward right now as the
feature is new and requires a "rollbackable" upgrade. See
elastic/elastic-agent#11143 for steps.

Alternatively, the agent document can be directly edited with fake
upgrade rollback information in order to test that Fleet behaves
correctly (the action will fail in this case).

Scenarios to check:
* Single agent
* If no upgrade rollback, UI element should be disabled and API request
should fail fast
   * Same if agent has expired rollback
* If agent has a valid rollback, an `UPGRADE` type action should be
created with `rollback: true` and the correct rollback version
* Multiple agents
   * Should work with list of agent ids (manual selection in the UI)
   * Should work with agent kuery (select all in the UI)
* If agents have different rollback versions, there should be one action
per version
* Agents not found and agents with no (valid) rollback should generate
corresponding action errors

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

### Identify risks

This is a new experimental feature behind the `enableAgentRollback`
feature flag and leaves existing flows largely untouched.

## Release note

Adds capability for rolling back a recent upgrade of a Fleet-managed
Elastic Agent upgrade using Fleet UI or API.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit f4ab534)
jillguyonnet added a commit that referenced this pull request Jan 16, 2026
# Backport

This will backport the following commits from `main` to `9.3`:
- [[Fleet] Implement agent upgrade rollback
(#247398)](#247398)

<!--- Backport version: 10.2.0 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Jill
Guyonnet","email":"jill.guyonnet@elastic.co"},"sourceCommit":{"committedDate":"2026-01-06T16:34:36Z","message":"[Fleet]
Implement agent upgrade rollback (#247398)\n\n## Summary\n\nCloses
https://github.com/elastic/ingest-dev/issues/6212\n\nThis PR adds Fleet
support for Elastic Agent upgrade rollback (main\nissue:
https://github.com/elastic/ingest-dev/issues/3971).\n\nKey points:\n*
Feature is behind `enableAgentRollback` feature flag\n* Feature is only
available for Enterprise license\n* New single agent upgrade rollback
API endpoint: `POST\n/api/fleet/agents/{agentId}/rollback`\n* New bulk
agent upgrade rollback API endpoint:
`POST\n/api/fleet/agents/bulk_rollback`\n* Upgrade rollback generates an
`UPGRADE` type agent action with\n`rollback: true` and the rollback
version set by the agent\n* For multiple agents, one action per rollback
version is generated\n* Single agent and bulk upgrade rollback available
from Fleet UI\n\n### Screenshots\n\nSingle agent confirmation
modal:\n<img width=\"1919\" height=\"773\" alt=\"Screenshot 2025-12-23
at 16 06
09\"\nsrc=\"https://github.com/user-attachments/assets/6b3948b6-b530-4c18-b2b8-8763234ae75d\"\n/>\n\nMultiple
agents confirmation modal:\n<img width=\"1919\" height=\"773\"
alt=\"Screenshot 2025-12-23 at 16 02
29\"\nsrc=\"https://github.com/user-attachments/assets/1b7e36b2-7c67-4b17-aae5-75a86fb7e015\"\n/>\n\nAction
result example:\n<img width=\"1919\" height=\"881\" alt=\"Screenshot
2025-12-23 at 16 01
24\"\nsrc=\"https://github.com/user-attachments/assets/f84eb8bb-fc55-4fb7-ac22-48042da87718\"\n/>\n\nIf
action was correctly created and rollback failed, it shows in
the\nagent's upgrade details:\n<img width=\"1919\" height=\"881\"
alt=\"Screenshot 2025-12-23 at 15 40
41\"\nsrc=\"https://github.com/user-attachments/assets/3aa51fcb-12ac-4c59-920f-6d685605fe09\"\n/>\n\n###
Testing\n\nProperly testing agent rollback is not straightforward right
now as the\nfeature is new and requires a \"rollbackable\" upgrade.
See\nhttps://github.com/elastic/elastic-agent/pull/11143 for
steps.\n\nAlternatively, the agent document can be directly edited with
fake\nupgrade rollback information in order to test that Fleet
behaves\ncorrectly (the action will fail in this case).\n\nScenarios to
check:\n* Single agent\n* If no upgrade rollback, UI element should be
disabled and API request\nshould fail fast\n * Same if agent has expired
rollback\n* If agent has a valid rollback, an `UPGRADE` type action
should be\ncreated with `rollback: true` and the correct rollback
version\n* Multiple agents\n * Should work with list of agent ids
(manual selection in the UI)\n * Should work with agent kuery (select
all in the UI)\n* If agents have different rollback versions, there
should be one action\nper version\n* Agents not found and agents with no
(valid) rollback should generate\ncorresponding action errors\n\n###
Checklist\n\n- [ ] Any text added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [ ] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n### Identify risks\n\nThis is a
new experimental feature behind the `enableAgentRollback`\nfeature flag
and leaves existing flows largely untouched.\n\n## Release note\n\nAdds
capability for rolling back a recent upgrade of a Fleet-managed\nElastic
Agent upgrade using Fleet UI or API.\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"f4ab5345a8723400fcc5d6c5dba885b2b6de4513","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["backport:skip","Team:Fleet","release_note:feature","v9.3.0"],"title":"[Fleet]
Implement agent upgrade
rollback","number":247398,"url":"https://github.com/elastic/kibana/pull/247398","mergeCommit":{"message":"[Fleet]
Implement agent upgrade rollback (#247398)\n\n## Summary\n\nCloses
https://github.com/elastic/ingest-dev/issues/6212\n\nThis PR adds Fleet
support for Elastic Agent upgrade rollback (main\nissue:
https://github.com/elastic/ingest-dev/issues/3971).\n\nKey points:\n*
Feature is behind `enableAgentRollback` feature flag\n* Feature is only
available for Enterprise license\n* New single agent upgrade rollback
API endpoint: `POST\n/api/fleet/agents/{agentId}/rollback`\n* New bulk
agent upgrade rollback API endpoint:
`POST\n/api/fleet/agents/bulk_rollback`\n* Upgrade rollback generates an
`UPGRADE` type agent action with\n`rollback: true` and the rollback
version set by the agent\n* For multiple agents, one action per rollback
version is generated\n* Single agent and bulk upgrade rollback available
from Fleet UI\n\n### Screenshots\n\nSingle agent confirmation
modal:\n<img width=\"1919\" height=\"773\" alt=\"Screenshot 2025-12-23
at 16 06
09\"\nsrc=\"https://github.com/user-attachments/assets/6b3948b6-b530-4c18-b2b8-8763234ae75d\"\n/>\n\nMultiple
agents confirmation modal:\n<img width=\"1919\" height=\"773\"
alt=\"Screenshot 2025-12-23 at 16 02
29\"\nsrc=\"https://github.com/user-attachments/assets/1b7e36b2-7c67-4b17-aae5-75a86fb7e015\"\n/>\n\nAction
result example:\n<img width=\"1919\" height=\"881\" alt=\"Screenshot
2025-12-23 at 16 01
24\"\nsrc=\"https://github.com/user-attachments/assets/f84eb8bb-fc55-4fb7-ac22-48042da87718\"\n/>\n\nIf
action was correctly created and rollback failed, it shows in
the\nagent's upgrade details:\n<img width=\"1919\" height=\"881\"
alt=\"Screenshot 2025-12-23 at 15 40
41\"\nsrc=\"https://github.com/user-attachments/assets/3aa51fcb-12ac-4c59-920f-6d685605fe09\"\n/>\n\n###
Testing\n\nProperly testing agent rollback is not straightforward right
now as the\nfeature is new and requires a \"rollbackable\" upgrade.
See\nhttps://github.com/elastic/elastic-agent/pull/11143 for
steps.\n\nAlternatively, the agent document can be directly edited with
fake\nupgrade rollback information in order to test that Fleet
behaves\ncorrectly (the action will fail in this case).\n\nScenarios to
check:\n* Single agent\n* If no upgrade rollback, UI element should be
disabled and API request\nshould fail fast\n * Same if agent has expired
rollback\n* If agent has a valid rollback, an `UPGRADE` type action
should be\ncreated with `rollback: true` and the correct rollback
version\n* Multiple agents\n * Should work with list of agent ids
(manual selection in the UI)\n * Should work with agent kuery (select
all in the UI)\n* If agents have different rollback versions, there
should be one action\nper version\n* Agents not found and agents with no
(valid) rollback should generate\ncorresponding action errors\n\n###
Checklist\n\n- [ ] Any text added follows [EUI's
writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\nsentence case text and includes
[i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n-
[
]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] [Flaky
Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\nused on any tests changed\n- [ ] The PR description includes the
appropriate Release Notes section,\nand the correct `release_note:*`
label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n-
[x] Review the
[backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand
apply applicable `backport:*` labels.\n\n### Identify risks\n\nThis is a
new experimental feature behind the `enableAgentRollback`\nfeature flag
and leaves existing flows largely untouched.\n\n## Release note\n\nAdds
capability for rolling back a recent upgrade of a Fleet-managed\nElastic
Agent upgrade using Fleet UI or API.\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"f4ab5345a8723400fcc5d6c5dba885b2b6de4513"}},"sourceBranch":"main","suggestedTargetBranches":["9.3"],"targetPullRequestStates":[{"branch":"9.3","label":"v9.3.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
jillguyonnet added a commit that referenced this pull request Jan 16, 2026
## Summary

Make `enableAgentRollback` feature flag `true` by default.

Implementation PR: #247398
Backport to 9.3: #249250

### Identify risks

Agent rollback is mostly insulated from other existing flows: low
probability risk of affecting agent actions menus in Fleet UI.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
jillguyonnet added a commit to jillguyonnet/kibana that referenced this pull request Jan 19, 2026
## Summary

Make `enableAgentRollback` feature flag `true` by default.

Implementation PR: elastic#247398
Backport to 9.3: elastic#249250

### Identify risks

Agent rollback is mostly insulated from other existing flows: low
probability risk of affecting agent actions menus in Fleet UI.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit eebeab1)

# Conflicts:
#	x-pack/platform/plugins/shared/fleet/common/experimental_features.ts
dej611 pushed a commit to dej611/kibana that referenced this pull request Jan 19, 2026
## Summary

Make `enableAgentRollback` feature flag `true` by default.

Implementation PR: elastic#247398
Backport to 9.3: elastic#249250

### Identify risks

Agent rollback is mostly insulated from other existing flows: low
probability risk of affecting agent actions menus in Fleet UI.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:feature Makes this part of the condensed release notes Team:Fleet Team label for Observability Data Collection Fleet team v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants