chore(sig): Add ingest_report_json command#54553
Merged
Conversation
Contributor
|
Size Change: 0 B Total Size: 130 MB ℹ️ View Unchanged
|
0a9e73c to
61865e3
Compare
Adds a local-dev management command and matching report_generation fixture for a single-signal, immediately_actionable P1 report (the insightSceneLogic mode property bug). Running `ingest_report_json` creates a SignalReport, persists the research-output artefacts, triggers the autostart path, then marks the report ready — so we can test SignalAutonomyConfig autostart without running the sandbox research flow. https://claude.ai/code/session_01NU9xDngbonwWhkA8n44Wmi
The autonomy config was split into SignalTeamConfig (default threshold) and SignalUserAutonomyConfig (per-user opt-in) on the base branch. The previous SignalAutonomyConfig + opted_in_user_ids API no longer exists, which broke the type checker. Update the warning to look up SignalUserAutonomyConfig via the user's organization memberships, and drop the obsolete pointer to `enable_signals_autonomy` from the docs. https://claude.ai/code/session_01NU9xDngbonwWhkA8n44Wmi
Two issues uncovered by running ingest_report_json locally end-to-end:
- _maybe_autostart_task_for_report accessed `task.latest_run` (sync
property touching the DB) from an async context, raising
SynchronousOnlyOperation. The Task + TaskRun were still created (the
preceding call uses database_sync_to_async), but the bookkeeping
`SignalReportTask(relationship=implementation)` row never got written,
so every re-run duplicated the autostart Task. Switch to
`task.runs.order_by("-created_at").afirst()`.
- The renamed-autonomy-model warning in ingest_report_json used
`user__organization_memberships__...` through SignalUserAutonomyConfig's
OneToOneField, which Django rejects with FieldError. Scope via
OrganizationMembership first, then filter autonomy configs by user_id.
Verified end-to-end on team 4: report → artefacts → Task → TaskRun →
SignalReportTask(implementation) all in place.
b2a6951 to
5d2e292
Compare
Contributor
|
Reviews (1): Last reviewed commit: "fix(signals): make autostart write its S..." | Re-trigger Greptile |
oliverb123
approved these changes
Apr 17, 2026
Twixes
added a commit
to PostHog/code
that referenced
this pull request
Apr 17, 2026
## Changes Companion to PostHog/posthog#54553 for task origin handling.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Testing the Signal autostart path end-to-end requires running the full agentic research flow in the sandbox – slow, complex, costly, finicky. We need a faster way to seed
SignalReportrecords for local testing.Changes
Adding a new Django management command
ingest_report_jsonthat:ReportResearchOutputschemaSignalReportand transitions it throughPOTENTIAL→CANDIDATE→IN_PROGRESS_persist_agentic_report_artefacts, which triggers the autostart logicREADYstatus with title and summary from the fixtureAlso: sample input
backups_succesful_typo.jsonwith the expected JSON shape.How did you test this code?
Two steps:
python manage.py enable_signals_autonomy 1 P2 user@example.compython manage.py ingest_report_json products/signals/backend/report_generation/fixtures/backups_succesful_typo.json --team-id 1Publish to changelog?
No.