Conversation
Support both `def` and `async def` function definitions in @Remote decorator. Changes: - Modified AST parser to recognize both FunctionDef and AsyncFunctionDef nodes - Added textwrap.dedent() to handle indented function definitions - Updated client.py docstring with async/sync examples - Added comprehensive test suite for async function support Fixes ValueError when wrapping async functions with @Remote decorator.
Support both `def` and `async def` function definitions in the `@remote` decorator. Changes: - Modified AST parser to recognize both FunctionDef and AsyncFunctionDef nodes - Added textwrap.dedent() to handle indented function definitions - Updated client.py docstring with async/sync examples - Added comprehensive test suite for async function support Fixes ValueError when wrapping async functions with the remote decorator.
…rator' of https://github.com/runpod/tetra-rp into deanq/ae-1469-bug-support-async-and-non-for-remote-decorator
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for async function definitions to the @Remote decorator by updating the AST parser to recognize both FunctionDef and AsyncFunctionDef nodes. The changes fix a ValueError that occurred when wrapping async functions.
Key changes:
- Modified AST parser to handle both sync and async function definitions
- Added
textwrap.dedent()to properly handle indented function definitions - Updated documentation with async/sync usage examples
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/tetra_rp/stubs/live_serverless.py | Updated AST parser to recognize both FunctionDef and AsyncFunctionDef nodes, added dedent for indented contexts |
| src/tetra_rp/client.py | Updated docstring with async/sync examples and clarified function signature support |
| tests/unit/test_async_function_support.py | Added comprehensive test suite covering sync/async functions, type hints, imports, and edge cases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes ValueError when using @Remote decorator with async functions by: - Adding inspect.unwrap() to get original function from wrapper - Supporting ast.AsyncFunctionDef in addition to ast.FunctionDef - Adding early dedenting to handle functions defined in classes/methods This enables proper source extraction for both sync and async decorated functions, resolving the "Could not find function definition" error.
jhcipar
approved these changes
Nov 14, 2025
rambo-runpod
approved these changes
Nov 14, 2025
Merged
This was referenced Feb 6, 2026
Closed
Closed
Closed
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.
Support both
defandasync deffunction definitions in @Remote decorator.Changes:
Fixes ValueError when wrapping async functions with @Remote decorator.