Skip to content

make deploy-managed-agent.sh run on windows - #116

Open
rootkiller6788 wants to merge 2 commits into
anthropics:mainfrom
rootkiller6788:fix-scripts-windows-utf8-crlf
Open

make deploy-managed-agent.sh run on windows#116
rootkiller6788 wants to merge 2 commits into
anthropics:mainfrom
rootkiller6788:fix-scripts-windows-utf8-crlf

Conversation

@rootkiller6788

Copy link
Copy Markdown

Tried to run the cookbook checks on a Windows box and they fell over in two ways.

  1. validate.py and the yaml2json helper in the deploy script read files with the locale default encoding. On a system where that isn't utf-8 (Windows defaults to gbk), the cookbook yaml — which is full of em-dashes — blows up with UnicodeDecodeError before validation even starts.

  2. The deploy script reads every $(jq -r ...) value without trimming carriage returns. The native jq.exe on Windows emits CRLF line endings, so a skill path comes back as .../cold-start-interview\r. [[ -d ]] then fails with "skill path not found", and the dry-run agent ids get a trailing CR that jq refuses to parse as a number in --argjson.

The fix is small and safe: read the manifests as utf-8 explicitly, and pipe jq output through tr -d '\r'. On Linux/macOS jq emits plain LF, so those pipes are no-ops.

Verified on Windows/git-bash: before the change deploy-managed-agent.sh reg-monitor --dry-run died with "skill path not found"; after it, all five cookbooks dry-run clean and scripts/test-cookbooks.sh passes.

Path.read_text() uses the locale default encoding, so on a non-utf-8
system (windows, gbk) it chokes on the em-dashes and accented chars
that appear in the cookbook schemas. Make the read explicit.
Two things break the script on windows/git-bash:

1. The python in yaml2json opens the manifest with the locale default
   encoding, which is gbk on a Chinese windows box. The cookbook yaml
   is utf-8 (em-dashes everywhere), so safe_load blows up.

2. The native jq.exe writes CRLF line endings. Every $(jq -r ...)
   value carries a trailing carriage return, so `-d` on a skill path
   fails ("skill path not found"), the system.file existence check
   misses, and the DRYRUN_<name> 1 lines are passed to --argjson with
   a trailing CR, which jq refuses to parse as a number.

Read the manifest as utf-8 and strip CR from jq output lines. The
pipes are no-ops on unix where jq emits plain LF.
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

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.

1 participant