Skip to content

bug(windows): parse_uri does not recognize Windows absolute paths - 'No handler for URI' for local behaviors and bundle modules #374

Description

Summary

On native Windows, parse_uri does not recognize absolute Windows paths (drive-letter C:\... / C:/..., or UNC \\server\share\...). They fall through to the package-name heuristic, so no source handler claims them and resolution fails with BundleNotFoundError: No handler for URI: C:\....

Environment

  • Windows 11, native PowerShell (no WSL)
  • amplifier CLI 2026.08.14, amplifier-foundation @ c779cba (installed via uv tool install git+https://github.com/microsoft/amplifier)

Where it breaks

  1. Local bundle/behavior references in ~/.amplifier/settings.yaml, e.g.:

    bundle:
      app:
        - C:/Users/dan/code/bundle-the-usual/behaviors/the-usual.yaml

    produces Failed to compose behavior 'C:/Users/dan/...': No handler for URI.

  2. Relative module entries inside cached git bundles. The app resolves these to absolute OS path strings before passing them to the source resolver, so on Windows every such module fails to activate and strict mode aborts session startup:

    - tool-apply-patch: No handler for URI: C:\Users\dan\.amplifier\cache\amplifier-bundle-filesystem-800514b6bec1fdef\modules\tool-apply-patch
    - tool-terminal-inspector: No handler for URI: C:\...\modules\tool-terminal-inspector
    - hooks-design-context: No handler for URI: C:\...\modules\hooks-design-context
    

Root cause

In amplifier_foundation/paths/resolution.py, parse_uri classifies only file:// URLs, leading-/ POSIX absolute paths, and ./ / ../ relative paths as file URIs. C:/... and C:\... match none of these branches and end up in the package-name fallback ("C:" becomes the package, Users/dan/... its subpath).

Repro

from amplifier_foundation.paths.resolution import parse_uri

parse_uri(r"C:\Users\dan\bundle").is_file    # False -- expected True
parse_uri("C:/Users/dan/bundle").is_file     # False -- expected True
parse_uri(r"\\server\share\bundle").is_file  # False -- expected True

Proposed fix

Recognize drive-letter (``:followed by` or `/`) and UNC (`\`) prefixes as file URIs in `parse_uri`, before the package-name fallback. (`file://C:/Users/...` happens to work today because the `file://` branch keeps the drive-letter tail intact, but internal callers pass plain OS paths.)

PR to follow.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions