Skip to content

fix(scheduler): preserve pre-hydration account metadata - #5657

Open
lyy0709 wants to merge 1 commit into
Wei-Shaw:mainfrom
lyy0709:codex/fix-scheduler-metadata-projection
Open

fix(scheduler): preserve pre-hydration account metadata#5657
lyy0709 wants to merge 1 commit into
Wei-Shaw:mainfrom
lyy0709:codex/fix-scheduler-metadata-projection

Conversation

@lyy0709

@lyy0709 lyy0709 commented Aug 14, 2026

Copy link
Copy Markdown

Summary

Scheduler snapshots store a slim account projection in Redis, then apply scheduling filters before the selected account is hydrated from the database. Several fields used by those pre-hydration filters were omitted, so cache hits could behave differently from database-backed scheduling.

This change:

  • preserves the minimal credential and extra fields consumed before hydration
  • keeps access and refresh tokens out of scheduler metadata
  • versions the metadata namespace as sched:meta:v2: so existing narrow snapshots cannot remain silently valid
  • removes matching legacy metadata when accounts are written, deleted, or rejected as unencodable

The affected behavior includes per-account scheduling thresholds, Anthropic/Grok native usage windows, Grok free-tier/team gates, and OpenAI privacy/passthrough/compact routing.

This is a separate instance of the projection-loss pattern discussed in #5607; it does not duplicate #5609, which addresses API-key authorization snapshots.

Verification

  • cd backend && make test-unit
  • targeted repository race tests for projection and metadata-version cleanup
  • relevant scheduling, compact, privacy, and Grok service tests
  • cd backend && golangci-lint run --timeout=15m ./internal/repository/...
  • git diff --check upstream/main...HEAD
  • exact-head fork CI passed all test, integration, lint, frontend, and shell jobs: https://github.com/lyy0709/sub2api-upstream/actions/runs/31834418363

The exact-head Security Scan currently reports only two vulnerabilities already present on upstream main. They are handled independently by #5638 (nanoid) and #5639 (Go 1.26.6), so this scheduler PR intentionally does not duplicate those dependency changes.

Copilot AI lite review requested due to automatic review settings August 14, 2026 19:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants