spec: Astra round 1 findings on video conversion, unedited
Five P1, five P2; verdict revise.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/specs/CODEX-FINDINGS-VIDEO.md+81 −0
CI cancelled — superseded by a newer push — run details
Intent
<task-notification> <task-id>b0emuhdux</task-id> <tool-use-id>toolu_01FJ1VnGW4xnwGCt1RsHDynB</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/8509ad95-d983-414c-9679-b3ef222618ef/tasks/b0emuhdux.output</output-file> <status>completed</status> <summary>Background command "Run Astra round 1 review of the video design" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 15.6 g CO₂e (1,715,152 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-video-conversion, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-VIDEO.md b/docs/superpowers/specs/CODEX-FINDINGS-VIDEO.md| new file mode 100644 |
| index 000000000..85cf94d39 |
| --- /dev/null |
| +++ b/docs/superpowers/specs/CODEX-FINDINGS-VIDEO.md |
| @@ -0,0 +1,81 @@ |
| +Reviewed revision 1 at `b2241759` against the cited code and predecessor specs. This is round 1 of the three-round budget. No files were modified. |
| + |
| +1. **P1 — §§5.3, 5.8: engine job IDs do not distinguish tenants or attempts.** |
| + **Invariant: engine operations affect exactly one tenant’s execution.** |
| + |
| + The [ID formula](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:241) includes only key, ETag and preset. The shared engine’s [submission, polling and cancellation protocol](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:391) identifies work only by that ID. Two apps uploading identical bytes under the same key therefore address the same engine job. Retries also reuse that identity. The protocol cannot distinguish their status, cancellation or completion, particularly with multiple slots. |
| + |
| + **Fix:** Keep the app-scoped idempotency ID, but dispatch with a separate execution ID bound to account, app/store incarnation and attempt. Polls, cancellations and responses must identify that execution. |
| + |
| +2. **P1 — §§5.2, 5.6–5.7: expiry and a five-minute delay do not protect committed outputs.** |
| + **Invariant: an obsolete attempt cannot change or remove a later result.** |
| + |
| + Every attempt writes the same [output keys](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:190). The [late-write rule](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:368) assumes an upload started before expiry finishes within five minutes, but establishes no such storage-side bound. A delayed PUT can overwrite a successor’s output after its marker was written. Old-attempt cleanup can likewise delete the successor’s files. Cancellation leaves issued URLs usable; checking that a record exists does not establish that it is still running. |
| + |
| + AWS checks URL expiry when the request starts; expiry is not an in-flight completion fence. [https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html) |
| + |
| + **Fix:** Use immutable, attempt-specific output keys and serialize the console’s commit against cancellation and lease replacement. Define cancellation completion and abandoned-output cleanup explicitly. This needs a job publication check even without platform serving; it does not require building stage 1. |
| + |
| +3. **P1 — §6: the helper-to-uploader filesystem boundary is incomplete.** |
| + **Invariant: compromised codec code cannot cause another file to be uploaded.** |
| + |
| + The [sandbox](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:510) makes the host filesystem read-only, which does not restrict reads to the claimed single source. More directly, a compromised helper can replace an expected output with a symlink. The agent then uploads from scratch, and the console [checks only reported sizes](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:333). No rule prevents the uploader following that link to a host file, including one readable only by the agent. |
| + |
| + Read-only paths remain readable under systemd’s documented semantics. [https://www.freedesktop.org/software/systemd/man/258/systemd.exec.html](https://www.freedesktop.org/software/systemd/man/258/systemd.exec.html) |
| + |
| + **Fix:** Require a minimal filesystem view containing runtime dependencies and this attempt’s input/output only. After terminating all helper processes, open outputs relative to a trusted directory descriptor, reject links and special files, and upload only bounded regular files proven to belong to that attempt. |
| + |
| +4. **P1 — §6: scratch space has no aggregate bound.** |
| + **Invariant: one hostile job cannot exhaust the engine’s disk.** |
| + |
| + [The resource limits](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:516) include `LimitFSIZE=256M`, but that limits individual files. A compromised helper can create many files below that limit, or exhaust inodes. Memory and process limits do not prevent this; cleanup after completion happens too late to protect the box. |
| + |
| + The underlying limit is explicitly per file. [https://man7.org/linux/man-pages/man2/getrlimit.2.html](https://man7.org/linux/man-pages/man2/getrlimit.2.html) |
| + |
| + **Fix:** Require a per-attempt filesystem quota covering bytes and inodes, plus engine-wide reserved headroom and admission checks. Include agent downloads and crash leftovers in that budget. Prove containment with many-file exhaustion, not only a large output. |
| + |
| +5. **P1 — §§5.5, 5.7: copied session policies can bypass newly enabled enforcement.** |
| + **Invariant: conversion cannot read an infected object after the store user is denied.** |
| + |
| + The [session policy](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:296) copies `Enforce` when credentials are minted. If enforcement is off then, an operator can subsequently enable it and complete the [store-user policy rewrite](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/internal/console/apiscan.go:632). The existing conversion session still lacks the infected-object Deny and can begin its GET afterward. The stated matching behavior therefore fails even before download. |
| + |
| + **Fix:** Prefer the already-described stricter option: always deny known-infected sources for conversion. Otherwise define an enforcement transition that retires outstanding conversion authority before reporting completion. Also state the corresponding transition behavior for `writes_denied`, which is copied into sessions too. |
| + |
| +6. **P2 — §§5.3, 7.2–7.3: failed and cancelled work can consume unlimited encoding time.** |
| + **Invariant: finite account allowances bound costly execution.** |
| + |
| + [Failures and cancellations count nothing](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:573), while [cancelled jobs can be resubmitted and terminal records deleted](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:249). An account can repeatedly cancel near the fifteen-minute deadline or submit expensive failures without approaching its monthly cap. Queue depth and submission rate bound outstanding work, not cumulative CPU consumption. |
| + |
| + **Fix:** Keep successful-media minutes as the product allowance, but add a finite account execution budget covering failed and cancelled attempts. Reserve capacity at dispatch and release unused capacity afterward. |
| + |
| +7. **P2 — §§5.3–5.4: a crash between record and marker creation can strand a job permanently.** |
| + **Invariant: durable queued work is eventually discovered without client intervention.** |
| + |
| + The door [writes the record before the queue marker](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:264). A crash between those writes leaves a `queued` record without a marker. Repeating POST returns that existing record: the [requeue exceptions](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:244) exclude `queued`. Copying the scan queue’s boot rebuild does not repair this, because that [rebuild lists queue items](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/internal/objstore/queue.go:231), not a separate job collection. |
| + |
| + **Fix:** Make nonterminal job records authoritative for recovery. Require boot and periodic reconciliation to recreate missing markers, or use a single durable object for both purposes. Repeated POST must repair this state too. |
| + |
| +8. **P2 — §§5.6, 7.4: completion and metering lack a recoverable accounting contract.** |
| + **Invariant: each completed execution is counted exactly once.** |
| + |
| + [Completion writes the marker and then the job record](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:329), while [usage lives in a separate console table](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:580). No ordering or reconciliation rule connects them. A crash can lose a charge or duplicate it on recovery. “One row per job” also leaves successful re-encodes ambiguous: deleting outputs and requeuing preserves the job ID but performs new billable work. |
| + |
| + **Fix:** Define a durable completion event with a unique execution identity. Insert usage idempotently from that event and reconcile until recorded. Distinguish execution retries, cached-result lookups and explicitly requested re-encodes. |
| + |
| +9. **P2 — §§5.5, 5.8: the engine protocol omits required signed headers.** |
| + **Invariant: the downloaded object matches the source admitted by the console.** |
| + |
| + [Presigning requires a signed `If-Match` header](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:303), but the [dispatch body](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:391) supplies only ID, URLs, preset, limits and deadline. It carries neither the ETag nor signed-header values. A URL alone is insufficient to execute that request. |
| + |
| + **Fix:** Specify each transfer as method, URL and required headers. Forward the presigner’s signed headers exactly, including `If-Match`, and redact capability URLs from logs and errors. |
| + |
| +10. **P2 — §5.10: redirecting the playlist recreates the unsigned-segment failure.** |
| + **Invariant: every HLS child request retains a working authorization path.** |
| + |
| + The [serving recipe](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:473) permits both playlist and MP4 to redirect to presigned GETs. After redirecting the playlist, its relative `video.mp4` reference resolves against the final bucket URL, without the playlist’s signature. It no longer reaches the app’s authorized MP4 endpoint. |
| + |
| + The final retrieval URL supplies the base URI after redirects. [https://www.rfc-editor.org/rfc/rfc3986.html#section-5.1.3](https://www.rfc-editor.org/rfc/rfc3986.html#section-5.1.3) |
| + |
| + **Fix:** Require the app to proxy the playlist at its own origin, or rewrite its references to authorized absolute URLs. The MP4 may independently redirect. Include this exact serving arrangement in the playback gate. |
| + |
| +**Verdict: revise.** Five P1 findings require resolution before planning. |
| \ No newline at end of file |