Skip to content

fix(tracking): stop submitting Grok tasks while Cloro returns 500 for all of them - #734

Merged
gkhngyk merged 1 commit into
mainfrom
fix/pause-grok-scraping
Aug 18, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
fix/pause-grok-scraping

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Cloro is returning 500 for every Grok task. Until that clears, a nightly run that still lists the platform submits one paid task per prompt per region, holds the drain loop open waiting for callbacks that never arrive, and stores nothing for the trouble. This drops Grok before submission instead of letting each task fail on its own.

The filter is a single list:

export const UNAVAILABLE_PLATFORMS = ['grok-web'];

Emptying it restores Grok on the very next run. Nothing else has to change, and no prompt has to be touched — which is the point of doing it this way.

Why the engine picker is deliberately untouched

The obvious companion change — removing Grok from SCRAPER_GROUPS so nobody can select it — is the one thing that must not happen here.

ALL_SCRAPERS is derived from that list, and two write paths use it as the allow-set:

  • filterByPlan in web/src/lib/actions/prompt.ts filters platforms on every prompt write
  • alignPromptsToPlanForOrg in web/src/lib/plan-engines.ts rewrites prompts.platforms on plan changes

Drop Grok from the list and both start silently stripping the stored id. Every prompt edit and every upgrade, downgrade or cancellation would erase the selection, and restoring Grok would then need a data repair across every affected org rather than deleting one array entry.

So prompts keep their Grok selection; only the submission is skipped. The trade-off is that the picker still offers an engine that produces nothing for now — the same outcome the customer gets today from the 500s, minus the spend.

Also here

The existing chatgpt-shopping filter moves into the same helper. Both answer one question — which of a prompt's stored platform ids should this run actually pay for — and both exist because the saved array cannot be trusted at run time: a brand may have turned Shopping off since, a platform may be down. Keeping them in one place means a future outage is a one-line list edit, not a new branch in the middle of the run loop.

runnablePlatforms is exported and unit-tested, matching how the other run-loop predicates in this file are already covered.

Related issue

None — operational response to a live provider outage.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. Run a tracking cycle for a brand whose prompts include grok-web and confirm no Grok task is submitted to Cloro, while every other platform still is.
  2. Confirm the run's task total reflects the reduced count rather than reporting tasks it never submitted.
  3. Confirm the prompt rows are unchanged — platforms still contains grok-web after the run.
  4. Confirm a brand with Shopping disabled still skips chatgpt-shopping, and one with it enabled still runs it.
  5. Empty UNAVAILABLE_PLATFORMS locally and confirm Grok tasks are submitted again with no other change.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from server/)
  • yarn format:check passes (run from server/)
  • Changes are focused — one concern per PR

Server test suite passes: 281 tests, including 5 new ones for runnablePlatforms. No web/ files are touched.

… all of them

Every Grok task Cloro accepts has been answering 500 since 2026-08-18. A run
that still lists the platform submits one paid task per prompt per region,
holds the drain open waiting for callbacks that never arrive, and records
nothing — so Grok is dropped before submission rather than failing task by
task.

The filter lives in the tracking worker and nowhere else. Removing Grok from
the engine picker would also remove it from ALL_SCRAPERS, which filterByPlan
and alignPromptsToPlanForOrg use as the allow-set when writing prompts: every
prompt edit and every plan change would then quietly strip the stored id, and
bringing Grok back would need a data repair instead of a revert. Prompts keep
their selection; only the submission is skipped.

The existing shopping filter moves into the same helper, since both answer one
question — which stored platform ids should this run actually pay for — and
both have to be decided at run time rather than trusted from the saved array.

Emptying UNAVAILABLE_PLATFORMS restores Grok on the next run.
@gkhngyk
gkhngyk merged commit 2070ec9 into main Aug 18, 2026
5 checks passed
@gkhngyk
gkhngyk deleted the fix/pause-grok-scraping branch August 18, 2026 11:08
@gkhngyk gkhngyk mentioned this pull request Aug 24, 2026
7 of 12 tasks
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.

1 participant