Skip to content

Bug: Workflow scriptPath fails on Windows due to backslash path serialization #4

Description

@Adityakk9031

Describe the bug

When using the Workflow feature on a Windows machine, the scriptPath sent to the Claude API backend is serialized using backslashes instead of forward slashes, causing the script to fail to resolve on the remote API endpoint.

In src/yoke/models.py, the Workflow.native_input() method constructs the payload that gets sent to Claude. It currently uses str(self.script_path) to serialize the path. On Windows, this generates paths with backslashes (e.g. workflows\audit-routes.js). Since backend APIs typically expect POSIX-style paths (forward slashes), the backend interprets the backslash as a literal character in the filename rather than a directory separator, resulting in a failure to locate the workflow script.

Steps to reproduce

  1. Run Yoke on a Windows machine.
  2. Attempt to execute a Workflow that defines a script_path (e.g. Workflow(script_path=Path("workflows/audit-routes.js"))).
  3. The payload sent to the API contains "scriptPath": "workflows\\audit-routes.js".
  4. The API fails to resolve the script path because of the backslash separator.

Expected behavior

The native_input() method should serialize script_path with forward slashes on all operating systems to maintain compatibility with the API.

Suggested Fix

Update native_input() in src/yoke/models.py to use .as_posix():

    def native_input(self) -> dict[str, Any]:
        """Return Claude-style Workflow tool input fields."""

        data: dict[str, Any] = {}
        if self.script is not None and self.script.strip():
            data["script"] = self.script
        if self.native_name is not None:
            data["name"] = self.native_name
        if self.script_path is not None:
            data["scriptPath"] = self.script_path.as_posix()
        if self.args is not None:
            data["args"] = self.args
        if self.resume_from_run_id is not None:
            data["resumeFromRunId"] = self.resume_from_run_id
        return data

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions