Add test for Windows colon sanitization in agent names#11
Open
robotdad wants to merge 2 commits intomicrosoft:mainfrom
Open
Add test for Windows colon sanitization in agent names#11robotdad wants to merge 2 commits intomicrosoft:mainfrom
robotdad wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Windows does not allow colons in file/directory names (except for drive letters like C:, D:). Agent names like "foundation:explorer" need to be sanitized when used in session IDs that become directory paths on the filesystem. The existing sanitization code (line 76 in tracing.py) already handles this correctly by replacing all non-alphanumeric characters with hyphens via regex: [^a-z0-9]+ → - This test documents and verifies this critical behavior for Windows compatibility, ensuring that agent names like "foundation:explorer" become "foundation-explorer" in session IDs. Fixes issue where Windows users see: "[WinError 267] The directory name is invalid" when sub-sessions use agent names containing colons. Type: test 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
Add comprehensive guidance for cross-platform development with focus on Windows compatibility. This documents critical patterns discovered from fixing production issues: 1. **File I/O Encoding**: Always specify encoding="utf-8" explicitly - Windows defaults to cp1252/charmap instead of UTF-8 - Prevents "'charmap' codec can't decode" errors - Applies to open(), Path.read_text(), Path.write_text() 2. **Path Sanitization**: Remove Windows-prohibited characters - Colons, pipes, asterisks, etc. cause [WinError 267] - Agent names like "foundation:explorer" must be sanitized - Applies to any user input used in filenames 3. **Development Checklist**: Pre-commit verification steps This guidance is loaded by all agents via common-agent-base.md, ensuring consistent Windows-safe code across the codebase. Related PRs: - amplifier-app-cli#36 (encoding fixes) - Merged - amplifier-foundation#11 (test coverage) - Open Type: docs 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves Windows compatibility by:
Background
Windows does not allow colons in file/directory names (except for drive letters like C:, D:). When agent names like "foundation:explorer" are used in session IDs that become directory paths, they must be sanitized.
The existing code already handles this correctly via regex → (line 76 in tracing.py), but we're adding a test to document this critical behavior.
Changes
Test Coverage (tests/test_tracing.py)
Documentation (context/IMPLEMENTATION_PHILOSOPHY.md)
Added comprehensive "Cross-Platform Development (Windows Compatibility)" section covering:
File I/O Encoding: Always specify encoding="utf-8" explicitly
Path Sanitization: Remove Windows-prohibited characters
Development Checklist: Pre-commit verification steps for cross-platform code
This guidance is automatically loaded by all agents via common-agent-base.md.
Issue Fixed
Prevents the error Windows users see when sub-sessions use agent names containing colons:
Related Work
Test Plan
🤖 Generated with Amplifier
Co-Authored-By: Amplifier 240397093+microsoft-amplifier@users.noreply.github.com