M6: Rewire job handler + remove old services and tools#8167
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
| reduce: { execute: (assetId, onProgress) => reduceForAsset(assetId, { | ||
| systemPrompt: 'Summarize the video content based on the structured observations.', | ||
| }, onProgress) }, |
There was a problem hiding this comment.
🔴 Missing required query field in reduce stage causes "User query: undefined" to be sent to Claude
The reduce handler in the job handler calls reduceForAsset(assetId, { systemPrompt: '...' }, onProgress) but omits the required query field from ReduceOptions. At runtime, options.query is undefined, which gets interpolated into the Claude prompt at reduce.ts:132 as "User query: undefined".
Root Cause and Impact
The ReduceOptions interface at assistant/src/config/bundled-skills/media-processing/services/reduce.ts:29-36 defines query: string as a required field:
export interface ReduceOptions {
query: string;
systemPrompt?: string;
model?: string;
}But the job handler at line 44-46 only provides systemPrompt:
reduce: { execute: (assetId, onProgress) => reduceForAsset(assetId, {
systemPrompt: 'Summarize the video content based on the structured observations.',
}, onProgress) },In sendToClaude (reduce.ts:132), the query is interpolated directly:
const userContent = `Here is the video analysis data:\n\n${mapText}\n\n---\n\nUser query: ${query}`;This results in "User query: undefined" being sent to Claude, which degrades the quality of the reduce step output. The fix should either make query optional in ReduceOptions (with a sensible default for one-shot merge mode), or provide a meaningful query string like 'Summarize the video content.' in the job handler.
Impact: Every automated media processing job's reduce stage sends a malformed prompt to Claude, producing suboptimal or confusing results.
| reduce: { execute: (assetId, onProgress) => reduceForAsset(assetId, { | |
| systemPrompt: 'Summarize the video content based on the structured observations.', | |
| }, onProgress) }, | |
| reduce: { execute: (assetId, onProgress) => reduceForAsset(assetId, { | |
| query: 'Summarize the video content. Identify key events, subjects, and notable moments with timestamps.', | |
| systemPrompt: 'Summarize the video content based on the structured observations.', | |
| }, onProgress) }, |
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 640c206c4e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| reduce: { execute: (assetId, onProgress) => reduceForAsset(assetId, { | ||
| systemPrompt: 'Summarize the video content based on the structured observations.', | ||
| }, onProgress) }, |
There was a problem hiding this comment.
Pass an explicit reduce query in media processing jobs
The new reduce stage invokes reduceForAsset without a query, so every background media_processing job (e.g. enqueued by ingest_media) sends a prompt with User query: undefined to the reduce service; this makes the final stage output unreliable and can silently produce low-quality summaries even when the pipeline is marked successful. Provide a concrete query string (or update reduce options to default one) when calling reduceForAsset.
Useful? React with 👍 / 👎.
Part of #8012. Rewires media-processing job handler to use preprocess/map/reduce phases. Removes 10 obsolete files: timeline-service, event-detection-service, retrieval-service, capability-registry, feedback-store, feedback-aggregation, detect-events, submit-feedback, recalibrate, select-tracking-profile.