acoustic-carpenter-78188
05/23/2026, 5:57 AMtask.override(secrets=...) and task.override(env_vars=...) previously raised when the task's environment is reusable:
ValueError: Cannot override secrets when reusable is set. ...
ValueError: Cannot override env when reusable is set. ...
The guard's intent — keep one actor pool per env — is already enforced downstream by the actor pool key. extract_unique_id_and_image (in _internal/runtime/reuse.py) folds both the task's security_context and the serialized container (which carries the env vars) into the pool key. So a secret or env-var override deterministically maps to a different actor pool, never a polluted shared one.
Concrete use case
We're building a multi-user "Claude Code in Flyte" service where each user owns a per-identifier credentials secret (<identifier>-claude-session) and per-session env. The launcher does:
pinned = claude_session.override(
secrets=flyte.Secret(key=secret_key, mount=SECRET_MOUNT),
env_vars={"SESSION_ID": session_id},
)
return await pinned(...)
claude_session stays reusable so concurrent sessions for the same user share an actor pod (and its FUSE-mounted volume at /root); cross-user/session isolation comes from the secret + env override routing to a distinct pool. The old guard blocked this outright, and reusable='off' would cost us the pool sharing we explicitly want.
What changed
Drop the secrets and env_vars checks from the reusable guard in Task.override(). Both feed the actor pool key, so overriding either routes to a distinct pool instead of mutating a shared one.
Resources stay locked. A reusable actor runs with its environment's pod spec, so a per-task resource override wouldn't take effect on the shared actor — override(resources=...) on a reusable task still raises; use reusable='off' to change resources.
Test plan
• test_override_secrets_with_reuse — secret override on a reusable env is allowed.
• test_override_env_vars_with_reuse — env-var override on a reusable env is allowed.
• test_oomer_override_with_reuse_incorrect — resources override on a reusable env still raises.
🤖 Generated with Claude Code
flyteorg/flyte-sdkacoustic-carpenter-78188
05/28/2026, 5:36 PM