acoustic-carpenter-78188
05/19/2026, 8:21 PMAppEnvironment._caller_frame.filename to locate the module that holds the module-level app_env binding the deployed fserve container must import. Four subclasses
(MCPAppEnvironment, FastAPIAppEnvironment, FlyteWebhookAppEnvironment, AgentChatAppEnvironment) were overwriting the parent class's correctly-computed _caller_frame with a 2-level frame.f_back.f_back walk that landed on the synthesized dataclass __init__ whose co_filename is "<string>". The resolver then raised RuntimeError, container_cmd silently dropped --resolver-args from the command line, and the deployed container crashed at boot with ValueError: No command provided to execute.
This change:
• Declares _caller_frame once on the parent AppEnvironment (field(init=False, default=None, repr=False, compare=False)).
• Extracts a robust walker _find_user_caller_frame() that skips every frame whose source file lives inside the SDK source tree or has an angle-bracketed co_filename (<string>, <frozen ...>), plus any __post_init__ / __init__ frames so a user subclass that chains super().__post_init__() still resolves to its caller.
• Deletes the broken 2-level overrides in the four subclasses.
Adds tests/flyte/app/test_caller_frame_resolution.py covering:
• Direct module-level instantiation lands on the user file.
• Factory helpers (single-level and nested) still land on the user file.
• Synthesized filenames are never reported.
• Every formerly-broken subclass now inherits the correct walker.
• container_cmd emits --resolver-args module:varname end-to-end.
All 378 existing tests/flyte/app/ + tests/flyte/ai/ tests pass.
flyteorg/flyte-sdkacoustic-carpenter-78188
05/19/2026, 10:29 PM