Skip to content

fix(runner/config): split header env vars on ';' to match legacy agent - #523

Open
mayankpande88 wants to merge 2 commits into
mainfrom
fix/runner-header-delimiter
Open

fix(runner/config): split header env vars on ';' to match legacy agent#523
mayankpande88 wants to merge 2 commits into
mainfrom
fix/runner-header-delimiter

Conversation

@mayankpande88

Copy link
Copy Markdown
Contributor

ParseHeaders split PROMETHEUS_HEADERS / LOKI_EXTRA_HEADER /
ELASTICSEARCH_HEADER / ALERTMANAGER_HEADERS / LOKI_RULES_HEADERS on ','.
The legacy Python agent split these on ';', so a multi-header config
(or any header value containing a comma, e.g. a multi-value Accept
header) was truncated at the first comma — the first header got a
corrupted value and the rest were dropped.

Split on ';' to restore parity. Docs, chart values, and .env.example
updated to document the ';' delimiter.

Migration: multi-header configs must now separate pairs with ';'
(e.g. "X-Scope-OrgID: t1; Authorization: Bearer x"). Single-header
configs — the common case — are unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01L2HAXQH1gEtX7h4sUJsi9j

ParseHeaders split PROMETHEUS_HEADERS / LOKI_EXTRA_HEADER /
ELASTICSEARCH_HEADER / ALERTMANAGER_HEADERS / LOKI_RULES_HEADERS on ','.
The legacy Python agent split these on ';', so a multi-header config
(or any header value containing a comma, e.g. a multi-value Accept
header) was truncated at the first comma — the first header got a
corrupted value and the rest were dropped.

Split on ';' to restore parity. Docs, chart values, and .env.example
updated to document the ';' delimiter.

Migration: multi-header configs must now separate pairs with ';'
(e.g. "X-Scope-OrgID: t1; Authorization: Bearer x"). Single-header
configs — the common case — are unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L2HAXQH1gEtX7h4sUJsi9j
@mayankpande88
mayankpande88 requested a review from a team as a code owner July 14, 2026 19:28
@github-actions

Copy link
Copy Markdown
Contributor

📦 Image Tags Updated

I've automatically updated the image tags in `charts/nudgebee-agent/values.yaml` to the latest versions from GHCR for the `main` branch.

The image tags are now synchronized with the latest builds and ready for release.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

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 updates the header parsing logic in the runner configuration to split headers using a semicolon (";") instead of a comma (","). This change prevents multi-value headers containing commas (such as "Accept" headers) from being incorrectly truncated. The documentation, environment examples, Helm chart values, and unit tests have been updated accordingly. Feedback on the pull request suggests adding a test case to verify how semicolons within header values (e.g., "Content-Type" parameters) are handled, as they might be incorrectly split and truncated by the new parser.

Comment on lines +189 to 193
// A comma inside a value must survive — we split on ";" only, so a
// multi-value header (e.g. Accept) is not truncated at the comma.
{"value_can_contain_comma", "Accept: text/html, application/json",
http.Header{"Accept": []string{"text/html, application/json"}}},
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Add a test case to verify that semicolons inside header values (such as parameters in Content-Type or Accept headers) are correctly preserved and not truncated.

		// A comma inside a value must survive — we split on ";" only, so a
		// multi-value header (e.g. Accept) is not truncated at the comma.
		{"value_can_contain_comma", "Accept: text/html, application/json",
			http.Header{"Accept": []string{"text/html, application/json"}}},
		// A semicolon inside a value must survive if it's part of a parameter (no colon)
		{"value_can_contain_semicolon", "Content-Type: application/json; charset=utf-8; X-Scope-OrgID: t1",
			http.Header{
				"Content-Type":  []string{"application/json; charset=utf-8"},
				"X-Scope-Orgid": []string{"t1"},
			},
		},
	}

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