From 7912a77ae748b08d08f87d54448888c12b7ade97 Mon Sep 17 00:00:00 2001 From: Alex Mazzeo Date: Fri, 9 Jan 2026 13:39:42 -0800 Subject: [PATCH 1/3] Remove TODO comments marked as "Won't Do" in Nexus TODO triage This commit removes TODO comments from the codebase that were triaged and marked as "Won't Do" in the Nexus Python SDK TODO tracking document. These comments documented items that were decided not to be implemented or were already completed. Removed TODO comments from: - temporalio/worker/_activity.py (2 comments) - temporalio/workflow.py (1 comment) - temporalio/worker/_nexus.py (1 comment) - temporalio/nexus/_token.py (1 comment) - tests/nexus/test_workflow_caller.py (3 comments) Co-Authored-By: Claude Sonnet 4.5 --- temporalio/nexus/_token.py | 2 -- temporalio/worker/_activity.py | 4 ---- temporalio/worker/_nexus.py | 1 - temporalio/workflow.py | 3 --- tests/nexus/test_workflow_caller.py | 4 ---- 5 files changed, 14 deletions(-) diff --git a/temporalio/nexus/_token.py b/temporalio/nexus/_token.py index 51e668baa..edd95aa21 100644 --- a/temporalio/nexus/_token.py +++ b/temporalio/nexus/_token.py @@ -45,8 +45,6 @@ def _to_client_workflow_handle( ) return client.get_workflow_handle(self.workflow_id, result_type=result_type) - # TODO(nexus-preview): The return type here should be dictated by the input workflow - # handle type. @classmethod def _unsafe_from_client_workflow_handle( cls, workflow_handle: temporalio.client.WorkflowHandle[Any, OutputT] diff --git a/temporalio/worker/_activity.py b/temporalio/worker/_activity.py index 93249fad5..23f2ed5cc 100644 --- a/temporalio/worker/_activity.py +++ b/temporalio/worker/_activity.py @@ -159,7 +159,6 @@ async def raise_from_exception_queue() -> NoReturn: ) self._running_activities[task.task_token] = activity elif task.HasField("cancel"): - # TODO(nexus-prerelease): does the task get removed from running_activities? self._handle_cancel_activity_task(task.task_token, task.cancel) else: raise RuntimeError(f"Unrecognized activity task: {task}") @@ -190,9 +189,6 @@ async def drain_poll_queue(self) -> None: # Only call this after run()/drain_poll_queue() have returned. This will not # raise an exception. - # TODO(nexus-preview): based on the comment above it looks like the intention may have been to use - # return_exceptions=True. Change this for nexus and activity and change call sites to consume entire - # stream and then raise first exception async def wait_all_completed(self) -> None: running_tasks = [v.task for v in self._running_activities.values() if v.task] if running_tasks: diff --git a/temporalio/worker/_nexus.py b/temporalio/worker/_nexus.py index 8f6226ea3..94021339f 100644 --- a/temporalio/worker/_nexus.py +++ b/temporalio/worker/_nexus.py @@ -91,7 +91,6 @@ def __init__( ) self._data_converter = data_converter - # TODO(nexus-preview): interceptors self._interceptors = interceptors self._running_tasks: dict[bytes, _RunningNexusTask] = {} diff --git a/temporalio/workflow.py b/temporalio/workflow.py index 90daecbe2..13e4d37ad 100644 --- a/temporalio/workflow.py +++ b/temporalio/workflow.py @@ -5476,9 +5476,6 @@ async def execute_operation( summary: str | None = None, ) -> OutputT: ... - # TODO(nexus-preview): in practice, both these overloads match an async def sync - # operation (i.e. either can be deleted without causing a type error). - # Overload for sync_operation methods (async def) @overload @abstractmethod diff --git a/tests/nexus/test_workflow_caller.py b/tests/nexus/test_workflow_caller.py index 07c22e688..273581302 100644 --- a/tests/nexus/test_workflow_caller.py +++ b/tests/nexus/test_workflow_caller.py @@ -54,7 +54,6 @@ from tests.helpers.metrics import PromMetricMatcher from tests.helpers.nexus import create_nexus_endpoint, make_nexus_endpoint_name -# TODO(nexus-prerelease): test availability of Temporal client etc in async context set by worker # TODO(nexus-preview): test worker shutdown, wait_all_completed, drain etc # ----------------------------------------------------------------------------- @@ -549,8 +548,6 @@ async def test_sync_response( task_queue=task_queue, ) - # TODO(nexus-prerelease): check bidi links for sync operation - # The operation result is returned even when request_cancel=True, because the # response was synchronous and it could not be cancelled. See explanation below. if exception_in_operation_start: @@ -628,7 +625,6 @@ async def test_async_response( ) return - # TODO(nexus-prerelease): race here? How do we know it hasn't been canceled already? handler_wf_info = await handler_wf_handle.describe() assert handler_wf_info.status in [ WorkflowExecutionStatus.RUNNING, From 42ebe5fb9e824c858920e8a3e1cf4723583d3680 Mon Sep 17 00:00:00 2001 From: Alex Mazzeo Date: Fri, 9 Jan 2026 15:00:21 -0800 Subject: [PATCH 2/3] After syncing with team, we're happy not inheriting from asyncio.Task for NexusOperationHandle --- temporalio/worker/_workflow_instance.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/temporalio/worker/_workflow_instance.py b/temporalio/worker/_workflow_instance.py index 10fd594fd..9555cb907 100644 --- a/temporalio/worker/_workflow_instance.py +++ b/temporalio/worker/_workflow_instance.py @@ -3246,9 +3246,6 @@ async def cancel(self) -> None: await self._instance._cancel_external_workflow(command) -# TODO(nexus-preview): are we sure we don't want to inherit from asyncio.Task as -# ActivityHandle and ChildWorkflowHandle do? I worry that we should provide .done(), -# .result(), .exception() etc for consistency. class _NexusOperationHandle(temporalio.workflow.NexusOperationHandle[OutputT]): def __init__( self, From e818ebbea3b2956f8775558f258a6296883f6caf Mon Sep 17 00:00:00 2001 From: Alex Mazzeo Date: Fri, 9 Jan 2026 16:26:43 -0800 Subject: [PATCH 3/3] Remove unused self._interceptors variable in Nexus worker. Remove another todo --- temporalio/worker/_nexus.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/temporalio/worker/_nexus.py b/temporalio/worker/_nexus.py index 94021339f..9a32c2cd5 100644 --- a/temporalio/worker/_nexus.py +++ b/temporalio/worker/_nexus.py @@ -74,8 +74,6 @@ def __init__( metric_meter: temporalio.common.MetricMeter, executor: concurrent.futures.ThreadPoolExecutor | None, ) -> None: - # TODO: make it possible to query task queue of bridge worker instead of passing - # unused task_queue into _NexusWorker, _ActivityWorker, etc? self._bridge_worker = bridge_worker self._client = client self._task_queue = task_queue @@ -91,7 +89,6 @@ def __init__( ) self._data_converter = data_converter - self._interceptors = interceptors self._running_tasks: dict[bytes, _RunningNexusTask] = {} self._fail_worker_exception_queue: asyncio.Queue[Exception] = asyncio.Queue()