Conversation
Scheduled Chats fire without a browser session, so `req.user` has no OpenID
tokens. `resolveHeaders` then throws OpenIDReauthRequiredError for any endpoint
header using {{LIBRECHAT_OPENID_ACCESS_TOKEN}} / {{LIBRECHAT_OPENID_ID_TOKEN}},
and every scheduled occurrence on such an endpoint fails before the model call.
With SCHEDULES_OMIT_UNAVAILABLE_OPENID_HEADERS=true, the agents route marks the
user of a scheduled fire, `createSafeUser` carries the marker, and
`resolveHeaders` omits a header whose OpenID credential placeholder cannot be
resolved instead of throwing, whether or not the caller strips unresolved
placeholders. Valid tokens still substitute. Interactive requests and MCP
resolution (`processMCPEnv`, which feeds the schedule MCP preflight) keep
failing closed. Off by default.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the βοΈ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
This branch has not been deployed
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
Scheduled Chats run with no browser session, so the schedule owner's
req.usercarries no OpenID tokens. Every endpoint header that uses{{LIBRECHAT_OPENID_ACCESS_TOKEN}}or{{LIBRECHAT_OPENID_ID_TOKEN}}then makesresolveHeadersthrowOpenIDReauthRequiredError, and the scheduled occurrence fails before the model is called:Seen on apro-sandbox (conversation
c0c80ac4-β¦, 2026-09-28 17:56 UTC). The aprochat LiteLLM endpoints sendauthorization: Bearer {{LIBRECHAT_OPENID_ID_TOKEN}}andx-openid-access-token, so every scheduled chat on them fails.How it works
SCHEDULES_OMIT_UNAVAILABLE_OPENID_HEADERS=true. Default behaviour is unchanged.api/server/routes/agents/index.jsmarksreq.userfor scheduled fires only (req._isScheduledFire, set bycaptureScheduleFireContext).createSafeUsercarries the marker to every header-resolution site (run, summarization, memory, activity labels, model fetch).resolveHeaders: when the marker is set and the tokens are unavailable, credential placeholders stay unresolved and the whole header is omitted, whether or not the caller strips unresolved placeholders. It never sends a literal placeholder or an emptyBearer. Valid tokens still substitute.processMCPEnv), which feeds the schedule MCP preflight and still signals re-authentication.Deployment note (aprochat)
With the headers omitted, LiteLLM requests fall back to the endpoint
apiKey. The LiteLLM-side decision (master key plus a fixedx-github-repo, or a dedicated virtual key with a budget) is tracked in aprochat-config and should land before enabling the flag in prod. AgentCore models still need the user token and remain unsupported in scheduled runs.Testing
packages/api:npx jest src/utils/env.spec.ts src/utils/headers.spec.tsβ 170 passed (4 new: throws without the marker; omits credential headers with and withoutstripUnresolved; still substitutes valid tokens)tsc --noEmit -p packages/apiclean; eslint and prettier clean on the changed filesRisk
Opt-in only, and only for verified schedule fires. With the flag on, a scheduled request drops its OpenID credential headers, so the receiving service must authenticate it another way.
π€ Generated with Claude Code