Draft: [skip ci] Remove v1 session credits ingestion, step 1 of 3: stop and no-op the workers
What does this MR do and why?
Release M of the three-release worker removal for the v1 session credits sync. Two sequences meet here: this is the first of the three worker-removal MRs (steps 1, 2 and 3 of 3 in the titles), and the worker removal as a whole is the third and last step of the v2 session credits rework (v2 behind a flag, v2 rollout and cutover, then retire v1). v2 replaces v1, so v1 can be retired once v2 is rolled out.
GitLab requires worker classes to be removed over three releases, so this MR keeps the classes and stops everything that uses them:
- Removes the
ai_duo_workflows_fetch_session_credits_cron_workerentry fromee/config/schedule.ymland its minute offsetcron_for_session_creditsinlib/gitlab/sidekiq_config/cron_job_initializer.rb, so no new jobs are enqueued. - Reduces
Ai::DuoWorkflows::FetchSessionCreditsCronWorkerandAi::DuoWorkflows::FetchNamespaceSessionCreditsWorkerto no-op shells. Theperformsignatures,ApplicationWorker,idempotent!,data_consistency,feature_categoryand::CronjobQueue(on the cron worker) are kept, so jobs already queued or enqueued by older pods during a rolling deploy still run and do nothing.ee/app/workers/all_queues.ymlis regenerated. - Deletes the
duo_workflow_session_credits_ingestionfeature flag and every check of it. - Deletes
Ai::DuoWorkflows::SessionCredits::IngestService, the CustomersDot client'sGET_SESSION_CREDITS_QUERY,get_session_credits,get_session_credits_slice,session_credits_disabled_error?,SESSION_CREDITS_IDS_PER_QUERYandSESSION_CREDITS_DISABLED_MESSAGE(v2 matches the kill switch by error code, so the text had no reader left), andWorkflow.BILLABLE_STATUSESand.billable_status_values, with their specs. - Keeps
Ai::DuoWorkflows::SessionCredits::Backoff,CLICKHOUSE_QUERY_READ_TIMEOUTand the client'sread_timeout:option, because the v2get_sessionsquery uses them. - In
ee/app/graphql/types/ai/duo_workflows/session_artifact_type.rb,CREDITS_TABLE_NAMEbecomes the literalduo_workflow_session_enrichmentsuntil the v2 cutover (https://gitlab.com/gitlab-org/gitlab/-/work_items/629769) aliases the v2 service constant. ThecreditsUseddescription no longer names a flag.doc/api/graphql/reference/_index.mdandpublic/-/graphql/introspection_result.jsonare regenerated.
Behaviour change: until now the cron scanned duo_workflows_workflows in Postgres every 15 minutes even with the flag off, and wrote a ClickHouse cursor. That stops here.
Deliberately not removed:
- The ClickHouse
sync_cursorsrowduo_workflow_session_credits. There is no precedent for deleting cursor rows and nothing reads it. - The Postgres index
idx_workflows_status_updated_at_id. It predates v1 andCleanStuckWorkflowsServiceuses it.
Not regenerated: doc/api/graphql/reference/experimental/objects.md. CI does not check it and it has a single bulk commit.
On size: of the roughly 2,300 changed lines, all but about 60 are deletions or the regenerated public/-/graphql/introspection_result.json. The three commits are already the smallest units that each stand alone, so this is not split further.
Release gate
This MR stays Draft until release M, expected to be 19.7. CI cannot enforce this gate. Do not merge before all of these hold:
- The v2 rollout is stable on GitLab.com and self-managed.
- The v2 cutover is merged (the v2 ingest service points at
duo_workflow_session_enrichmentsand the_v2evaluation table is dropped). - v2 emits the
duo_workflow_session_credits_fetch_failures_totalcounter, so observability stays at the level agreed on the v2 issue.
This is the first of a stack. MR B (release M+1) targets this branch and MR C (release M+2) targets MR B. The reasons for three releases are in https://docs.gitlab.com/development/sidekiq/compatibility_across_updates/#removing-worker-classes. TrendingProjectsWorker was removed the same way across 19.1, 19.2 and 19.3.
References
- Issue: https://gitlab.com/gitlab-org/gitlab/-/work_items/629771
- Stacked MR plan: https://gitlab.com/gitlab-org/gitlab/-/work_items/629771#note_3924894324
- v2 implementation issue: https://gitlab.com/gitlab-org/gitlab/-/work_items/629767
- v2 implementation MRs (merged): !258596 (merged) and !260768 (merged)
- v2 rollout issue: https://gitlab.com/gitlab-org/gitlab/-/work_items/629769
- Master design doc: https://gitlab.com/gitlab-org/gitlab/-/snippets/6063703
Screenshots or screen recordings
Not applicable, backend only.
| Before | After |
|---|---|
How to set up and validate locally
bundle exec rspec ee/spec/workers/ai/duo_workflows/ ee/spec/lib/gitlab/subscription_portal/subscription_usage_client_spec.rb ee/spec/models/ai/duo_workflows/workflow_spec.rb ee/spec/lib/gitlab/sidekiq_config/cron_job_initializer_spec.rb ee/spec/initializers/1_settings_spec.rb ee/spec/graphql/types/ai/duo_workflows/session_artifact_type_spec.rb spec/workers/every_sidekiq_worker_spec.rb
bin/rake gitlab:sidekiq:all_queues_yml:check
git grep -n 'session_credits_ingestion\|get_session_credits\|billable_status\|IngestService' -- ee lib configThe git grep should return nothing.
In a Rails console, Sidekiq::Cron::Job.find('ai_duo_workflows_fetch_session_credits_cron_worker') returns nil after a restart. creditsUsed still resolves for a session with an existing row.
Integration check
Verified on 2026-10-01 against master plus the v2 branch plus MRs A, B and C merged together, which is the state after step 3 ships. 1036 examples pass across the CustomersDot client, Workflow model, GraphQL type, cron initializer, settings, Backoff and repo-wide Sidekiq worker specs. Both queue registry checks, the GraphQL reference check, and the migration checksum and timestamp validators pass. A grep for every removed identifier returns nothing. Not verified locally: the GraphQL request specs, which cannot run outside CI, and the v2 worker path, which does not exist yet.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.