Skip to content

fix(verl): load Kubernetes job templates as UTF-8 - #635

Open
Bluu (Bluuok) wants to merge 1 commit into
microsoft:mainfrom
Bluuok:fix/k8s-template-utf8
Open

Bluu (Bluuok) wants to merge 1 commit into
microsoft:mainfrom
Bluuok:fix/k8s-template-utf8

Conversation

@Bluuok

@Bluuok Bluu (Bluuok) commented Oct 3, 2026 •

Copy link
Copy Markdown

A valid UTF-8 Kubernetes Job template can fail during rollout-manager initialization on Windows with a GBK default locale. Path.read_text() uses that locale and raises UnicodeDecodeError for ordinary UTF-8 text, before rollouts can be queued.

Read the template explicitly as UTF-8. Add a real manager-initialization regression with an em dash in the template and assert the complete text retained in the rollout configuration; close the allocated client afterwards.

Validation with the frozen native Windows Python 3.12 environment:

python -m pytest tests/verl/test_agl_rollout_manager.py -q -k loads_k8s_job_template_as_utf8
python -m pytest tests/verl/test_agl_rollout_manager.py -q
python -m ruff check agentlightning/verl/agl_rollout_manager.py tests/verl/test_agl_rollout_manager.py
python -m ruff format --check agentlightning/verl/agl_rollout_manager.py tests/verl/test_agl_rollout_manager.py
python -m pre_commit run --files agentlightning/verl/agl_rollout_manager.py tests/verl/test_agl_rollout_manager.py
git diff --check

Unchanged main: the regression failed with the actual GBK UnicodeDecodeError (byte 0x94). With the fix: 1 target test and all 14 tests in the file passed. Scoped Pyright passed with 0 errors. This regression is platform-specific: systems whose default locale is already UTF-8 can pass before the fix.

No HTTP calls, model inference or GPU training were run. Ready for review based on the author-reported validation above; this maintenance pass did not rerun tests. The CLA check passed. Fork CI is awaiting maintainer approval (action_required, 0 jobs); no CI jobs have run. AI assistance was used; the one-line production change and regression were reviewed.

@Bluuok
Bluu (Bluuok) marked this pull request as ready for review October 3, 2026 15:59
Copilot AI balanced review requested due to automatic review settings October 3, 2026 15:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The focused encoding fix is correct and covered by an appropriate regression test.

Review effort: Balanced
Findings: None

What changed in this PR

Ensures Kubernetes Job templates load consistently as UTF-8, including on Windows systems using GBK locales.

Changes:

  • Reads Job templates with explicit UTF-8 encoding.
  • Adds a regression test preserving non-ASCII template text.
File Description
agentlightning/​verl/​agl_rollout_manager.py Explicitly decodes Kubernetes templates as UTF-8.
tests/​verl/​test_agl_rollout_manager.py Tests UTF-8 loading and client cleanup.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

This branch has not been deployed

No deployments
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.

2 participants