[bug-hunter] add_agent_metadata processor rejects valid partial configs
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start in libbeat/processors/actions/add_agent_metadata.go:27-29 and compare its plugin registration with the optional-section handling in libbeat/processors/actions/addagentmetadata/add_agent_metadata.go:70-107. Review add_agent_metadata_test.go:116-165, then add or update coverage for processors.New with each partial configuration. Done means both configurations load successfully without breaking existing tests.
Written by the indexing model from the issue text.
Description
Impact
Users configuring the add_agent_metadata processor with only one optional section (data_stream or elastic_agent) get a hard startup/config error, even though the processor implementation and tests support either section independently. This blocks valid configurations and can prevent Beats startup.
Reproduction Steps
- From repo root, create and run this minimal repro:
package main
import (
"fmt"
"github.com/elastic/beats/v7/libbeat/processors"
_ "github.com/elastic/beats/v7/libbeat/processors/actions"
conf "github.com/elastic/elastic-agent-libs/config"
"github.com/elastic/elastic-agent-libs/logp/logptest"
)
func run(yml string) {
cfg, err := conf.NewConfigWithYAML([]byte(yml), "repro")
if err != nil {
fmt.Printf("config parse error: %v\n", err)
return
}
_, err = processors.New([]*conf.C{cfg}, logptest.NewTestingLogger(nil, ""))
if err != nil {
fmt.Printf("processors.New error: %v\n", err)
return
}
fmt.Println("processors.New success")
}
func main() {
fmt.Println("Case A: data_stream only")
run(`add_agent_metadata:
data_stream:
dataset: system.cpu
namespace: default
type: metrics`)
fmt.Println("Case B: elastic_agent only")
run(`add_agent_metadata:
elastic_agent:
id: agent-123
snapshot: false
version: 9.3.0`)
}
- Run:
go run /tmp/gh-aw/agent/repro_add_agent_metadata.go
- Observed output:
Case A: data_stream only
processors.New error: missing elastic_agent option in add_agent_metadata
Case B: elastic_agent only
processors.New error: missing data_stream option in add_agent_metadata
Expected vs Actual
Expected: add_agent_metadata should accept configs with only data_stream or only elastic_agent when users only need one of these metadata blocks.
Actual: processor registration enforces both sections as required and fails config loading with missing ... option errors.
Failing Test
A minimal failing test can assert that processors.New succeeds for either of these configs:
add_agent_metadatawith onlydata_streamadd_agent_metadatawith onlyelastic_agent
Today both fail during config validation.
Evidence
- Plugin registration requires both fields:
libbeat/processors/actions/add_agent_metadata.go:27-29
- Implementation treats both sections as optional (
nilchecks and conditional updates):libbeat/processors/actions/addagentmetadata/add_agent_metadata.go:70-89libbeat/processors/actions/addagentmetadata/add_agent_metadata.go:91-107
- Existing tests explicitly verify optional behavior for each section:
libbeat/processors/actions/addagentmetadata/add_agent_metadata_test.go:116-165
- Direct constructor path works with partial config (showing core processor logic is valid), while registry path rejects it (reproduction output above).
[!NOTE]
🔒 Integrity filtering filtered 1 item
Integrity filtering activated and filtered the following item during workflow execution.
This happens when a tool call accesses a resource that does not meet the required integrity or secrecy level of the workflow.
- issue:elastic/beats#unknown (
search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)
What is this? | From workflow: Bug Hunter
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
- expires on Apr 8, 2026, 11:44 AM UTC
- Dominant language
- Go
- Stars
- 12.7k
- Forks
- 5k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 305
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from elastic/beats
-
[bug-hunter] http_endpoint skips options_response_code validation for empty options_headers map Openneeds_team
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
needs_team
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
needs_team
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
needs_team
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
docs Team:Elastic-Agent-Data-Plane
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100