Skip to content

Superseded by #9 — workload contract - #7

Closed
aryan5v wants to merge 2 commits into
mainfrom
universal-ws1-workload-contract
Closed

Superseded by #9 — workload contract#7
aryan5v wants to merge 2 commits into
mainfrom
universal-ws1-workload-contract

Conversation

@aryan5v

@aryan5v aryan5v commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Superseded by #9, which contains this workstream plus the reviewed fixes, profiler ingestion, parity enforcement, FX capture, and impact ranking.

Introduce the shared generation workload schema that MotionKernel and FastVideo
use for baseline measurement, profiling, and end-to-end validation. Ship Wan
and LTX manifests, result classification, a resume-friendly launcher bridge,
and CPU tests. GPU execution depends on the paired FastVideo generation
launcher.
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@aryan5v, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3409f942-eff9-42c6-8e84-69b3d83b1068

📥 Commits

Reviewing files that changed from the base of the PR and between fc8b4a1 and 634d38c.

📒 Files selected for processing (5)
  • autokernel/workload/_validate.py
  • autokernel/workload/launcher.py
  • autokernel/workload/result.py
  • docs/FASTVIDEO_UNIVERSAL_OPTIMIZATION_AGENT_PLAN.md
  • tests/test_workload.py
📝 Walkthrough

Walkthrough

Added validated workload and generation-result schemas, FastVideo native/optimized launcher orchestration, resumable state handling, comparison classification, CLI commands, canonical LTX and Wan manifests, tests, and optimization workflow documentation.

Changes

Workload execution foundation

Layer / File(s) Summary
Workload manifest contract
autokernel/workload/types.py, autokernel/workload/__init__.py, workloads/*.yaml, pyproject.toml, tests/test_workload.py
Defines validated workload specifications, YAML/JSON serialization, prompt and generator argument construction, canonical manifests, and public package exports.
Generation result contract
autokernel/workload/result.py, tests/test_workload.py
Defines versioned result validation, atomic persistence, and native-versus-optimized classification.
FastVideo launcher orchestration
autokernel/workload/launcher.py, tests/test_workload.py
Resolves launcher scripts, runs native and optimized modes, propagates environment settings, persists resumable state, loads results, and stores comparisons.
CLI surface and workflow plan
workload.py, tests/test_workload.py, docs/FASTVIDEO_UNIVERSAL_OPTIMIZATION_AGENT_PLAN.md
Adds workload validation, display, result validation, and A/B execution commands. Documents the planned optimization workflow and Workstream 1 progress.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant workload.py
  participant run_ab
  participant FastVideo
  participant ResultStore
  Operator->>workload.py: run-ab workload
  workload.py->>run_ab: invoke native and optimized modes
  run_ab->>FastVideo: execute launcher command
  FastVideo-->>run_ab: write generation result
  run_ab->>ResultStore: load and classify results
  ResultStore-->>workload.py: comparison JSON
  workload.py-->>Operator: print structured run result
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a versioned FastVideo workload contract for Workstream 1.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch universal-ws1-workload-contract

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (2)
tests/test_workload.py (1)

76-80: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Suppress the S105 false positive.

Ruff reports S105 for the literal on line 78. The literal is a rejection fixture, not a credential. Add a suppression so lint stays clean.

🧹 Proposed suppression
-    payload["runtime"]["password"] = "nope"
+    payload["runtime"]["password"] = "nope"  # noqa: S105 - rejection fixture
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/test_workload.py` around lines 76 - 80, Add a narrowly scoped Ruff S105
suppression to the `"nope"` rejection-fixture assignment in
`test_rejects_secret_fields`, preserving the test’s behavior while preventing
this intentional non-credential literal from triggering lint.

Source: Linters/SAST tools

autokernel/workload/launcher.py (1)

261-263: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Write comparison.json atomically.

The state file and the result files use a .tmp file plus replace. This write does not. An interrupted write leaves a partial comparison.json, and the resume branch on line 268 then fails to parse it. Reuse the same atomic pattern.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@autokernel/workload/launcher.py` around lines 261 - 263, Update the
comparison.json write in the launcher flow to use the same
temporary-file-and-replace pattern as the state and result file writes. Write
the serialized comparison data to a .tmp file with the existing encoding, then
atomically replace comparison_path so interrupted writes cannot leave a partial
file for the resume branch.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@autokernel/workload/launcher.py`:
- Around line 52-59: Update _read_state to catch JSON parsing failures and
validate that the decoded value is an object with the expected schema_version
and required state fields before returning it. For missing, malformed,
foreign-schema, or incorrectly shaped state files, raise WorkloadError so
run_ab’s existing error handling reports the failure without a traceback.
- Around line 203-211: Validate every entry in modes against the accepted STAGES
set before entering the launcher loop, raising WorkloadError for any unknown
mode. Update the mode-dependent result-path and comparison logic around the loop
and comparison block so only validated stage names are processed and invalid
values cannot produce an unexplained null comparison.
- Line 194: Update run_ab so each run_mode invocation passes the selected mode’s
environment via manifest.mode_env.for_mode(mode), using the mode being launched
for both comparison paths. Ensure the env argument reaches each launcher
subprocess so Manifest.mode_env settings differentiate native and optimized
runs.

In `@autokernel/workload/result.py`:
- Line 15: Move the shared validators, including _finite_number, _mapping,
_text, _optional_text, _non_negative_int, and _positive_int, into a common
internal validation module and import them from both types and result. Update
the validator API to accept the caller-specific message prefix, then pass the
appropriate prefix from result so generation-result errors identify the correct
source instead of using workload-specific text. Remove the duplicated validator
implementations from result while preserving existing validation behavior.
- Around line 302-312: Update the validation guard before the speedup
calculation in the result-classification flow to reject
optimized.median_wall_seconds values less than or equal to zero, alongside the
existing native check. Preserve the "failed" classification and "missing median
wall times" reason, and ensure speedup is only computed with a positive
optimized divisor.
- Around line 69-88: Update _number_list so None entries are not removed from
wall_seconds: either reject them through validation or preserve their positions
with the appropriate nullable result type. Ensure wall_seconds remains
index-aligned with generation_seconds and peak_memory_mb, while retaining
existing finite-number validation for non-None samples.

In `@docs/FASTVIDEO_UNIVERSAL_OPTIMIZATION_AGENT_PLAN.md`:
- Around line 17-24: Replace the developer-specific absolute paths in the
referenced documentation with repository-relative paths where applicable, or
placeholders such as <motionkernel-checkout> and <fastvideo-checkout> for
external checkout locations. Preserve the existing references to the
optimization guide, Wan measurement script, and results document without
exposing local usernames.

---

Nitpick comments:
In `@autokernel/workload/launcher.py`:
- Around line 261-263: Update the comparison.json write in the launcher flow to
use the same temporary-file-and-replace pattern as the state and result file
writes. Write the serialized comparison data to a .tmp file with the existing
encoding, then atomically replace comparison_path so interrupted writes cannot
leave a partial file for the resume branch.

In `@tests/test_workload.py`:
- Around line 76-80: Add a narrowly scoped Ruff S105 suppression to the `"nope"`
rejection-fixture assignment in `test_rejects_secret_fields`, preserving the
test’s behavior while preventing this intentional non-credential literal from
triggering lint.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 281540fe-893d-4f9e-9ad5-1d41597897f5

📥 Commits

Reviewing files that changed from the base of the PR and between 5af8841 and fc8b4a1.

📒 Files selected for processing (10)
  • autokernel/workload/__init__.py
  • autokernel/workload/launcher.py
  • autokernel/workload/result.py
  • autokernel/workload/types.py
  • docs/FASTVIDEO_UNIVERSAL_OPTIMIZATION_AGENT_PLAN.md
  • pyproject.toml
  • tests/test_workload.py
  • workload.py
  • workloads/ltx_480p.yaml
  • workloads/wan_t2v_1.3b_480p.yaml

Comment thread autokernel/workload/launcher.py Outdated
Comment thread autokernel/workload/launcher.py
Comment thread autokernel/workload/launcher.py
Comment thread autokernel/workload/result.py Outdated
Comment thread autokernel/workload/result.py
Comment thread autokernel/workload/result.py
Comment thread docs/FASTVIDEO_UNIVERSAL_OPTIMIZATION_AGENT_PLAN.md Outdated
Validate launcher resume state JSON, pass mode_env into child processes,
reject unknown A/B modes, guard zero optimized medians, reject null
wall_seconds, share validators via _validate, and drop machine-local paths
from the plan doc.
@aryan5v

aryan5v commented Jul 31, 2026

Copy link
Copy Markdown
Owner Author

Addressed CodeRabbit findings in 634d38c:

  • Validate corrupt/malformed launcher_state.jsonWorkloadError
  • Pass manifest.mode_env.for_mode(mode) into each run_mode subprocess
  • Reject modes outside native/optimized
  • Shared validators in autokernel/workload/_validate.py
  • Reject None in wall_seconds; guard zero optimized median in e2e classify
  • Replaced machine-local absolute paths in the plan doc with placeholders

Left unmerged until review is fully clean.

@aryan5v aryan5v changed the title Add versioned FastVideo workload contract (WS1) Superseded by #9 — workload contract Jul 31, 2026
@aryan5v aryan5v closed this Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant