Skip to content

Commit 257aae8

Browse files
committed
Fix Lucy Edit review items
2 parents 964892e + 2c13793 commit 257aae8

222 files changed

Lines changed: 23082 additions & 19560 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
date: 2026-05-22
3+
experiment: PR #1386 DreamVerse app CI backend tests
4+
category: infrastructure
5+
severity: important
6+
---
7+
8+
# DreamVerse App CI Streaming Imports Need GPU
9+
10+
## What Happened
11+
12+
DreamVerse app CI backend pytest collection imports FastVideo streaming surfaces.
13+
When those tests run in a CPU-only Modal environment, collection can fail before
14+
any app assertions run with Triton reporting:
15+
16+
```text
17+
RuntimeError: 0 active drivers
18+
```
19+
20+
## Root Cause
21+
22+
Some streaming import paths can import `fastvideo_kernel` at module import time.
23+
Triton then probes for an active GPU driver during pytest collection. A CPU-only
24+
Modal container has no active driver, so the failure appears as an import-time
25+
collection error rather than a DreamVerse app behavior failure.
26+
27+
## Fix / Workaround
28+
29+
For PR #1386, use a surgical CI fix: allocate a GPU to
30+
`run_dreamverse_app_tests`. Do not refactor core streaming/kernel imports just to
31+
unstick this app CI path.
32+
33+
Keep `build_kernel=False` for this job. The DreamVerse app backend test imports
34+
streaming surfaces but does not need to rebuild or exercise custom kernels.
35+
36+
## Prevention
37+
38+
When adding or modifying DreamVerse app CI jobs that import FastVideo streaming
39+
modules, make the GPU requirement explicit if the import graph may touch
40+
`fastvideo_kernel`. Prefer small CI resource fixes for app test collection issues
41+
unless the product code genuinely requires lazy import cleanup.

.agents/memory/codebase-map/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ FastVideo-WorldModel/
3131
│ │ │ └── distribution_matching/ # DMD2Method, SelfForcingMethod
3232
│ │ ├── models/ # Per-role model wrappers (ModelBase, CausalModelBase)
3333
│ │ │ ├── wan/ # WanModel, WanCausalModel
34-
│ │ │ └── matrixgame/ # MatrixGameModel, MatrixGameCausalModel
34+
│ │ │ └── matrixgame2/ # MatrixGame2Model, MatrixGame2CausalModel
3535
│ │ ├── callbacks/ # Composable hooks (grad_clip, ema, validation)
3636
│ │ └── utils/ # Config, builder, checkpoint, optimizer, tracking
3737
│ ├── training/ # Legacy training infrastructure (being phased out)
@@ -44,7 +44,7 @@ FastVideo-WorldModel/
4444
│ │ ├── wan_distillation_pipeline.py # Wan distillation
4545
│ │ ├── self_forcing_distillation_pipeline.py # Self-forcing distill
4646
│ │ ├── ltx2_training_pipeline.py # LTX-2 training
47-
│ │ └── matrixgame_training_pipeline.py # MatrixGame training
47+
│ │ └── matrixgame2_training_pipeline.py # Matrix-Game 2.0 training
4848
│ ├── attention/ # Attention backends
4949
│ ├── distributed/ # Sequence/tensor parallel utilities
5050
│ ├── layers/ # Tensor-parallel layers
@@ -95,7 +95,7 @@ FastVideo-WorldModel/
9595
| Wan distillation (DMD) | `fastvideo/training/wan_distillation_pipeline.py` | `torchrun --nproc_per_node N` |
9696
| Self-forcing distill | `fastvideo/training/wan_self_forcing_distillation_pipeline.py` | `torchrun --nproc_per_node N` |
9797
| LTX-2 finetune | `fastvideo/training/ltx2_training_pipeline.py` | `torchrun --nproc_per_node N` |
98-
| MatrixGame | `fastvideo/training/matrixgame_training_pipeline.py` | `torchrun --nproc_per_node N` |
98+
| Matrix-Game 2.0 | `fastvideo/training/matrixgame2_training_pipeline.py` | `torchrun --nproc_per_node N` |
9999

100100
## W&B Integration
101101

.agents/memory/dreamverse-integration/decisions-log.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ follow-up actions see [open-threads.md](open-threads.md).
88

99
**Last updated:** 2026-05-06 (added D-21 — chunk-stutter root cause is software libx264 encoding consuming ~22% of segment wall-time, NOT a migration regression; verified by 3 parallel explore agents that NVFP4 + torch.compile coverage matches FastVideo-internal exactly; landed opt-in NVENC build path in install_native_ffmpeg.sh + `--nvenc`/`--no-nvenc` flag in dreamverse-deploy.sh + `apps/dreamverse/server/benchmarks/benchmark_av_streaming.py` regression test + memory dir update; default codec stays `libx264` for backward compat, opt-in via `--nvenc`. Earlier: added D-12 — GpuPool layer separation, Oracle review post-#1257-merge; added D-13 — prompt enhancer / LLMProvider abstraction shape, Oracle review pre-#1258-merge; added D-14 — streaming auxiliaries cohesion, Oracle review during #1284 review cycle; added D-15 — streaming router placement + sticky/active-active deferral, Oracle review during #1286 review cycle; added D-16 — streaming router polish round 2, second-pass review on top of D-15 covering bridge cancellation hygiene, registry state machine, httpx hard-fail, replica YAML parsing, and `websockets` dep; added D-17 — strategy reversal: abandon 6-PR split in favor of single mega-PR #1288 on `will/ltx2_sr_port`; added D-18 — Option B+ chosen: Dreamverse FE+product-server move into FastVideo as `apps/dreamverse/` subfolder while generic backend stays at `fastvideo.entrypoints.streaming.*`; integration-review.md deprecated, integration-plan.md is the executable migration plan; added D-19 — D-18 executed: 5 commits land on `will/dreamverse-monorepo`, fix-up commits corrected the integration-plan's invalid "delete generic-merged, import public substitutes" assumption — generic-merged files carried product-local instead, e2e passes against migrated code with /proc-verified evidence; added D-20 — segment-2 BrokenPipe root cause was a TWO-direction silent drop of LTX-2 audio kwargs in public `VideoGenerator`).
1010

11+
**Update 2026-05:** Dreamverse frontend tooling migrated from standalone pnpm to standalone npm. `apps/dreamverse/web/package-lock.json` is authoritative; see PR #1385.
12+
1113
## Status legend
1214

1315
-**Resolved** — decision made and implementation complete (or no implementation needed)
@@ -297,14 +299,14 @@ Playwright (8/8 PASS in 5.1s):
297299
- **Python ML library** stays at root: `fastvideo/`, `fastvideo-kernel/`.
298300
- **Generic backend** stays at `fastvideo.entrypoints.streaming.*` (already there per #1257/#1258/#1284/#1286/#1288).
299301
- **Dreamverse product** moves into `apps/dreamverse/{server,web,prompts,serve_configs,scripts}/`.
300-
- **Tooling**: uv workspace for Python (`[tool.uv.workspace] members = ["apps/dreamverse/server"]`), standalone pnpm for the FE (no root `package.json`), split CI workflows with path-filter triggers.
302+
- **Tooling**: uv workspace for Python (`[tool.uv.workspace] members = ["apps/dreamverse/server"]`), standalone npm for the FE (no root `package.json`), split CI workflows with path-filter triggers.
301303

302304
**Rationale:**
303305

304306
- Drops the cross-repo coordination overhead identified in the post-#1286 rebase cycle (D-17 handled by consolidating into mega-PR; D-18 prevents the next round of cross-repo coordination from happening).
305307
- Keeps the architectural separation Option D recommended (FastVideo owns reusable runtime; product owns product). The boundary is now `apps/dreamverse/` directory rather than two repos.
306308
- Single repo means atomic cross-cutting refactors (e.g. GpuPool API change + Dreamverse adoption) ship as one PR.
307-
- OSS precedents support the shape (chainlit uv-workspace + pnpm; open-webui Python + Svelte with paths-ignore CI). The librarian explicitly noted no precedent for "Python ML library + Next.js product merged into library namespace" — but this isn't that pattern. Dreamverse goes into a sibling directory, NOT into `fastvideo.entrypoints.dreamverse.*`. Library namespace stays clean.
309+
- OSS precedents support the shape (chainlit uv-workspace + frontend package manager; open-webui Python + Svelte with paths-ignore CI). The librarian explicitly noted no precedent for "Python ML library + Next.js product merged into library namespace" — but this isn't that pattern. Dreamverse goes into a sibling directory, NOT into `fastvideo.entrypoints.dreamverse.*`. Library namespace stays clean.
308310

309311
**Why not Option D (separate repos):**
310312

.agents/memory/dreamverse-integration/integration-plan.md

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -311,22 +311,22 @@ Notes:
311311
development and CI.
312312
- Product server release is Docker/deploy workflow, not PyPI.
313313

314-
### Frontend build: standalone pnpm
314+
### Frontend build: standalone npm
315315

316316
Do not add a root `package.json`.
317317

318318
Keep all frontend tooling under:
319319

320320
```text
321321
apps/dreamverse/web/package.json
322-
apps/dreamverse/web/pnpm-lock.yaml
322+
apps/dreamverse/web/package-lock.json
323323
apps/dreamverse/web/playwright.config.*
324324
```
325325

326326
Rationale:
327327

328328
- FastVideo remains primarily a Python ML library.
329-
- Python contributors should not need Node or pnpm for normal work.
329+
- Python contributors should not need Node or npm for normal work.
330330
- This intentionally diverges from chainlit's root JS workspace pattern and
331331
follows the simpler open-webui-style split.
332332

@@ -455,31 +455,24 @@ jobs:
455455
steps:
456456
- uses: actions/checkout@v4
457457

458-
# IMPORTANT: pnpm/action-setup MUST run BEFORE setup-node when using
459-
# cache: pnpm — setup-node otherwise can't find pnpm to populate cache.
460-
- name: Setup pnpm
461-
uses: pnpm/action-setup@v4
462-
with:
463-
version: 9
464-
465458
- name: Setup Node
466459
uses: actions/setup-node@v4
467460
with:
468461
node-version: '22'
469-
cache: pnpm
470-
cache-dependency-path: apps/dreamverse/web/pnpm-lock.yaml
462+
cache: npm
463+
cache-dependency-path: apps/dreamverse/web/package-lock.json
471464

472465
- name: Install dependencies
473-
run: pnpm install --frozen-lockfile
466+
run: npm ci
474467

475468
- name: Typecheck
476-
run: pnpm run typecheck --if-present
469+
run: npm run typecheck --if-present
477470

478471
- name: Unit tests
479-
run: pnpm run test --if-present
472+
run: npm run test --if-present
480473

481474
- name: Build
482-
run: pnpm run build
475+
run: npm run build
483476

484477
# NOTE: Playwright tests require a running backend. Until Phase 4 lands
485478
# `/healthz`/`/readyz`/`/status`/`/prompt-system-config`/`/curated-presets`
@@ -489,13 +482,13 @@ jobs:
489482
# `fastvideo.entrypoints.streaming.build_app` and add product routes).
490483
#
491484
# - name: Install Playwright browsers
492-
# run: pnpm exec playwright install --with-deps chromium
485+
# run: npm exec -- playwright install --with-deps chromium
493486
#
494487
# - name: Playwright (re-enable in Phase 4)
495-
# run: pnpm exec playwright test
488+
# run: npm exec -- playwright test
496489
```
497490

498-
**Playwright config update needed** when moving FE: `Dreamverse/apps/web/playwright.config.ts` line 39 currently uses `npm run dev`; change to `pnpm run dev` post-move ([source](file:///home/william5lin/Dreamverse/apps/web/playwright.config.ts#L39)).
491+
**Playwright config update needed** when moving FE: keep `Dreamverse/apps/web/playwright.config.ts` line 39 on `npm run dev` after the move ([source](file:///home/william5lin/Dreamverse/apps/web/playwright.config.ts#L39)).
499492

500493
#### `.github/workflows/ci-dreamverse-backend.yml`
501494

@@ -604,7 +597,7 @@ monorepo CI path.
604597
| uv workspaces | https://docs.astral.sh/uv/concepts/workspaces/ | Authoritative Python workspace model. |
605598
| Hatch monorepo | https://hatch.pypa.io/latest/how-to/environment/workspace/ | Alternative workspace model; not selected. |
606599
| chainlit | https://github.com/Chainlit/chainlit | uv workspace precedent plus **per-language CI split** (separate `check-frontend.yaml` / `check-backend.yaml` workflows path-filtered by directory). Not a PR-level split — independent of D-17 single-mega-PR decision. |
607-
| open-webui | https://github.com/open-webui/open-webui | Frontend path filtering (`paths-ignore` on backend-only changes) and separate release tracks. **Note:** open-webui has a root `package.json`; we are choosing standalone-pnpm despite the precedent, to avoid forcing Python-only contributors to install Node. |
600+
| open-webui | https://github.com/open-webui/open-webui | Frontend path filtering (`paths-ignore` on backend-only changes) and separate release tracks. **Note:** open-webui has a root `package.json`; we are choosing standalone npm under `apps/dreamverse/web/` despite the precedent, to avoid forcing Python-only contributors to install Node. |
608601
| streamlit | https://github.com/streamlit/streamlit | Split Python and JS testing in one repo. |
609602
| gradio | https://github.com/gradio-app/gradio | Python package plus JS workspace precedent. |
610603
| full-stack-fastapi-template-nextjs | https://github.com/nemanjam/full-stack-fastapi-template-nextjs | Separate frontend/backend build and deploy workflows. |
@@ -623,8 +616,8 @@ class runs where, because not all tests can run on `ubuntu-latest` CI.
623616
| **Unit** | (none / `unit`) | `ci-dreamverse-backend.yml` (ubuntu-latest CI) + locally | Pure logic, no GPU, no live service. Mocked FastVideo backends, schema validation, helper functions. | `test_config.py`, `test_rewrite_prompt_payload.py`, `test_session_init_image.py`, the new `test_import_contract.py` |
624617
| **Integration (fakes)** | `integration` | `ci-dreamverse-backend.yml` + locally | FastAPI test client + in-process fakes/mocks for GPU pool. Validates routes, request/response shapes, session state machine. | `test_health_endpoints.py`, `test_mock_server.py`, `test_entrypoints.py`, `test_prompt_safety.py`, `test_batching.py` (deleted) |
625618
| **Live-service GPU** | `gpu` (skip-by-default in CI) | **Local GPU4 manual QA** + Buildkite-Modal (when added) | Real `fastvideo serve` process + real model weights + real WebSocket round-trips. Validates LTX-2 streaming, NVFP4 wiring, continuation state, frame emission. | `test_realtime_stress.py` (947 LOC), `test_session_logging.py` (1278 LOC) — these spin up real workers per their current shape |
626-
| **Frontend unit / build** | (n/a — pnpm) | `ci-dreamverse-frontend.yml` (ubuntu-latest, no GPU) | Vitest + tsc + Next.js build. No backend needed. | `apps/dreamverse/web/src/**/*.test.ts(x)` |
627-
| **Frontend Playwright E2E** | (n/a — pnpm) | **Local GPU4 manual QA** until Phase 4 lands public health routes; then `ci-dreamverse-frontend.yml` against a mock backend OR a deployed staging | Real browser → real backend WebSocket flow. Requires `/healthz`, `/readyz`, `/status`, `/prompt-system-config`, `/curated-presets`, `/v1/stream`. | `apps/dreamverse/web/e2e/{backend-health,frontend-shell,preset-prompt-generation}.spec.ts` |
619+
| **Frontend unit / build** | (n/a — npm) | `ci-dreamverse-frontend.yml` (ubuntu-latest, no GPU) | Vitest + tsc + Next.js build. No backend needed. | `apps/dreamverse/web/src/**/*.test.ts(x)` |
620+
| **Frontend Playwright E2E** | (n/a — npm) | **Local GPU4 manual QA** until Phase 4 lands public health routes; then `ci-dreamverse-frontend.yml` against a mock backend OR a deployed staging | Real browser → real backend WebSocket flow. Requires `/healthz`, `/readyz`, `/status`, `/prompt-system-config`, `/curated-presets`, `/v1/stream`. | `apps/dreamverse/web/e2e/{backend-health,frontend-shell,preset-prompt-generation}.spec.ts` |
628621
| **FastVideo public contract** | (none) | Existing FastVideo CI (`ci-precommit` + Buildkite for GPU) | Schema/shape guards that this migration must not break. | `fastvideo/tests/contract/test_dreamverse_shape.py`, `test_dynamo_shape.py`, `test_generate_async.py` |
629622
| **FastVideo SSIM regression** | (Buildkite path-filter) | Buildkite-Modal | Inference-quality gates for ported models. | `fastvideo/tests/ssim/test_*.py` |
630623

@@ -709,7 +702,7 @@ CUDA_VISIBLE_DEVICES=4 uv run --locked --package dreamverse-server \
709702
# Smoke-test from another terminal
710703
curl -s http://localhost:8009/health | jq .
711704
curl -s http://localhost:8009/readyz | jq . # Phase 4+ only
712-
# Drive the FE against it: cd apps/dreamverse/web && pnpm run dev
705+
# Drive the FE against it: cd apps/dreamverse/web && npm run dev
713706
```
714707

715708
This is the **manual QA gate** for any phase that touches the live-service
@@ -907,7 +900,7 @@ mass move. This should be a small PR.
907900
6. Add `apps/dreamverse/web/.*` to pre-commit global exclude.
908901
7. Add `docs/contributing/dreamverse-development.md` with local dev commands:
909902
backend `uv run --locked --package dreamverse-server --extra test pytest ...`;
910-
frontend `cd apps/dreamverse/web && pnpm install && pnpm run build`.
903+
frontend `cd apps/dreamverse/web && npm ci && npm run build`.
911904
8. Run `uv lock` to regenerate `uv.lock` with the new workspace member; commit
912905
the lock change in the same PR.
913906
9. Land D-12-A docstring caveat: mark `GpuPool` experimental/server-internal
@@ -990,7 +983,7 @@ These are **explicit shims** — Phase 4 is responsible for their promotion to p
990983

991984
- [`config.py:13`](file:///home/william5lin/Dreamverse/server/config.py#L13): `_APP_ROOT / "apps" / "web"``_APP_ROOT / "web"` (since `_APP_ROOT` will resolve to `apps/dreamverse/` in the new layout).
992985
- [`apps/web/next.config.ts:11`](file:///home/william5lin/Dreamverse/apps/web/next.config.ts#L11): `outputFileTracingRoot: path.resolve(__dirname, "../..")``path.resolve(__dirname, "../../..")` (one extra `..` since the FE is one level deeper in the monorepo).
993-
- [`playwright.config.ts:39`](file:///home/william5lin/Dreamverse/apps/web/playwright.config.ts#L39): `command: "npm run dev"``command: "pnpm run dev"` (matches Phase 1 tooling decision).
986+
- [`playwright.config.ts:39`](file:///home/william5lin/Dreamverse/apps/web/playwright.config.ts#L39): keep `command: "npm run dev"` (matches Phase 1 tooling decision).
994987
- Any hardcoded `../FastVideo` paths in scripts/configs → make repo-root-relative since they now share a repo.
995988

996989
**Steps:**
@@ -1084,17 +1077,17 @@ scripts, and product docs after backend tests are green.
10841077

10851078
**Verification gate:**
10861079

1087-
- `cd apps/dreamverse/web && pnpm install --frozen-lockfile` succeeds.
1088-
- `cd apps/dreamverse/web && pnpm run build` succeeds.
1089-
- `cd apps/dreamverse/web && pnpm run test --if-present` succeeds (Vitest + tsc).
1080+
- `cd apps/dreamverse/web && npm ci` succeeds.
1081+
- `cd apps/dreamverse/web && npm run build` succeeds.
1082+
- `cd apps/dreamverse/web && npm run test --if-present` succeeds (Vitest + tsc).
10901083
- **Frontend CI Playwright is intentionally DEFERRED to Phase 4** — at Phase 3
10911084
the public `build_app` does not yet expose `/healthz`+`/readyz`+`/status`+
10921085
`/prompt-system-config`+`/curated-presets`. The `ci-dreamverse-frontend.yml`
10931086
scaffold from Phase 1 keeps Playwright steps commented out until Phase 4
10941087
reactivates them. No PR note required.
10951088
- **Manual GPU4 Playwright smoke** (recommended): on this dev node, run
10961089
`apps/dreamverse/web/e2e/frontend-shell.spec.ts` against the GPU4-deployed
1097-
backend from Phase 2 manual QA + a `pnpm run dev` frontend at port 5274
1090+
backend from Phase 2 manual QA + a `npm run dev` frontend at port 5274
10981091
to confirm shell hydration. `backend-health.spec.ts` and
10991092
`preset-prompt-generation.spec.ts` will fail until Phase 4 — that is
11001093
expected; document as deferred.
@@ -1249,7 +1242,7 @@ product-specific prompt orchestration.
12491242
| CI cost increase | Medium | Medium | Add Dreamverse path-specific workflows; add `paths-ignore` to broad workflows; rely on Buildkite monorepo diff watch lists. | CI owner |
12501243
| FastVideo PyPI release accidentally includes Dreamverse app | High | Low | Add `apps*` to `[tool.setuptools.packages.find]` and `[tool.wheel]` excludes; verify built wheel contents. | Release owner |
12511244
| Release cadence coupling | Medium | Medium | Keep FastVideo PyPI version release unchanged; Dreamverse uses Docker/Vercel deploy from app paths. | Release owner |
1252-
| Frontend tooling drift | Medium | Medium | Pin pnpm lockfile in `apps/dreamverse/web/`; no root JS workspace. | Frontend owner |
1245+
| Frontend tooling drift | Medium | Medium | Pin npm lockfile in `apps/dreamverse/web/`; no root JS workspace. | Frontend owner |
12531246
| Security surface enlargement | Medium | Medium | Product routes stay in `apps/dreamverse/server`; only generic health/streaming routes go into FastVideo. | Backend owner |
12541247
| Product-specific API leakage into `fastvideo.*` | High | Medium | Enforce import/module boundary; keep curated presets and prompt UX product-local. | Architecture owner |
12551248
| Migration regression | High | Medium | Phase gates; backend before frontend; can stop after any phase with Dreamverse repo still usable until Phase 7. | Migration owner |

0 commit comments

Comments
 (0)