carlos / platform Public

spec: Astra round 2 findings on video conversion, unedited

One P1 (slot reuse after agent restart), five P2; verdict revise. Stopping rule 2 applies to the lifecycle families; Paul ruled cut + one place.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev dd4191d89e775fbf33f39c771513caf29871455a parent a62693a
1 file changed, +65 −0
  • docs/superpowers/specs/CODEX-FINDINGS-VIDEO-R2.md +65 −0

CI cancelled — superseded by a newer push — run details

Intent

Human

Can the c7g box sleep on idle? This is probably not going to be used very much? Should we use a lambda or something instead for these processing jobs?

Human

Sounds good.

Human

<task-notification> <task-id>b1omtys5q</task-id> <tool-use-id>toolu_01DHKvJAvxmjKid9adeL1BLS</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/8509ad95-d983-414c-9679-b3ef222618ef/tasks/b1omtys5q.output</output-file> <status>completed</status> <summary>Background command "Run Astra round 2 review" completed (exit code 0)</summary> </task-notification>

Human

Yes go ahead.

Attributed to this commit: 3.74 g CO₂e (368,691 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-R2.md b/docs/superpowers/specs/CODEX-FINDINGS-VIDEO-R2.md
new file mode 100644
index 000000000..9a86af95d
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-FINDINGS-VIDEO-R2.md
@@ -0,0 +1,65 @@
+Reviewed revision 2 at `6751813a`, round **2 of 3**. The worktree’s design matches that commit. No files were modified.
+
+Round-one findings **1, 3, 4, 5, 9 and 10 are closed at design level**. Finding **2** closes stale-attempt overwrites and commit/cancel races, but cleanup remains incomplete. Findings **6, 7 and 8** remain partially open for the reasons below.
+
+1. **P1 — §§5.5, 6: agent restart does not establish that a scratch slot is safe to reuse.**
+ **Invariant: each slot belongs to one live execution, including across crashes.**
+
+ The [restart contract](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:316) forgets engine state and permits a retry. The agent then [recreates the slot filesystem before execution](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:449). However, helpers run as separate transient systemd units. Such services are managed by systemd independently of the launching process; killing the agent does not itself kill them. [https://www.freedesktop.org/software/systemd/man/latest/systemd-run.html](https://www.freedesktop.org/software/systemd/man/latest/systemd-run.html)
+
+ A replacement agent can therefore encounter an old helper still using the slot. Reformatting its backing filesystem is unsafe; allocating another filesystem instead can overlap executions and exceed the intended resource bounds. The requirement to wait for helper exit applies to collecting outputs, but does not cover startup recovery or slot recreation.
+
+ **Fix:** Require startup recovery to stop and reap every previous helper before admitting work or recreating a slot. Keep the slot unavailable until its helper cgroups are empty and old mounts are released. Add an agent-only crash drill while a helper is running; rebooting the whole box would conceal this failure.
+
+2. **P2 — §5.3: marker-first ordering still permits permanently stranded jobs.**
+ **Invariant: every durable nonterminal job remains discoverable. Round-one family: 7.**
+
+ The [specified sequence](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:225) allows this interleaving:
+
+ - The door writes the marker.
+ - The pass sees no record and deletes the marker.
+ - The door creates the queued record and returns 202.
+
+ The job now has no marker. Boot recovery lists markers, so it cannot discover this record. Requeue has the corresponding race: the pass can remove the marker while the old record is still terminal, before the door changes it to queued. Compare-and-swap on the job record does not serialize deletion of a separate marker.
+
+ **Fix:** Prefer one durable job object that also supplies queue discovery. Otherwise require reconciliation from nonterminal records and explicitly serialize marker removal against creation and requeue. Test these interleavings, not only crashes between writes.
+
+3. **P2 — §§5.2, 5.6, 7.4: terminal deletion can erase the only accounting event.**
+ **Invariant: an execution’s accounting evidence survives until its usage is recorded. Round-one family: 8.**
+
+ [Terminal DELETE removes the record immediately](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:213), while [usage is inserted later from that record](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:548).
+
+ A caller can cancel a running job, then DELETE the now-terminal record before the pass inserts its usage row. The marker subsequently has no record and is discarded. A completed job has the same window, and app purge removes both records and markers. The unique execution ID prevents duplicate inserts; it cannot recover an event that has been deleted. This also defeats the claim that deleting records cannot reset execution-budget consumption.
+
+ **Fix:** Retain accounting evidence independently of user-visible deletion and app purge. The smallest terminal-DELETE fix is to refuse removal until recording finishes; app purge additionally needs a durable account-level settlement record or a settlement prerequisite.
+
+4. **P2 — §§5.5, 7.2–7.4: cancellation becomes “ended” before engine consumption ends.**
+ **Invariant: the execution budget covers all engine time consumed. Round-one family: 6.**
+
+ [Cancellation immediately moves the execution into `attempts`](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:303), although stopping the engine is best effort and it may continue until its deadline. The [budget releases unused reservation](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:522), and recording inserts one immutable row per ended execution.
+
+ If cancellation arrives shortly after dispatch and its stop message is lost, the console cannot yet know the eventual wall time. Recording the cancellation-time duration and releasing the remainder undercounts work; no later settlement is specified. Missing engine jobs after restart have the same uncertainty.
+
+ **Fix:** Keep the reservation until termination is confirmed, or conservatively charge the full reserved duration when termination cannot be established. Persist outstanding reservations across console restart. Distinguish cancellation’s immediate publication fence from accounting settlement.
+
+5. **P2 — §§5.3, 5.5, 7.4: nothing keeps abandoned executions discoverable for their second cleanup.**
+ **Invariant: promised cleanup remains scheduled until it finishes. Round-one family: 2.**
+
+ [Abandoned outputs require another deletion after 24 hours](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:308), but [the marker may be deleted once the terminal execution is recorded](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:225). No separate cleanup discovery pass is specified.
+
+ An upload can finish after the immediate deletion but before the 24-hour deletion. Once the marker is gone, restarting the console discovers no outstanding cleanup, even if the job record still exists. This loses the promised second deletion, beyond the explicitly accepted possibility of writes arriving after 24 hours.
+
+ **Fix:** Retain the marker until accounting **and cleanup** are complete, with a persisted next-cleanup time. Prevent terminal DELETE from discarding that obligation, or move it to a separate durable cleanup record.
+
+6. **P2 — §§2, 5.2, 5.8, settlement B3: bucket-name equality does not establish that the platform minted the bucket.**
+ **Invariant: eligibility checks establish the storage properties on which conversion relies.**
+
+ The [admission check](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/docs/superpowers/specs/2026-11-16-video-conversion-design.md:178) uses the expected minted bucket name to implement the adopted-bucket exclusion. But [the current record explicitly does not distinguish minted from adopted buckets](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/internal/objstore/objstore.go:66), and [grant accepts an adopted name without excluding the expected minted name](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-video-conversion/internal/objstore/walk.go:245).
+
+ An existing bucket adopted under that name passes the proposed check. Its encryption and lifecycle properties remain unknown—the reason B3 excludes adopted buckets.
+
+ **Fix:** Record trustworthy provisioning provenance for new stores and define how existing stores qualify. Refuse unknown provenance until an explicit verification establishes eligibility; do not infer it from the bucket name.
+
+The queue-discovery, execution-budget and accounting invariants now have findings in two consecutive rounds. Stopping rule 2 applies before another patch in those families. I recommend its “enforce the invariant in one place” option, with one durable lifecycle authority and interleaving tests covering enqueue, cancel, deletion, settlement and recovery.
+
+**Verdict: revise.** One P1 requires resolution before planning.
\ No newline at end of file