Manual fetch paths don't run AI classification #96

Closed
opened 2026-08-14 08:05:34 +00:00 by agent-pi · 1 comment
Collaborator

New posts are saved from three places — scheduler._fetch_stream_job, the manual POST /api/v1/hashtags/{id}/fetch endpoint, and the review page's liveview _fetch_all_active_streams (refresh) — but only the scheduler runs _classify_fetched_posts. The other two fetch + save posts without classifying them, so AI verdicts (ai_would_reject badge, AI auto-reject) only populate on scheduler-driven fetches.

Clicking "Fetch All Active Streams" (which loops POST /hashtags/{id}/fetch) therefore does not invoke any AI processing.

New posts are saved from three places — `scheduler._fetch_stream_job`, the manual `POST /api/v1/hashtags/{id}/fetch` endpoint, and the review page's liveview `_fetch_all_active_streams` (refresh) — but only the scheduler runs `_classify_fetched_posts`. The other two fetch + save posts without classifying them, so AI verdicts (`ai_would_reject` badge, AI auto-reject) only populate on scheduler-driven fetches. Clicking "Fetch All Active Streams" (which loops `POST /hashtags/{id}/fetch`) therefore does not invoke any AI processing.
Author
Collaborator

Findings: save_fetched_posts is called from three places — scheduler._fetch_stream_job, the manual fetch_hashtag_stream (POST /hashtags/{id}/fetch), and the review page's liveview _fetch_all_active_streams. Only the scheduler runs classification.

Plan:

  1. Extract the classification loop (+ _first_alt_text) out of scheduler._classify_fetched_posts into a shared classify_posts(posts) in a new services/ai_pipeline.py.
  2. Call classify_posts + reject_ai_flagged_posts from all three fetch spots, so manual fetches (and "Fetch All") classify and honour AI auto-reject too.
  3. TDD: unit test for classify_posts, plus an API-fetch test asserting classification runs on POST /hashtags/{id}/fetch.

Branch: feat/issue-96-classify-manual-fetch, PR into feat/issue-80-collect with Refs #96.

Findings: `save_fetched_posts` is called from three places — `scheduler._fetch_stream_job`, the manual `fetch_hashtag_stream` (`POST /hashtags/{id}/fetch`), and the review page's liveview `_fetch_all_active_streams`. Only the scheduler runs classification. Plan: 1. Extract the classification loop (+ `_first_alt_text`) out of `scheduler._classify_fetched_posts` into a shared `classify_posts(posts)` in a new `services/ai_pipeline.py`. 2. Call `classify_posts` + `reject_ai_flagged_posts` from all three fetch spots, so manual fetches (and "Fetch All") classify and honour AI auto-reject too. 3. TDD: unit test for `classify_posts`, plus an API-fetch test asserting classification runs on `POST /hashtags/{id}/fetch`. Branch: `feat/issue-96-classify-manual-fetch`, PR into `feat/issue-80-collect` with `Refs #96`.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marvin8/dujiangyan#96
No description provided.