Skip to content

Commit 98e9c33

Browse files
rustyconoverclaude
andcommitted
worker: _load_buffered_table_params accepts InitRequest too
The new BUFFERED_TABLE_FINALIZE init handler reuses _load_buffered_table_params to cold-load func_cls + params, but InitRequest carries function_name + attach_opaque_data on ``request.bind_call`` (not directly on the request like the buffered_table_* unary requests do). Helper now picks the right attributes based on what the request exposes. Without this fix, the BUFFERED_TABLE_FINALIZE init handler crashed with ``AttributeError: 'InitRequest' object has no attribute 'function_name'``, hanging the C++ Source phase that was waiting for the init response. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent fdf98ba commit 98e9c33

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

‎vgi/worker.py‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2446,18 +2446,30 @@ def _load_buffered_table_params(
24462446
``base_params`` per RPC via ``_dataclass_replace`` to inject the
24472447
request-scoped ``storage`` / ``auth_context`` / ``batch_index`` /
24482448
``state_id`` fields.
2449+
2450+
Accepts either a unary buffered_table_* request (carries
2451+
``function_name`` + ``attach_opaque_data`` directly) or an
2452+
``InitRequest`` (carries them under ``bind_call``). The latter
2453+
is used by the ``BUFFERED_TABLE_FINALIZE`` init phase.
24492454
"""
2455+
function_name = getattr(request, "function_name", None)
2456+
attach = getattr(request, "attach_opaque_data", None)
2457+
if function_name is None:
2458+
# InitRequest path — fields live on the inner bind_call.
2459+
function_name = request.bind_call.function_name
2460+
if attach is None:
2461+
attach = request.bind_call.attach_opaque_data
24502462
func_cls = self._resolve_function_by_name(
2451-
request.function_name,
2452-
self._unwrap_attach(request.attach_opaque_data),
2463+
function_name,
2464+
self._unwrap_attach(attach),
24532465
function_type=TableInOutGenerator,
24542466
)
24552467
# Runtime narrowing for mypy — the function_type filter above
24562468
# already guarantees this, but the resolver's static return type
24572469
# is type[Function] (the base class).
24582470
if not issubclass(func_cls, TableInOutGenerator):
24592471
raise TypeError(
2460-
f"Function '{request.function_name}' is not a TableInOutGenerator "
2472+
f"Function '{function_name}' is not a TableInOutGenerator "
24612473
f"(got {func_cls.__name__})"
24622474
)
24632475
cold_storage = BoundStorage(

0 commit comments

Comments
 (0)