fix(background-task): register fallback chain for background sessions (fixes #2203)#2800
Merged
code-yeongyu merged 1 commit intocode-yeongyu:devfrom Mar 24, 2026
Conversation
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
No issues found across 1 file
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Targeted fix to register fallback chains for background tasks, mirroring existing sync task logic. Minimal change with no impact on core execution flow.
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
When a background task encounters a model error (rate limit, quota, etc.), the runtime-fallback hook checks
sessionFallbackChains.get(sessionID)to find the user's configured fallback models. For background tasks, this map entry was never set becauseexecuteBackgroundTask()passes thefallbackChaintomanager.launch()as input but never callssetSessionFallbackChain()to register it.In
sync-task.ts(line 66),setSessionFallbackChain(sessionID, fallbackChain)is called after session creation. Background tasks lacked this call, causingsessionFallbackChains.get(sessionID)to returnundefined. The fallback hook then falls through to the hardcodedrequirements?.fallbackChaininstead of using the user's configuredfallback_models.Fix
Added
setSessionFallbackChain(sessionId, fallbackChain)call inexecuteBackgroundTask()after the session ID becomes available (after the wait-for-session loop), matching the pattern used inexecuteSyncTask().Changes
src/tools/delegate-task/background-task.tssetSessionFallbackChain, call it after session ID is resolvedFixes #2203
Summary by cubic
Register the user-configured fallback chain for background task sessions so runtime fallback uses the correct models. Fixes #2203.
fallbackChain, causing fallback to use defaults.sessionId, callsetSessionFallbackChain(sessionId, fallbackChain)inexecuteBackgroundTask()(mirrors sync path).Written for commit d2d48fc. Summary will update on new commits.