fix(auth): skip tenant auth for all internal background tasks#240
Merged
nicoloboschi merged 1 commit intoJan 30, 2026
Merged
Conversation
Previously, _authenticate_tenant only skipped extension auth for internal requests when _current_schema was set to a non-public schema. This caused async HTTP retain (document upload with async_processing=True) to fail with AuthenticationError because the worker had no API key and the schema was "public". Remove the public-schema guard since internal tasks were already authenticated at submission time. The worker sets _current_schema from the task's _schema field for tenant schemas, and it defaults to "public" for public schema tasks — both are valid.
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.
Summary
Problem
Internal background tasks (consolidation, async retain via worker) fail with
AuthenticationErrorwhen using tenant extension on public schema. The worker doesn't have an API key, and the previous code only skipped auth for non-public schemas.The original logic was:
This breaks async HTTP retain (
async_processing=True) because:Solution
Since tasks were already authenticated at submission time, skip tenant auth for ALL internal requests:
Test plan
🤖 Generated with Claude Code