Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5.6 KiB
MP-23 — full media_pipeline code review + affected-files audit (spawned 2026-10-01, main session 771b2744)
You are a bounded background agent for media_pipeline (tracking row personal_projects #61). Budget: --max-turns 60. READ-ONLY REVIEW. If you issue the same tool call twice with identical arguments, STOP and emit the wrap-up with status=partially_succeeded.
WHY (owner directive 2026-10-01): MP-22 found that a 09-25 feature (MP-20b output_is_complete) shared a buggy helper (ffprobe_duration used format=duration, inflated by long subtitle tracks) with MP-10's S2 check. The symptom was seen on 09-25 but nobody checked the helper's other callers. The owner wants: (1) a review of the WHOLE project for existing bugs, (2) for every real bug, a check of already-processed files that it may have affected, listed as re-transcode candidates. Nothing gets fixed in this run — findings are discussed with the owner first.
HARD RULES
- NO edits to any code, compose, config or DB. NO container start/stop/restart/exec-mutating. NO git. NO sudo
(if you think you need it: stop with a final message headed
⏸ OWNER-COMMAND-REQUEST— host, command, why, paste_back, resume_at). - Prod DB read-only: PG=$(docker ps --format '{{.Names}}' | grep '^postgres-'); docker exec "$PG" psql -U postgres -d media_pipeline -c "" (one statement per -c). Never guess columns: \d first.
- Media files: read-only. There is no ffprobe on the host; use a throwaway container: docker run --rm -i -v /media/mediashare:/media/mediashare:ro --entrypoint sh gitea.local/backtalk6858/media-transcoder:latest -c '<ffprobe ...>' (sh, not bash). Keep probes bounded (sample, don't scan the whole library; max ~200 files per check).
- Mask secrets; never print env/.env contents (
docker exec <c> envis blocked by a hook — don't). - Write ONLY: your report file (below) and the context.md append. Scratch files in /tmp/claude-1000/-opt-appdata-docker-Machines-infrastructure-general-questions/771b2744-c468-4a6d-a4dc-a3886d0444b9/scratchpad/mp23/
- /opt/appdata/docker/docker-compose/media-transcoder/media-transcoder.py (live sha eca0129a…, ~5100 lines; highest priority)
- /opt/appdata/docker/docker-compose/media-downloader-local/ (main .py)
- media-api: find the live source (container media-api-nx9l470hzo695m2eg0d47jmy;
docker inspectmounts/image to locate it; the sandbox twin is /opt/appdata/docker/docker-compose/server-01/media-pipeline-sandbox/media-api.py) - filebot monitor (file-monitor.py; locate the live copy the same way)
- Design context (read, don't re-litigate): /opt/appdata/docker/docker-compose/media-transcoder/design/*.md and the media_pipeline section of /home/administrator/.claude/projects/-opt-appdata-docker/memory/playbook_media_pipeline_phases.md (fix inventory table + "Promotion lesson" notes). Known/open items there are NOT new findings — reference them.
- Shared-helper sweep FIRST (the failure class that bit us): list every helper used by 2+ features (ffprobe wrappers, duration/offset/stream-index helpers, path/category helpers, DB writers, state/resume helpers). For each, list callers and check each caller's assumption against what the helper actually returns.
- Then a full read for: wrong-stream/wrong-index selection, unit mix-ups (s vs ms, samples), off-by-one in segment/part logic, exceptions swallowed into "success", status written before the work is verified, races between workers / the requeue peek / FileBot moves, path edge cases (spaces, quotes, brackets, unicode), resume state reused across code versions, DB writes that can leave inconsistent rows, deletion/cleanup that can remove a source or output early, timeouts that mark a job done.
- Every candidate bug must be CONFIRMED with evidence: exact file:line, the input that triggers it, and the
wrong outcome. Prefer proving it with prod DB rows / logs (
docker logs media-transcoder-media_transcoder-1read-only) or a probe of a real file. Unconfirmed suspicions go in a separate "suspected" list. - Affected-files audit per CONFIRMED bug: query transcode_jobs (and rename_jobs to find where outputs went) for jobs that could have hit it since the buggy code went live (use git log on /opt/appdata/docker/docker-compose/media-transcoder/media-transcoder.py — read-only — for go-live dates), then verify a bounded sample (or all, if ≤ 50) with ffprobe. Produce the list of affected job ids + library paths as re-transcode CANDIDATES (do not queue anything).
SCOPE (live code; record each file's sha256 at start)
METHOD
OUTPUT: /opt/appdata/docker/docker-compose/media-transcoder/design/REVIEW_2026-10-01_full_code_review.md with: summary table (id, severity critical/high/medium/low, file:line, one-line bug, confirmed?, affected jobs count); per finding: trigger, evidence, impact, suggested fix (one paragraph, NOT applied), affected-files list; "suspected" list; testing-methodology gaps you observed (fixture coverage, shared-helper cross-check); files reviewed with sha256. Append a dated "## MP-23 — 2026-10-01 (background agent)" block to /opt/appdata/docker/docker-compose/media-downloader-local/.claude/context.md (what/decisions/state/next). Run: python3 /opt/appdata/docker/.claude/scripts/embed_memory_dir.py --only-recent 5
FINAL message = wrap-up JSON only: status, project "media_pipeline", report_path, files_reviewed[] (path,sha256), findings[] (id, severity, file_line, summary, confirmed, affected_job_ids[]), suspected[], retranscode_candidates[] (job_id, library_path, bug_id), methodology_gaps[], actions_taken[], actions_failed[], unverified_claims[], next_step, notes.