Repository navigation
Python: [Bug]: native Windows --files paths skip changed-package tasks #9742
Description
Observed Behavior
At main 1168c001dd228d6c7a623fd14f53e1f05b7b4540, python/scripts/run_tasks_in_changed_packages.py recognizes a repository-relative path with / but not the native Windows spelling with \. The complete get_changed_packages() function returns an empty set for python\packages\core\agent_framework\_types.py, while the same forward-slash path selects core. A native path to the redis package is also omitted.
The function strips only the text prefix python/, then joins the remaining path to workspace_root, which already ends in python. The native spelling therefore points under python/python. The calling script returns without running tasks when the set is empty. The package-routing result was reproduced directly; the task runner itself was not executed.
Expected Behavior
Repository-relative paths in the platform's native spelling should select the same package as equivalent forward-slash paths. Workspace-relative and absolute paths should keep their current behavior.
Steps to Reproduce
- Check out the above main commit on Windows.
- Run the standard-library-only probe below from the repository root.
- Observe that only the forward-slash path selects core; the native repo-relative path returns an empty set.
Minimal Reproduction
import ast
from pathlib import Path
source = Path("python/scripts/run_tasks_in_changed_packages.py")
tree = ast.parse(source.read_text(encoding="utf-8"))
function = next(n for n in tree.body if isinstance(n, ast.FunctionDef)
and n.name == "get_changed_packages")
namespace = {"Path": Path}
exec(compile(ast.Module(body=[function], type_ignores=[]), str(source), "exec"), namespace)
workspace = Path("python").resolve()
projects = [Path("packages/core")]
for spelling in ["python/packages/core/agent_framework/_types.py",
str(Path("python/packages/core/agent_framework/_types.py"))]:
print(repr(spelling), namespace["get_changed_packages"](projects, [spelling], workspace))This executes the exact complete routing function with native pathlib and real path values. It avoids importing the task runner and does not stub Path or execute package commands.
Error Messages and Stack Traces
No exception: the native repo-relative case returns (set(), False).
Package Versions
Repository script at main 1168c00; no installed agent-framework package used.
Python Version
CPython 3.12.14 AMD64
Operating System
Windows
Regression
Unknown
Additional Context
Six native routing cases were observed: repository-relative forward/native, workspace-relative forward/native, absolute core, and native repo-relative redis. Four passed; the latter native repo-relative core/redis cases did not. An isolated diagnostic variant using native Path components recognized all six. This is not a full CLI, SDK, build, type-checking or CI result. No repository branch, source change or PR has been submitted for this observation; maintainer direction is requested before proceeding with a production change.
AI Assistance
Codex assisted the report analysis and diagnostic code. The submitter is responsible for verifying this report.
Acknowledgements
- I searched existing issues and did not find a duplicate.
- I personally verified this behavior and the reproduction details are authentic.
- I will wait for explicit maintainer agreement before starting implementation of a non-trivial change.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity
leilei3167 commentedon Oct 27, 2026
Looking at this. A repository-relative
--filespath that uses backslashes never matches thepython/prefix, soget_changed_packages()returns an empty set and the task run is skipped. I'll send a small change that normalizes separators before that prefix strip. Forward-slash paths, workspace-relative paths, and absolute paths keep their current behavior.JianhaoYu-AI commentedon Oct 27, 2026
I have a local prototype for #9742 and see that #9769 is already open. Before opening another PR, would maintainers prefer any follow-up coverage to stay with #9769, or would a separate contribution be useful?
The prototype recognizes the repository prefix through native
Path.parts, preserving POSIX filenames containing literal backslashes. Its 28 tests cover native paths, UNC and./python/inputs, and CLI routing for core and redis. They use the declared Rich dependency rather than a global module stub. A workflow step runs them in the existing Windows/Linux matrix, since package test discovery does not collectscripts/tests.The tests and Ruff checks pass on macOS; real Windows execution is still pending. Codex helped prepare the implementation, tests, and this proposal. No upstream PR has been opened for this prototype.
ktz03 commentedon Oct 27, 2026
I have opened #9775 as my implementation for this report, using the native
Path-component direction from the original diagnostic. The focused Windows suite passes 15 tests with one POSIX-only skip; the PR includes CLI routing regressions and the existing Windows/Linux matrix entry. I will maintain #9775 through review, with the overlapping #9769 explicitly identified in its description for maintainer coordination.