fix(runner/config): split header env vars on ';' to match legacy agent - #523
fix(runner/config): split header env vars on ';' to match legacy agent#523mayankpande88 wants to merge 2 commits into
Conversation
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
|
📦 Image Tags Updated |
There was a problem hiding this comment.
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.
| // 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"}}}, | ||
| } |
There was a problem hiding this comment.
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"},
},
},
}
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