Repository navigation
Conversation
The background task panel uses raw fetch, so the axios interceptor that redirects 401 responses to /login never applied to it, and loadTasks only logged the error while setInterval kept firing. One local session recorded 4,555 unauthorized task-list polls and two failed batch cancels. The panel stayed on stale state, so a batch that actually wrote its chapters looked like "nothing happened". Attach status/code to the request error, expose isTaskAuthError, and stop polling + route to /login when the session is rejected.
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.
Why
A user reported "one chapter ran for an hour and nothing came out". The backend had actually written four chapters in that window (18:36–19:18, all
status=completed, last one 3,488 chars). The UI never showed them.Root cause, from the backend access log:
backgroundTaskServicetalks to the API with rawfetch, so the axios response interceptor inservices/api.ts— the only place that redirects 401 to/login— never applied to it.FloatingTaskPanel.loadTaskscaught the failure and only calledconsole.error, while itssetIntervalkept polling every 15s. Net effect: the task panel stays on stale state forever, and cancelling a batch silently fails.What
backgroundTaskService:TaskRequestErrornow carriesstatusandcode; newisTaskAuthError()reuseserrorMapper.isUnauthenticatedError.FloatingTaskPanel: on an auth failure, set a ref that short-circuits further loads, warn once, and route to/login(same guard as the axios interceptor: skipped when already there).No new user-facing strings, so no locale changes.
Test plan
npx tsc -b→ exit 0npm test(node:test + vitest) → 28 files / 233 tests passederror-contract.test.ts: 401 is reported as an auth error, 500 is not, while the existing "action prefix + mapped envelope" message contract is unchanged.npm run build→ built successfully.This is independent of the generation-latency work in #296.