Skip to content

ray.remote decorator not working #4787

Open

Description

@yangdanny97

Describe the Bug

from typing import Any, cast

import ray


@ray.remote(max_restarts=-1)
class Worker:
    def value(self) -> int:
        return 1


if __name__ == "__main__":
    ray.init()
    actor = Worker.options(name="worker").remote()
    assert ray.get(cast(Any, actor).value.remote()) == 1

Pyright does not error here

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Activity

  1. yangdanny97 commented on Sep 2, 2026

    @yangdanny97
    CollaboratorAuthor

    IDK about what this decorator does

  2. dillydill123 commented on Sep 2, 2026

    @dillydill123
    Contributor

    I had to replace this with Any. Here is what LLM told me at the time:

        # Ray's `@ray.remote` decorator returns per arity `RemoteFunction0..9` generics whose `.remote(...)` methods use
        # positional only parameters (`__arg0`, `__arg1`, ...) instead of `ParamSpec`, so they cannot preserve the
        # decorated function's real signature. pyrefly therefore rejects keyword arguments (`unexpected-keyword`) and the
        # `T | ObjectRef[T]` per-arg wrapping (`bad-argument-type`) at every `.remote(...)` call site.
        "ray._private.worker.*",
    
  3. asukaminato0721 commented on Sep 3, 2026

    @asukaminato0721
    Collaborator

    related #2294 #2773

  4. added theissue type on Sep 11, 2026
  5. github-actions commented on Oct 2, 2026

    @github-actions

    This issue has someone assigned, but has not had recent activity for more than 2 weeks.

    If you are still working on this issue, please add a comment so everyone knows. Otherwise, please unassign yourself and allow someone else to take over.

    Thank you for your contributions!

  6. removed their assignment
    on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions