Repository navigation
feat(signals): skip scout suggestion scans on low-activity projects #104535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
trunk-io
merged 11 commits into
master
from
posthog-self-driving/featsignals-skip-low-activity-scout-6d49ad
Sep 23, 2026
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f9858b2
feat(signals): skip scout suggestion scans on low-activity projects
andrewm4894 5140a88
chore: update OpenAPI generated types
andrewm4894 a91226c
fix(signals): do not back off low-activity projects
andrewm4894 3833e58
feat(signals): explain a skipped scan on the suggestions strip
andrewm4894 c76e8fb
fix(signals): refuse a capped activity read instead of truncating it
andrewm4894 970c91c
fix(signals): count a skipped scan once per decision
andrewm4894 cf74ffe
fix(signals): cap the wall clock on each activity read
andrewm4894 6203fc7
fix(signals): read the activity check off the offline cluster
andrewm4894 475a7fc
fix(signals): attribute the activity read to the product
andrewm4894 4661ea0
test(signals): avoid shadowing the Django settings helper
andrewm4894 c56c518
chore(visual): update storybook baselines
andrewm4894 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
25 changes: 25 additions & 0 deletions
25
products/signals/backend/migrations/0152_alter_signalscoutsuggestionset_status.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [("signals", "0151_scout_config_retired_pause_reason")] | ||
|
|
||
| operations = [ | ||
| # Choices only: `status` stays a CharField of the same length, so this emits no SQL. | ||
| migrations.AlterField( | ||
| model_name="signalscoutsuggestionset", | ||
| name="status", | ||
| field=models.CharField( | ||
| choices=[ | ||
| ("fresh", "Fresh"), | ||
| ("stale", "Stale"), | ||
| ("failed", "Failed"), | ||
| ("empty", "Empty"), | ||
| ("low_activity", "Low activity"), | ||
| ], | ||
| db_default="empty", | ||
| default="empty", | ||
| max_length=16, | ||
| ), | ||
| ), | ||
| ] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 0151_scout_config_retired_pause_reason | ||
| 0152_alter_signalscoutsuggestionset_status |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the desktop suggestion status contract
Issue description
The API can now return
low_activity, butproducts/desktop/packages/api-client/src/posthog-client.tsstill definesScoutSuggestionSet.statusas"fresh" | "stale" | "failed" | "empty".scoutGetcasts the response without validation, so TypeScript treats a valid server response as impossible. This can cause incorrect exhaustive handling in desktop consumers.Why we think it's a valid issue
low_activityis absent from_EXPIRING_STATUSESatproducts/signals/backend/scout_harness/suggestions.py:936, soeffective_statusreturns it unchanged atproducts/signals/backend/scout_harness/suggestions.py:944-948, and the serializer atproducts/signals/backend/scout_suggestions_api.py:129puts it on the wire. The premise holds: the handwritten union atproducts/desktop/packages/api-client/src/posthog-client.ts:685still lists only four values, andscoutGetcasts the body without validation atproducts/desktop/packages/api-client/src/posthog-client.ts:2486.EMPTY_SETdefault atproducts/desktop/packages/ui/src/features/scouts/hooks/useScoutSuggestions.ts:16, which sets"empty"and stays valid.ScoutsFleetView.tsx:186readssuggestions?.itemsonly. So there is no exhaustiveswitchto break today, and the desktop typecheck passes either way.products/signals/frontend/generated/api.schemas.ts:5711andservices/mcp/src/api/generated.ts:87362— and the main frontend handles the value atproducts/signals/frontend/inbox/components/config/scouts/ScoutSuggestionsStrip.tsx:129. The desktop mirror is the one copy left behind.statusgets a union that excludes a value the server sends. The fix is one union member plus the comment.consider. The drift is real and one line to correct, but I confirmed zero affected consumers, so it does not meet theshould_fixbar of a broken caller or a changed invariant other code relies on.Suggested fix
Add
"low_activity"to the desktopScoutSuggestionSet.statusunion and update its comment. Then run the desktop typecheck.Prompt to fix with AI (copy-paste)