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_worker entry from ee/config/schedule.yml and its minute offset cron_for_session_credits in lib/gitlab/sidekiq_config/cron_job_initializer.rb, so no new jobs are enqueued.
  • Reduces Ai::DuoWorkflows::FetchSessionCreditsCronWorker and Ai::DuoWorkflows::FetchNamespaceSessionCreditsWorker to no-op shells. The perform signatures, ApplicationWorker, idempotent!, data_consistency, feature_category and ::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.yml is regenerated.
  • Deletes the duo_workflow_session_credits_ingestion feature flag and every check of it.
  • Deletes Ai::DuoWorkflows::SessionCredits::IngestService, the CustomersDot client's GET_SESSION_CREDITS_QUERY, get_session_credits, get_session_credits_slice, session_credits_disabled_error?, SESSION_CREDITS_IDS_PER_QUERY and SESSION_CREDITS_DISABLED_MESSAGE (v2 matches the kill switch by error code, so the text had no reader left), and Workflow.BILLABLE_STATUSES and .billable_status_values, with their specs.
  • Keeps Ai::DuoWorkflows::SessionCredits::Backoff, CLICKHOUSE_QUERY_READ_TIMEOUT and the client's read_timeout: option, because the v2 get_sessions query uses them.
  • In ee/app/graphql/types/ai/duo_workflows/session_artifact_type.rb, CREDITS_TABLE_NAME becomes the literal duo_workflow_session_enrichments until the v2 cutover (https://gitlab.com/gitlab-org/gitlab/-/work_items/629769) aliases the v2 service constant. The creditsUsed description no longer names a flag. doc/api/graphql/reference/_index.md and public/-/graphql/introspection_result.json are 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_cursors row duo_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 and CleanStuckWorkflowsService uses 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_enrichments and the _v2 evaluation table is dropped).
  • v2 emits the duo_workflow_session_credits_fetch_failures_total counter, 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

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 config

The 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.

Edited by Chandra Saripaka

Merge request reports

Loading
Loading