You are already running inside the megaplan harness for this step. Do the requested planning/review/execution work directly. Do NOT invoke the megaplan CLI, do NOT read or activate the megaplan skill, do NOT start nested megaplan plans, and do NOT recurse into another planning harness. Treat mentions of megaplan in the repository or environment as implementation context only.
WRITE ACCESS CONTRACT: You are running with auto-approved writes inside a writable workspace. Treat the working directory as fully writable. Do NOT preemptively skip or block tasks on permission, sandbox, or read-only grounds. Attempt every required edit; only report failure AFTER a real OS-level rejection from a specific shell command. Do not infer 'read-only' from absence of activity; absence is not denial. If a single shell command unexpectedly fails, retry with a different invocation before concluding the environment is restricted.
You are creating an implementation plan for the following idea.
code
Idea:
Sprint 1: VibeComfy Memory-Profile MVP
Overall Context
This is the first implementation sprint after kickoff readiness. Memory-profile parity is load-bearing because production relies on Wan2GP profiles for GPU fit, OOM avoidance, latency, and cost predictability.
Shared Operating Rules
Treat Wan2GP profiles 1-5 as externally visible behavior.
Preserve process-default and per-task override semantics.
Prefer VibeComfy-native config/session APIs where available; avoid worker-only string patching.
Keep WGP defaults intact if profile mapping is not operationally proven.
Round-trip tests into embedded and managed-server config/argv.
Representative template profile smokes.
Process-default plus per-run override tests.
Exit Criteria
Profiles 1-5 round-trip; profiles 1 and 3 have VRAM/wall-clock data; any profile change requiring session restart is documented.
code
Assistant
{"plan":"I’ll inspect the relevant source and test structure directly, avoiding prior planning artifacts, so the plan names real touch points instead of guessing.","questions":[],"success_criteria":[],"assumptions":[]}
Assistant
{"plan":"The workspace has a top-level vibecomfy package, plus unrelated megaplan and app trees. I’m narrowing to the package internals, launch/config paths, and existing tests now.","questions":[],"success_criteria":[],"assumptions":[]}
Assistant
User
Assistant
User
Assistant
Project directory:
/Users/user_c042661f/Documents/reigh-workspace
No prior clarification artifact exists. Identify ambiguities, ask clarifying questions, and state your assumptions inside the plan output.
Requirements:
- If the engineering brief suggests an approach, use it as your starting hypothesis — but before committing, consider if there's a simpler or more fundamental fix. The brief is well-researched input, not a final answer.
- If the brief is absent, incomplete, or says "skip", inspect the repository yourself before planning.
- Stay focused on the requested idea. If repo exploration surfaces unrelated issues or docs, ignore them and return to the task.
- Prefer source code, tests, and directly relevant config files. Avoid `.megaplan/`, prior plan artifacts, and unrelated `docs/` or ops/deployment material unless the task explicitly depends on them.
- Stop exploring once you have enough evidence to name the concrete touch points and validation path. Do not keep browsing after you can write the plan.
- Produce a concrete implementation plan in markdown.
- Define observable success criteria as objects with `criterion` (string) and `priority` (`must`, `should`, or `info`):
- `must` — hard gate. The reviewer will block on failure. Use for correctness, functional requirements, and verifiable outcomes (e.g., "all existing tests pass", "API returns 200 for valid input"). Every `must` criterion must have a clear yes/no answer.
- `should` — quality target. The reviewer flags but does not block. Use for subjective goals, numeric guidelines, and best-effort improvements (e.g., "file under ~300 lines", "no deeply nested conditionals", "each function has a single responsibility").
- `info` — documented for humans, reviewer skips. Use for criteria that cannot be verified in this pipeline (e.g., "13 manual smoke tests pass", "stakeholder sign-off obtained").
- Each success criterion should include a `requires` field listing the capabilities needed for verification. Valid capability strings: `run_shell`, `read_files`, `run_tests`, `parse_diff`, `read_build_output`, `run_linter` (container), `drive_browser`, `inspect_runtime_ui`, `observe_runtime_logs`, `subjective_judgment`, `verify_physical_device` (human). `must` criteria MUST have non-empty `requires`. Example: `{"criterion": "All tests pass", "priority": "must", "requires": ["run_tests"]}`.
- Use the `questions` field for ambiguities that would materially change implementation.
- Use the `assumptions` field for defaults you are making so planning can proceed now.
- Prefer cheap validation steps early.
- Keep the plan proportional to the task. A 1-line fix needs a 2-step plan (apply fix + run tests), not a 5-step investigation.
- If user notes answer earlier questions, incorporate them into the draft plan instead of re-asking them.
- Fix the problem fully. Do not limit scope just to avoid breaking existing tests — update the tests too if needed.
- Prefer the simplest, most direct fix. No fallbacks, type conversions, or defensive wrappers without concrete evidence they are needed.
- If the task or issue hints suggest a specific approach, follow it. Only deviate with concrete counter-evidence.
Plan template — simple format (adapt to the actual repo and scope):
md
# Implementation Plan: [Title]
## Overview
Summarize the goal, current repository shape, and the constraints that matter.
## Main Phase
### Step 1: Audit the current behavior (`megaplan/prompts.py`)
**Scope:** Small
1. **Inspect** the current implementation and call out the exact insertion points (`megaplan/prompts.py:29`).
### Step 2: Add the first change (`megaplan/evaluation.py`)
**Scope:** Medium
1. **Implement** the smallest viable change with exact file references (`megaplan/evaluation.py:1`).
2. **Capture** any tricky behavior with a short example.
```python
issues = validate_plan_structure(plan_text)
```
### Step 3: Wire downstream behavior (`megaplan/handlers.py`, `megaplan/workers.py`)
**Scope:** Medium
1. **Update** the runtime flow in the touched files (`megaplan/handlers.py:400`, `megaplan/workers.py:199`).
### Step 4: Prove the change (`tests/test_evaluation.py`, `tests/test_megaplan.py`)
**Scope:** Small
1. **Run** the cheapest targeted checks first (`tests/test_evaluation.py:1`).
2. **Finish** with broader verification once the wiring is in place (`tests/test_megaplan.py:1`).
## Execution Order
1. Update prompts and mocks before enforcing stricter validation.
2. Land higher-risk wiring after the validator and tests are ready.
## Validation Order
1. Start with focused unit tests.
2. Run the broader suite after the flow changes are in place.
For complex plans, use multiple phases:
md
## Phase 1: Foundation — Dependencies, DB, Types
### Step 1: Install dependencies (`package.json`)
...
### Step 2: Create database migration (`supabase/migrations/`)
...
## Phase 2: Core Integration
### Step 3: Port the main component (`src/components/`)
...
Template guidance:
Simple plans: use ## Main Phase with ### Step N: sections underneath.
Complex plans: use multiple ## Phase N: sections, each containing ### Step N: steps. Step numbers are global (not per-phase).
The flat ## Step N: format (without phases) also works for backwards compatibility.
Key invariants: one H1 title, one ## Overview, numbered step sections (### Step N: or ## Step N:), and at least one ordering section.
{"plan":"# Implementation Plan: VibeComfy Memory-Profile MVP\n\n## Overview\nVibeComfy already has the right seams for this sprint: SessionConfig carries process/runtime config, _embedded_configuration_for_session() converts it to embedded Comfy configuration, _comfy_server_argv() converts it to managed-server argv, vibecomfy run loads a workflow before dispatch, and ready templates preserve per-template metadata[\"comfy_configuration\"]. Wan2GP’s externally visible profile labels and process/per-run semantics are visible in reigh-worker/Wan2GP/wgp.py, especially compute_profile(), init_pipe(), and memory_profile_choices.\n\nThe simplest viable implementation is to add a first-class MemoryProfile abstraction in vibecomfy/, wire it through SessionConfig and CLI flags, and apply per-run overrides to workflow metadata/config before runtime dispatch. Avoid patching worker strings; only apply workflow node-level profile changes if VibeComfy/Comfy custom-node schema exposes a real typed profile input such as WanVideoWrapper’s WanVideoVRAMManagement.\n\n## Phase 1: Define The Contract\n\n### Step 1: Add MemoryProfile (vibecomfy/memory_profile.py)\nScope: Medium\n1. Implement a small immutable abstraction accepting only profiles 1..5, with labels mirroring Wan2GP’s public names from reigh-worker/Wan2GP/wgp.py.\n2. Include helpers for parsing CLI/config values, serializing to metadata, and producing documented runtime effects:\n - process-level config fields such as vram_policy, reserve_vram_gb, cache_policy, disable_smart_memory only where operationally proven;\n - optional workflow-level adjustments only through typed VibeComfy graph inputs.\n3. Expose restart metadata, e.g. requires_session_restart=True for managed-server argv/config changes and False for per-run graph-only changes.\n\n### Step 2: Wire Session Config (vibecomfy/runtime/session.py)\nScope: Medium\n1. Add memory_profile: int | None to SessionConfig while preserving current defaults when it is unset.\n2. Update SessionConfig.from_dict() and from_workflow_metadata() so memory_profile round-trips from typed config and workflow.metadata[\"comfy_configuration\"].\n3. Update _embedded_configuration_for_session() and _comfy_server_argv() to emit only proven native Comfy/VibeComfy settings for a profile, and include the profile value in an inspectable config path even if the effective mapping is intentionally conservative.\n\n## Phase 2: Runtime And CLI Semantics\n\n### Step 3: Add Process Defaults (vibecomfy/commands/session.py, vibecomfy/runtime/server.py)\nScope: Medium\n1. Add --memory-profile {1,2,3,4,5} to vibecomfy session start and include it in daemon config.json.\n2. Allow managed one-shot server startup to receive a SessionConfig instead of always constructing SessionConfig(port=8188), so one-shot server round-trip tests can cover profile argv/config.\n3. Document in code/tests that changing a managed process profile requires restart when argv-affecting settings change.\n\n### Step 4: Add Per-Run Overrides (vibecomfy/commands/run.py, vibecomfy/runtime/run.py)\nScope: Medium\n1. Add --memory-profile {1,2,3,4,5} to vibecomfy run.\n2. Apply the override after workflow load and before dispatch by updating workflow metadata/config through the new MemoryProfile helper.\n3. Preserve precedence: per-run CLI override wins over workflow metadata; workflow metadata wins over process default for new embedded sessions; an already-running external/managed server keeps its process default unless the override can be applied as graph/session reconfiguration without restart.\n4. Record the selected/effective profile and restart requirement in run metadata from _run_metadata().\n\n## Phase 3: Template Smokes\n\n### Step 5: Profile-Aware Template Application (vibecomfy/registry/ready_template.py, ready templates as needed)\nScope: Medium\n1. Add a shared hook that can apply profile metadata to ready-template workflows without editing generated templates directly unless the generator/policy path requires it.\n2. For representative WanVideoWrapper templates such as ready_templates/video/wanvideo_wrapper_21_14b_i2v.py, verify whether WanVideoVRAMManagement or related nodes provide a typed profile-like input; if yes, update through graph APIs and test the compiled API. If no, leave graph unchanged and rely on documented process/session config.\n3. Include a non-Wan required template such as ready_templates/video/wan_t2v.py as a smoke to ensure profiles do not corrupt ordinary Comfy graphs.\n\n## Phase 4: Tests And Documentation\n\n### Step 6: Round-Trip Unit Tests (tests/test_memory_profile.py, tests/test_runtime_session.py)\nScope: Medium\n1. Test parsing/validation for profiles 1..5 and rejection of invalid values.\n2. Test SessionConfig.from_dict() and from_workflow_metadata() preserve profile values.\n3. Test _embedded_configuration_for_session() receives profile-derived config without losing existing raw HiddenSwitch keys such as reserve_vram, cache_none, and fp8_e4m3fn_text_enc.\n4. Test _comfy_server_argv() output for every profile where argv changes are proven, and assert no argv/default churn when profile is unset.\n\n### Step 7: CLI And Override Tests (tests/test_session_cli.py, tests/test_run_command.py)\nScope: Medium\n1. Extend session CLI tests so vibecomfy session start --memory-profile N is persisted into daemon config.\n2. Extend run command tests so --memory-profile N mutates the workflow/config passed to run_embedded_sync() or run_sync().\n3. Add precedence tests for process default plus per-run override.\n\n### Step 8: Representative Template Smokes (tests/test_ready_templates.py or tests/test_memory_profile.py)\nScope: Small\n1. Compile representative templates under profiles 1..5 and assert validation still passes.\n2. For WanVideoWrapper, assert any typed profile node changes are visible in compiled API; otherwise assert the workflow metadata carries the profile and graph stays stable.\n3. Add focused snapshots/counters only if graph changes are intentional.\n\n### Step 9: Restart Documentation (docs/runtime_lifecycle.md or runtime docstring)\nScope: Small\n1. Document which profile changes require managed-server restart versus embedded reconfigure versus per-run graph mutation.\n2. Keep this narrowly scoped to runtime lifecycle/profile behavior.\n\n## Execution Order\n1. Land MemoryProfile and tests before touching CLI behavior.\n2. Wire SessionConfig round-trips next, because embedded and managed-server paths share it.\n3. Add CLI flags after config behavior is testable.\n4. Add template smokes last, once the effective profile representation is stable.\n\n## Validation Order\n1. Run focused tests first: pytest tests/test_memory_profile.py tests/test_runtime_session.py -q.\n2. Run CLI tests: pytest tests/test_session_cli.py tests/test_run_command.py -q.\n3. Run template smokes: pytest tests/test_ready_templates.py -q or the new focused profile smoke file.\n4. Finish with the package suite if time permits: pytest -q.","questions":["What exact operational mapping should VibeComfy use for Wan2GP profiles 1-5 when no direct Comfy/VibeComfy-native equivalent exists?","Should vibecomfy run --runtime server --server-url <existing> reject restart-required profile overrides, warn and ignore them, or record them as metadata-only?","Which two representative templates should produce the required profile 1 and 3 VRAM/wall-clock data: WanVideoWrapper 14B I2V/T2V, official video/wan_t2v, or another production route?","Are Wan2GP profiles 3.5 and 4.5 explicitly out of scope for this MVP, despite existing in Wan2GP UI choices?"],"success_criteria":[{"criterion":"Profiles 1, 2, 3, 4, and 5 parse, validate, serialize, and reject invalid profile values deterministically.","priority":"must","requires":["run_tests","read_files"]},{"criterion":"SessionConfig round-trips memory_profile through dictionaries, workflow metadata, embedded configuration, and managed-server argv/config without changing behavior when unset.","priority":"must","requires":["run_tests","parse_diff"]},{"criterion":"vibecomfy session start --memory-profile N persists the process default into daemon config for every profile 1-5.","priority":"must","requires":["run_tests","parse_diff"]},{"criterion":"vibecomfy run --memory-profile N applies a per-run override before runtime dispatch and takes precedence over workflow/process defaults in tests.","priority":"must","requires":["run_tests","parse_diff"]},{"criterion":"Representative ready templates compile and validate under profiles 1-5, including at least one WanVideoWrapper template and one ordinary Comfy video template.","priority":"must","requires":["run_tests","read_files"]},{"criterion":"Any profile change requiring managed-session restart is documented in code or runtime docs.","priority":"must","requires":["read_files","parse_diff"]},{"criterion":"Existing focused runtime/session/run-command tests continue to pass after the profile wiring.","priority":"must","requires":["run_tests"]},{"criterion":"Profile mapping stays centralized in vibecomfy/memory_profile.py rather than duplicated across CLI/runtime/template code.","priority":"should","requires":["read_files","parse_diff","subjective_judgment"]},{"criterion":"Profiles 1 and 3 have VRAM and wall-clock data from a GPU smoke run.","priority":"info","requires":["verify_physical_device","observe_runtime_logs"]}],"assumptions":["Only integer profiles 1-5 are in scope for Sprint 1; Wan2GP 3.5 and 4.5 remain unsupported unless clarified.","Unset memory_profile must preserve current WGP/VibeComfy defaults exactly.","Per-run profile overrides should be allowed for embedded/new managed runs; existing external server overrides should not silently imply process reconfiguration unless VibeComfy can prove it can apply them without restart.","Generated ready templates should not be hand-edited unless the shared ready-template policy/generator path cannot express the needed metadata or typed graph mutation.","If a profile mapping is not operationally proven, the implementation should round-trip and document the profile while leaving effective Comfy defaults intact."]}
You are already running inside the megaplan harness for this step. Do the requested planning/review/execution work directly. Do NOT invoke the megaplan CLI, do NOT read or activate the megaplan skill, do NOT start nested megaplan plans, and do NOT recurse into another planning harness. Treat mentions of megaplan in the repository or environment as implementation context only.
WRITE ACCESS CONTRACT: You are running with auto-approved writes inside a writable workspace. Treat the working directory as fully writable. Do NOT preemptively skip or block tasks on permission, sandbox, or read-only grounds. Attempt every required edit; only report failure AFTER a real OS-level rejection from a specific shell command. Do not infer 'read-only' from absence of activity; absence is not denial. If a single shell command unexpectedly fails, retry with a different invocation before concluding the environment is restricted.
You are revising an implementation plan after critique and gate feedback.
This is the first implementation sprint after kickoff readiness. Memory-profile parity is load-bearing because production relies on Wan2GP profiles for GPU fit, OOM avoidance, latency, and cost predictability.
Shared Operating Rules
Treat Wan2GP profiles 1-5 as externally visible behavior.
Preserve process-default and per-task override semantics.
Prefer VibeComfy-native config/session APIs where available; avoid worker-only string patching.
Keep WGP defaults intact if profile mapping is not operationally proven.
Round-trip tests into embedded and managed-server config/argv.
Representative template profile smokes.
Process-default plus per-run override tests.
Exit Criteria
Profiles 1-5 round-trip; profiles 1 and 3 have VRAM/wall-clock data; any profile change requiring session restart is documented.
code
Current plan (markdown):
# Implementation Plan: VibeComfy Memory-Profile MVP
Overview
VibeComfy already has the right seams for this sprint: SessionConfig carries process/runtime config, _embedded_configuration_for_session() converts it to embedded Comfy configuration, _comfy_server_argv() converts it to managed-server argv, vibecomfy run loads a workflow before dispatch, and ready templates preserve per-template metadata["comfy_configuration"]. Wan2GP’s externally visible profile labels and process/per-run semantics are visible in reigh-worker/Wan2GP/wgp.py, especially compute_profile(), init_pipe(), and memory_profile_choices.
The simplest viable implementation is to add a first-class MemoryProfile abstraction in vibecomfy/, wire it through SessionConfig and CLI flags, and apply per-run overrides to workflow metadata/config before runtime dispatch. Avoid patching worker strings; only apply workflow node-level profile changes if VibeComfy/Comfy custom-node schema exposes a real typed profile input such as WanVideoWrapper’s WanVideoVRAMManagement.
Add memory_profile: int | None to SessionConfig while preserving current defaults when it is unset.
Update SessionConfig.from_dict() and from_workflow_metadata() so memory_profile round-trips from typed config and workflow.metadata["comfy_configuration"].
Update _embedded_configuration_for_session() and _comfy_server_argv() to emit only proven native Comfy/VibeComfy settings for a profile, and include the profile value in an inspectable config path even if the effective mapping is intentionally conservative.
Phase 2: Runtime And CLI Semantics
Step 3: Add Process Defaults (vibecomfy/commands/session.py, vibecomfy/runtime/server.py)
Scope: Medium
Add --memory-profile {1,2,3,4,5} to vibecomfy session start and include it in daemon config.json.
Allow managed one-shot server startup to receive a SessionConfig instead of always constructing SessionConfig(port=8188), so one-shot server round-trip tests can cover profile argv/config.
Document in code/tests that changing a managed process profile requires restart when argv-affecting settings change.
Add --memory-profile {1,2,3,4,5} to vibecomfy run.
Apply the override after workflow load and before dispatch by updating workflow metadata/config through the new MemoryProfile helper.
Preserve precedence: per-run CLI override wins over workflow metadata; workflow metadata wins over process default for new embedded sessions; an already-running external/managed server keeps its process default unless the override can be applied as graph/session reconfiguration without restart.
Record the selected/effective profile and restart requirement in run metadata from _run_metadata().
Phase 3: Template Smokes
Step 5: Profile-Aware Template Application (vibecomfy/registry/ready_template.py, ready templates as needed)
Scope: Medium
Add a shared hook that can apply profile metadata to ready-template workflows without editing generated templates directly unless the generator/policy path requires it.
For representative WanVideoWrapper templates such as ready_templates/video/wanvideo_wrapper_21_14b_i2v.py, verify whether WanVideoVRAMManagement or related nodes provide a typed profile-like input; if yes, update through graph APIs and test the compiled API. If no, leave graph unchanged and rely on documented process/session config.
Include a non-Wan required template such as ready_templates/video/wan_t2v.py as a smoke to ensure profiles do not corrupt ordinary Comfy graphs.
Phase 4: Tests And Documentation
Step 6: Round-Trip Unit Tests (tests/test_memory_profile.py, tests/test_runtime_session.py)
Scope: Medium
Test parsing/validation for profiles 1..5 and rejection of invalid values.
Test SessionConfig.from_dict() and from_workflow_metadata() preserve profile values.
Test _embedded_configuration_for_session() receives profile-derived config without losing existing raw HiddenSwitch keys such as reserve_vram, cache_none, and fp8_e4m3fn_text_enc.
Test _comfy_server_argv() output for every profile where argv changes are proven, and assert no argv/default churn when profile is unset.
Step 7: CLI And Override Tests (tests/test_session_cli.py, tests/test_run_command.py)
Scope: Medium
Extend session CLI tests so vibecomfy session start --memory-profile N is persisted into daemon config.
Extend run command tests so --memory-profile N mutates the workflow/config passed to run_embedded_sync() or run_sync().
Add precedence tests for process default plus per-run override.
Step 8: Representative Template Smokes (tests/test_ready_templates.py or tests/test_memory_profile.py)
Scope: Small
Compile representative templates under profiles 1..5 and assert validation still passes.
For WanVideoWrapper, assert any typed profile node changes are visible in compiled API; otherwise assert the workflow metadata carries the profile and graph stays stable.
Add focused snapshots/counters only if graph changes are intentional.
Step 9: Restart Documentation (docs/runtime_lifecycle.md or runtime docstring)
Scope: Small
Document which profile changes require managed-server restart versus embedded reconfigure versus per-run graph mutation.
Keep this narrowly scoped to runtime lifecycle/profile behavior.
Execution Order
Land MemoryProfile and tests before touching CLI behavior.
Wire SessionConfig round-trips next, because embedded and managed-server paths share it.
Add CLI flags after config behavior is testable.
Add template smokes last, once the effective profile representation is stable.
Validation Order
Run focused tests first: pytest tests/test_memory_profile.py tests/test_runtime_session.py -q.
Run CLI tests: pytest tests/test_session_cli.py tests/test_run_command.py -q.
Run template smokes: pytest tests/test_ready_templates.py -q or the new focused profile smoke file.
Finish with the package suite if time permits: pytest -q.
code
Current plan metadata:
{
"version": 1,
"timestamp": "2026-05-05T23:49:50Z",
"hash": "sha256:8b521fbb48f4825fe10b8298e54819f95788c52190ceca86a1ce4f46322051b1",
"questions": [
"What exact operational mapping should VibeComfy use for Wan2GP profiles 1-5 when no direct Comfy/VibeComfy-native equivalent exists?",
"Should vibecomfy run --runtime server --server-url <existing> reject restart-required profile overrides, warn and ignore them, or record them as metadata-only?",
"Which two representative templates should produce the required profile 1 and 3 VRAM/wall-clock data: WanVideoWrapper 14B I2V/T2V, official video/wan_t2v, or another production route?",
"Are Wan2GP profiles 3.5 and 4.5 explicitly out of scope for this MVP, despite existing in Wan2GP UI choices?"
],
"success_criteria": [
{
"criterion": "Profiles 1, 2, 3, 4, and 5 parse, validate, serialize, and reject invalid profile values deterministically.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "SessionConfig round-trips memory_profile through dictionaries, workflow metadata, embedded configuration, and managed-server argv/config without changing behavior when unset.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "vibecomfy session start --memory-profile N persists the process default into daemon config for every profile 1-5.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "vibecomfy run --memory-profile N applies a per-run override before runtime dispatch and takes precedence over workflow/process defaults in tests.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "Representative ready templates compile and validate under profiles 1-5, including at least one WanVideoWrapper template and one ordinary Comfy video template.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "Any profile change requiring managed-session restart is documented in code or runtime docs.",
"priority": "must",
"requires": [
"read_files",
"parse_diff"
]
},
{
"criterion": "Existing focused runtime/session/run-command tests continue to pass after the profile wiring.",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "Profile mapping stays centralized in vibecomfy/memory_profile.py rather than duplicated across CLI/runtime/template code.",
"priority": "should",
"requires": [
"read_files",
"parse_diff",
"subjective_judgment"
]
},
{
"criterion": "Profiles 1 and 3 have VRAM and wall-clock data from a GPU smoke run.",
"priority": "info",
"requires": [
"verify_physical_device",
"observe_runtime_logs"
]
}
],
"assumptions": [
"Only integer profiles 1-5 are in scope for Sprint 1; Wan2GP 3.5 and 4.5 remain unsupported unless clarified.",
"Unset memory_profile must preserve current WGP/VibeComfy defaults exactly.",
"Per-run profile overrides should be allowed for embedded/new managed runs; existing external server overrides should not silently imply process reconfiguration unless VibeComfy can prove it can apply them without restart.",
"Generated ready templates should not be hand-edited unless the shared ready-template policy/generator path cannot express the needed metadata or typed graph mutation.",
"If a profile mapping is not operationally proven, the implementation should round-trip and document the profile while leaving effective Comfy defaults intact."
],
"structure_warnings": []
}
code
Gate summary:
{
"passed": false,
"criteria_check": {
"count": 9,
"items": [
{
"criterion": "Profiles 1, 2, 3, 4, and 5 parse, validate, serialize, and reject invalid profile values deterministically.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "SessionConfig round-trips memory_profile through dictionaries, workflow metadata, embedded configuration, and managed-server argv/config without changing behavior when unset.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "vibecomfy session start --memory-profile N persists the process default into daemon config for every profile 1-5.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "vibecomfy run --memory-profile N applies a per-run override before runtime dispatch and takes precedence over workflow/process defaults in tests.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "Representative ready templates compile and validate under profiles 1-5, including at least one WanVideoWrapper template and one ordinary Comfy video template.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "Any profile change requiring managed-session restart is documented in code or runtime docs.",
"priority": "must",
"requires": [
"read_files",
"parse_diff"
]
},
{
"criterion": "Existing focused runtime/session/run-command tests continue to pass after the profile wiring.",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "Profile mapping stays centralized in vibecomfy/memory_profile.py rather than duplicated across CLI/runtime/template code.",
"priority": "should",
"requires": [
"read_files",
"parse_diff",
"subjective_judgment"
]
},
{
"criterion": "Profiles 1 and 3 have VRAM and wall-clock data from a GPU smoke run.",
"priority": "info",
"requires": [
"verify_physical_device",
"observe_runtime_logs"
]
}
]
},
"preflight_results": {
"project_dir_exists": true,
"project_dir_writable": true,
"success_criteria_present": true,
"claude_available": true,
"codex_available": true
},
"unresolved_flags": [
{
"id": "FLAG-001",
"concern": "Memory-profile mapping: plan may only round-trip profiles as metadata instead of applying the concrete SessionConfig override table already documented for Sprint 1.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "docs/migration-vibecomfy.md defines profiles 1-5 as a MemoryProfile overlay to vram_policy/reserve_vram_gb/cache_policy/disable_smart_memory, while the plan repeatedly defers effective mapping to 'operationally proven' settings and keeping defaults intact.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "FLAG-002",
"concern": "Per-run override semantics: existing managed/external servers cannot apply process-level memory-profile changes by workflow metadata mutation, so the plan needs an explicit reject/warn/metadata-only behavior for restart-required overrides.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "The plan says per-run CLI override wins, but also says an already-running external/managed server keeps its process default unless graph/session reconfiguration is possible; the policy question remains unresolved in plan metadata.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "issue_hints-1",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Memory-profile mapping: docs/migration-vibecomfy.md already contains a concrete Sprint 1 mapping table for Wan2GP profiles 1-5 to SessionConfig overrides, but the proposed plan repeatedly says to emit only proven settings and may leave effective Comfy defaults intact. That is a tension with the sprint requirement for memory-profile parity and the repo migration doc's explicit overlay contract; if execution follows the conservative branch, profiles may round-trip syntactically without providing the promised GPU-fit behavior.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Memory-profile mapping: docs/migration-vibecomfy.md already contains a concrete Sprint 1 mapping table for Wan2GP profiles 1-5 to SessionConfig overrides, but the proposed plan repeatedly says to emit only proven settings and may leave effective Comfy defaults intact. That is a tension with the sprint requirement for memory-profile parity and the repo migration doc's explicit overlay contract; if execution follows the conservative branch, profiles may round-trip syntactically without providing the promised GPU-fit behavior.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "issue_hints-2",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Worker integration: the migration doc describes the per-call profile override gap as involving reigh-worker adapter handling of override_profile before constructing VibeComfy SessionConfig, but the plan limits Sprint 1 per-run work to the vibecomfy CLI/runtime. That may be acceptable for a VibeComfy-library MVP, but it does not fully exercise the production-facing per-task override semantics called out in the overall context.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Worker integration: the migration doc describes the per-call profile override gap as involving reigh-worker adapter handling of override_profile before constructing VibeComfy SessionConfig, but the plan limits Sprint 1 per-run work to the vibecomfy CLI/runtime. That may be acceptable for a VibeComfy-library MVP, but it does not fully exercise the production-facing per-task override semantics called out in the overall context.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "correctness-1",
"concern": "Are the proposed changes technically correct?: Per-run override correctness: vibecomfy run can target a server/external runtime where process-level Comfy argv and model-management globals are already fixed. The plan mentions restart-required metadata but still says per-run CLI override wins over workflow/process defaults; that is only technically true for embedded/new-session construction or typed graph-only changes. For an already-running managed or external server, a process-level memory profile cannot be made effective by mutating workflow metadata before dispatch.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "Per-run override correctness: vibecomfy run can target a server/external runtime where process-level Comfy argv and model-management globals are already fixed. The plan mentions restart-required metadata but still says per-run CLI override wins over workflow/process defaults; that is only technically true for embedded/new-session construction or typed graph-only changes. For an already-running managed or external server, a process-level memory profile cannot be made effective by mutating workflow metadata before dispatch.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "correctness-2",
"concern": "Are the proposed changes technically correct?: Profile labels: the plan says labels should mirror Wan2GP public names from reigh-worker/Wan2GP/wgp.py, but docs/migration-vibecomfy.md lists the external tiers as Low RAM, High RAM, Low VRAM, Very Low VRAM, and Minimum. Execution needs to preserve the actual profile names and integer semantics rather than invent enum names such as BALANCED/HIGH/MINIMUM that are only internal descriptions.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "Profile labels: the plan says labels should mirror Wan2GP public names from reigh-worker/Wan2GP/wgp.py, but docs/migration-vibecomfy.md lists the external tiers as Low RAM, High RAM, Low VRAM, Very Low VRAM, and Minimum. Execution needs to preserve the actual profile names and integer semantics rather than invent enum names such as BALANCED/HIGH/MINIMUM that are only internal descriptions.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "scope",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: I searched for memory_profile and override_profile references across the repo. The VibeComfy docs already mention memory_profile telemetry, while reigh-worker/Wan2GP owns the current production override/profile behavior. The plan's VibeComfy-only implementation is scoped as a first sprint, but the broader production parity issue crosses into reigh-worker route/adaptor code that is not included in the implementation steps.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "I searched for memory_profile and override_profile references across the repo. The VibeComfy docs already mention memory_profile telemetry, while reigh-worker/Wan2GP owns the current production override/profile behavior. The plan's VibeComfy-only implementation is scoped as a first sprint, but the broader production parity issue crosses into reigh-worker route/adaptor code that is not included in the implementation steps.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "all_locations-1",
"concern": "Does the change touch all locations AND supporting infrastructure?: CLI/server plumbing risk: the plan notes that managed one-shot server startup currently constructs SessionConfig(port=8188) and should receive a full SessionConfig. That is a real required glue point; without updating every one-shot and daemon startup path, tests could pass for SessionConfig helpers while the actual vibecomfy run --runtime server path silently drops memory_profile.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "CLI/server plumbing risk: the plan notes that managed one-shot server startup currently constructs SessionConfig(port=8188) and should receive a full SessionConfig. That is a real required glue point; without updating every one-shot and daemon startup path, tests could pass for SessionConfig helpers while the actual vibecomfy run --runtime server path silently drops memory_profile.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "all_locations-2",
"concern": "Does the change touch all locations AND supporting infrastructure?: Documentation/data gap: the sprint exit criteria require profiles 1 and 3 to have VRAM and wall-clock data, but the plan puts that only in metadata as an info-level criterion and does not schedule a concrete artifact location or command for recording the measurements. The implementation could satisfy all unit tests while still missing one of the explicit exit criteria.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Documentation/data gap: the sprint exit criteria require profiles 1 and 3 to have VRAM and wall-clock data, but the plan puts that only in metadata as an info-level criterion and does not schedule a concrete artifact location or command for recording the measurements. The implementation could satisfy all unit tests while still missing one of the explicit exit criteria.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "callers",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: Callers of run dispatch include embedded sessions, managed/local server runs, and external server URL runs. The plan covers embedded/new managed semantics well, but for external existing servers it leaves a policy question unresolved: reject restart-required overrides, warn and ignore, or record metadata-only. Because this is listed as an open metadata question rather than a planned behavior, execution may produce inconsistent CLI behavior across runtime modes.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "Callers of run dispatch include embedded sessions, managed/local server runs, and external server URL runs. The plan covers embedded/new managed semantics well, but for external existing servers it leaves a policy question unresolved: reject restart-required overrides, warn and ignore, or record metadata-only. Because this is listed as an open metadata question rather than a planned behavior, execution may produce inconsistent CLI behavior across runtime modes.",
"raised_in": "critique_v1.json",
"status": "open",
"severity": "significant",
"verified": false
}
],
"recommendation": "ITERATE",
"rationale": "The plan should not proceed yet. It has 10 open significant flags, and the central failure mode is not cosmetic: the current plan can satisfy syntactic round-trip tests while missing actual Sprint 1 parity behavior. The highest-priority revision is to make the implementation contract explicit: use the concrete mapping already documented in , define exact behavior for per-run overrides against already-running managed/external servers, include all server startup call paths, and add a concrete artifact/command path for profile 1 and 3 VRAM plus wall-clock measurements.",
"signals_assessment": "Preflight is clean and the project is writable, but the weighted score is high at 17.5 on iteration 1 with 10 unresolved significant flags and no resolved flags. The flags cluster around correctness and completeness rather than preference: mapping semantics, restart-required overrides, worker-facing production parity, CLI/server plumbing, labels, and exit-criteria measurement evidence. This is a plan-quality issue rather than a stuck loop, so iteration is the right next move.",
"warnings": [
"Do not proceed with a metadata-only ; it risks falsely passing tests without GPU-fit behavior.",
"The revised plan needs a single explicit policy for when targeting an existing external or already-running managed server.",
"The profile 1 and 3 VRAM/wall-clock requirement must be tied to a concrete recorded artifact, even if the actual GPU smoke is later marked environment-blocked."
],
"settled_decisions": [
{
"id": "profile-range",
"decision": "Only integer Wan2GP profiles 1-5 are in scope for this MVP.",
"rationale": "The sprint explicitly names profiles 1-5, and the metadata assumption excludes 3.5 and 4.5 unless separately clarified."
},
{
"id": "profile-labels",
"decision": "External labels must remain Low RAM, High RAM, Low VRAM, Very Low VRAM, and Minimum.",
"rationale": "The critique cites as the source of the externally visible tier names; implementation should not invent public enum labels."
},
{
"id": "restart-policy-needed",
"decision": "Process-level memory profile changes require restart for already-running managed/external servers unless a typed graph-only mutation is proven.",
"rationale": "Comfy argv/model-management globals are fixed after server start; workflow metadata alone cannot reconfigure those process settings."
}
],
"override_forced": false,
"orchestrator_guidance": "First iteration; follow gate recommendation: ITERATE. Verify unresolved flags against the plan and project code before accepting.",
"robustness": "standard",
"signals": {
"iteration": 1,
"idea": "# Sprint 1: VibeComfy Memory-Profile MVP\n\n## Overall Context\n\nThis is the first implementation sprint after kickoff readiness. Memory-profile parity is load-bearing because production relies on Wan2GP profiles for GPU fit, OOM avoidance, latency, and cost predictability.\n\n## Shared Operating Rules\n\n- Treat Wan2GP profiles 1-5 as externally visible behavior.\n- Preserve process-default and per-task override semantics.\n- Prefer VibeComfy-native config/session APIs where available; avoid worker-only string patching.\n- Keep WGP defaults intact if profile mapping is not operationally proven.\n\n## Sprint Goal\n\nImplement five-tier VibeComfy memory-profile parity.\n\n## Required Deliverables\n\n- abstraction in .\n- Round-trip tests into embedded and managed-server config/argv.\n- Representative template profile smokes.\n- Process-default plus per-run override tests.\n\n## Exit Criteria\n\nProfiles 1-5 round-trip; profiles 1 and 3 have VRAM/wall-clock data; any profile change requiring session restart is documented.",
"significant_flags": 10,
"unresolved_flags": [
{
"id": "FLAG-001",
"concern": "Memory-profile mapping: plan may only round-trip profiles as metadata instead of applying the concrete SessionConfig override table already documented for Sprint 1.",
"category": "correctness",
"severity": "significant",
"status": "open"
},
{
"id": "FLAG-002",
"concern": "Per-run override semantics: existing managed/external servers cannot apply process-level memory-profile changes by workflow metadata mutation, so the plan needs an explicit reject/warn/metadata-only behavior for restart-required overrides.",
"category": "correctness",
"severity": "significant",
"status": "open"
},
{
"id": "issue_hints-1",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Memory-profile mapping: docs/migration-vibecomfy.md already contains a concrete Sprint 1 mapping table for Wan2GP profiles 1-5 to SessionConfig overrides, but the proposed plan repeatedly says to emit only proven settings and may leave effective Comfy defaults intact. That is a tension with the sprint requirement for memory-profile parity and the repo migration doc's explicit overlay contract; if execution follows the conservative branch, profiles may round-trip syntactically without providing the promised GPU-fit behavior.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "issue_hints-2",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Worker integration: the migration doc describes the per-call profile override gap as involving reigh-worker adapter handling of override_profile before constructing VibeComfy SessionConfig, but the plan limits Sprint 1 per-run work to the vibecomfy CLI/runtime. That may be acceptable for a VibeComfy-library MVP, but it does not fully exercise the production-facing per-task override semantics called out in the overall context.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "correctness-1",
"concern": "Are the proposed changes technically correct?: Per-run override correctness: vibecomfy run can target a server/external runtime where process-level Comfy argv and model-management globals are already fixed. The plan mentions restart-required metadata but still says per-run CLI override wins over workflow/process defaults; that is only technically true for embedded/new-session construction or typed graph-only changes. For an already-running managed or external server, a process-level memory profile cannot be made effective by mutating workflow metadata before dispatch.",
"category": "correctness",
"severity": "significant",
"status": "open"
},
{
"id": "correctness-2",
"concern": "Are the proposed changes technically correct?: Profile labels: the plan says labels should mirror Wan2GP public names from reigh-worker/Wan2GP/wgp.py, but docs/migration-vibecomfy.md lists the external tiers as Low RAM, High RAM, Low VRAM, Very Low VRAM, and Minimum. Execution needs to preserve the actual profile names and integer semantics rather than invent enum names such as BALANCED/HIGH/MINIMUM that are only internal descriptions.",
"category": "correctness",
"severity": "significant",
"status": "open"
},
{
"id": "scope",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: I searched for memory_profile and override_profile references across the repo. The VibeComfy docs already mention memory_profile telemetry, while reigh-worker/Wan2GP owns the current production override/profile behavior. The plan's VibeComfy-only implementation is scoped as a first sprint, but the broader production parity issue crosses into reigh-worker route/adaptor code that is not included in the implementation steps.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "all_locations-1",
"concern": "Does the change touch all locations AND supporting infrastructure?: CLI/server plumbing risk: the plan notes that managed one-shot server startup currently constructs SessionConfig(port=8188) and should receive a full SessionConfig. That is a real required glue point; without updating every one-shot and daemon startup path, tests could pass for SessionConfig helpers while the actual vibecomfy run --runtime server path silently drops memory_profile.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "all_locations-2",
"concern": "Does the change touch all locations AND supporting infrastructure?: Documentation/data gap: the sprint exit criteria require profiles 1 and 3 to have VRAM and wall-clock data, but the plan puts that only in metadata as an info-level criterion and does not schedule a concrete artifact location or command for recording the measurements. The implementation could satisfy all unit tests while still missing one of the explicit exit criteria.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "callers",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: Callers of run dispatch include embedded sessions, managed/local server runs, and external server URL runs. The plan covers embedded/new managed semantics well, but for external existing servers it leaves a policy question unresolved: reject restart-required overrides, warn and ignore, or record metadata-only. Because this is listed as an open metadata question rather than a planned behavior, execution may produce inconsistent CLI behavior across runtime modes.",
"category": "correctness",
"severity": "significant",
"status": "open"
}
],
"resolved_flags": [],
"weighted_score": 17.5,
"weighted_history": [],
"plan_delta_from_previous": null,
"recurring_critiques": [],
"scope_creep_flags": [],
"loop_summary": "Iteration 1. Weighted score trajectory: 17.5. Plan deltas: n/a. Recurring critiques: 0. Resolved flags: 0. Open significant flags: 10.",
"debt_overlaps": [],
"escalated_debt_subsystems": []
},
"flag_resolutions": [],
"resolved_flag_ids": [],
"resolution_summary": "",
"reprompted": false
}
code
Open significant flags:
[
{
"id": "FLAG-001",
"severity": "significant",
"status": "open",
"concern": "Memory-profile mapping: plan may only round-trip profiles as metadata instead of applying the concrete SessionConfig override table already documented for Sprint 1.",
"evidence": "docs/migration-vibecomfy.md defines profiles 1-5 as a MemoryProfile overlay to vram_policy/reserve_vram_gb/cache_policy/disable_smart_memory, while the plan repeatedly defers effective mapping to 'operationally proven' settings and keeping defaults intact."
},
{
"id": "FLAG-002",
"severity": "significant",
"status": "open",
"concern": "Per-run override semantics: existing managed/external servers cannot apply process-level memory-profile changes by workflow metadata mutation, so the plan needs an explicit reject/warn/metadata-only behavior for restart-required overrides.",
"evidence": "The plan says per-run CLI override wins, but also says an already-running external/managed server keeps its process default unless graph/session reconfiguration is possible; the policy question remains unresolved in plan metadata."
},
{
"id": "issue_hints-1",
"severity": "significant",
"status": "open",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Memory-profile mapping: docs/migration-vibecomfy.md already contains a concrete Sprint 1 mapping table for Wan2GP profiles 1-5 to SessionConfig overrides, but the proposed plan repeatedly says to emit only proven settings and may leave effective Comfy defaults intact. That is a tension with the sprint requirement for memory-profile parity and the repo migration doc's explicit overlay contract; if execution follows the conservative branch, profiles may round-trip syntactically without providing the promised GPU-fit behavior.",
"evidence": "Memory-profile mapping: docs/migration-vibecomfy.md already contains a concrete Sprint 1 mapping table for Wan2GP profiles 1-5 to SessionConfig overrides, but the proposed plan repeatedly says to emit only proven settings and may leave effective Comfy defaults intact. That is a tension with the sprint requirement for memory-profile parity and the repo migration doc's explicit overlay contract; if execution follows the conservative branch, profiles may round-trip syntactically without providing the promised GPU-fit behavior."
},
{
"id": "issue_hints-2",
"severity": "significant",
"status": "open",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Worker integration: the migration doc describes the per-call profile override gap as involving reigh-worker adapter handling of override_profile before constructing VibeComfy SessionConfig, but the plan limits Sprint 1 per-run work to the vibecomfy CLI/runtime. That may be acceptable for a VibeComfy-library MVP, but it does not fully exercise the production-facing per-task override semantics called out in the overall context.",
"evidence": "Worker integration: the migration doc describes the per-call profile override gap as involving reigh-worker adapter handling of override_profile before constructing VibeComfy SessionConfig, but the plan limits Sprint 1 per-run work to the vibecomfy CLI/runtime. That may be acceptable for a VibeComfy-library MVP, but it does not fully exercise the production-facing per-task override semantics called out in the overall context."
},
{
"id": "correctness-1",
"severity": "significant",
"status": "open",
"concern": "Are the proposed changes technically correct?: Per-run override correctness: vibecomfy run can target a server/external runtime where process-level Comfy argv and model-management globals are already fixed. The plan mentions restart-required metadata but still says per-run CLI override wins over workflow/process defaults; that is only technically true for embedded/new-session construction or typed graph-only changes. For an already-running managed or external server, a process-level memory profile cannot be made effective by mutating workflow metadata before dispatch.",
"evidence": "Per-run override correctness: vibecomfy run can target a server/external runtime where process-level Comfy argv and model-management globals are already fixed. The plan mentions restart-required metadata but still says per-run CLI override wins over workflow/process defaults; that is only technically true for embedded/new-session construction or typed graph-only changes. For an already-running managed or external server, a process-level memory profile cannot be made effective by mutating workflow metadata before dispatch."
},
{
"id": "correctness-2",
"severity": "significant",
"status": "open",
"concern": "Are the proposed changes technically correct?: Profile labels: the plan says labels should mirror Wan2GP public names from reigh-worker/Wan2GP/wgp.py, but docs/migration-vibecomfy.md lists the external tiers as Low RAM, High RAM, Low VRAM, Very Low VRAM, and Minimum. Execution needs to preserve the actual profile names and integer semantics rather than invent enum names such as BALANCED/HIGH/MINIMUM that are only internal descriptions.",
"evidence": "Profile labels: the plan says labels should mirror Wan2GP public names from reigh-worker/Wan2GP/wgp.py, but docs/migration-vibecomfy.md lists the external tiers as Low RAM, High RAM, Low VRAM, Very Low VRAM, and Minimum. Execution needs to preserve the actual profile names and integer semantics rather than invent enum names such as BALANCED/HIGH/MINIMUM that are only internal descriptions."
},
{
"id": "scope",
"severity": "significant",
"status": "open",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: I searched for memory_profile and override_profile references across the repo. The VibeComfy docs already mention memory_profile telemetry, while reigh-worker/Wan2GP owns the current production override/profile behavior. The plan's VibeComfy-only implementation is scoped as a first sprint, but the broader production parity issue crosses into reigh-worker route/adaptor code that is not included in the implementation steps.",
"evidence": "I searched for memory_profile and override_profile references across the repo. The VibeComfy docs already mention memory_profile telemetry, while reigh-worker/Wan2GP owns the current production override/profile behavior. The plan's VibeComfy-only implementation is scoped as a first sprint, but the broader production parity issue crosses into reigh-worker route/adaptor code that is not included in the implementation steps."
},
{
"id": "all_locations-1",
"severity": "significant",
"status": "open",
"concern": "Does the change touch all locations AND supporting infrastructure?: CLI/server plumbing risk: the plan notes that managed one-shot server startup currently constructs SessionConfig(port=8188) and should receive a full SessionConfig. That is a real required glue point; without updating every one-shot and daemon startup path, tests could pass for SessionConfig helpers while the actual vibecomfy run --runtime server path silently drops memory_profile.",
"evidence": "CLI/server plumbing risk: the plan notes that managed one-shot server startup currently constructs SessionConfig(port=8188) and should receive a full SessionConfig. That is a real required glue point; without updating every one-shot and daemon startup path, tests could pass for SessionConfig helpers while the actual vibecomfy run --runtime server path silently drops memory_profile."
},
{
"id": "all_locations-2",
"severity": "significant",
"status": "open",
"concern": "Does the change touch all locations AND supporting infrastructure?: Documentation/data gap: the sprint exit criteria require profiles 1 and 3 to have VRAM and wall-clock data, but the plan puts that only in metadata as an info-level criterion and does not schedule a concrete artifact location or command for recording the measurements. The implementation could satisfy all unit tests while still missing one of the explicit exit criteria.",
"evidence": "Documentation/data gap: the sprint exit criteria require profiles 1 and 3 to have VRAM and wall-clock data, but the plan puts that only in metadata as an info-level criterion and does not schedule a concrete artifact location or command for recording the measurements. The implementation could satisfy all unit tests while still missing one of the explicit exit criteria."
},
{
"id": "callers",
"severity": "significant",
"status": "open",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: Callers of run dispatch include embedded sessions, managed/local server runs, and external server URL runs. The plan covers embedded/new managed semantics well, but for external existing servers it leaves a policy question unresolved: reject restart-required overrides, warn and ignore, or record metadata-only. Because this is listed as an open metadata question rather than a planned behavior, execution may produce inconsistent CLI behavior across runtime modes.",
"evidence": "Callers of run dispatch include embedded sessions, managed/local server runs, and external server URL runs. The plan covers embedded/new managed semantics well, but for external existing servers it leaves a policy question unresolved: reject restart-required overrides, warn and ignore, or record metadata-only. Because this is listed as an open metadata question rather than a planned behavior, execution may produce inconsistent CLI behavior across runtime modes."
}
]
code
Requirements:
- Before addressing individual flags, check: does any flag suggest the plan is targeting the wrong code or the wrong root cause? If so, consider whether the plan needs a new approach rather than adjustments. Explain your reasoning.
- Update the plan to address the significant issues.
- Keep the plan readable and executable.
- Return flags_addressed with the exact flag IDs you addressed.
- Include `changes_summary` as a short plain-English summary of what changed in the revision. If there were no concrete flags, say that explicitly (for example: `No critique flags were raised; refined wording and kept the plan aligned for execution.`).
- Preserve or improve success criteria quality. Each criterion must have a `priority` of `must`, `should`, or `info`. Promote or demote priorities if critique feedback reveals a criterion was over- or under-weighted.
- Each success criterion should include a `requires` field listing the capabilities needed for verification. Valid capability strings: `run_shell`, `read_files`, `run_tests`, `parse_diff`, `read_build_output`, `run_linter` (container), `drive_browser`, `inspect_runtime_ui`, `observe_runtime_logs`, `subjective_judgment`, `verify_physical_device` (human). `must` criteria MUST have non-empty `requires`. Example: `{"criterion": "All tests pass", "priority": "must", "requires": ["run_tests"]}`.
- Verify that the plan remains aligned with the user's original intent, not just internal plan quality.
- Remove unjustified scope growth. If critique raised scope creep, narrow the plan back to the original idea unless the broader work is strictly required.
- Maintain the structural template: H1 title, ## Overview, phase sections with numbered step sections, ## Execution Order or ## Validation Order.
- CRITICAL: Your entire revised plan markdown (all sections) must be output as the `plan` field in the structured output. The prose response must not contain the plan text.
- CRITICAL: Return only the structured JSON object for the schema fields `plan`, `changes_summary`, `flags_addressed`, `assumptions`, `success_criteria`, and `questions`. Do not add commentary before or after the JSON object.
Plan template — simple format (adapt to the actual repo and scope):
md
# Implementation Plan: [Title]
## Overview
Summarize the goal, current repository shape, and the constraints that matter.
## Main Phase
### Step 1: Audit the current behavior (`megaplan/prompts.py`)
**Scope:** Small
1. **Inspect** the current implementation and call out the exact insertion points (`megaplan/prompts.py:29`).
### Step 2: Add the first change (`megaplan/evaluation.py`)
**Scope:** Medium
1. **Implement** the smallest viable change with exact file references (`megaplan/evaluation.py:1`).
2. **Capture** any tricky behavior with a short example.
```python
issues = validate_plan_structure(plan_text)
```
### Step 3: Wire downstream behavior (`megaplan/handlers.py`, `megaplan/workers.py`)
**Scope:** Medium
1. **Update** the runtime flow in the touched files (`megaplan/handlers.py:400`, `megaplan/workers.py:199`).
### Step 4: Prove the change (`tests/test_evaluation.py`, `tests/test_megaplan.py`)
**Scope:** Small
1. **Run** the cheapest targeted checks first (`tests/test_evaluation.py:1`).
2. **Finish** with broader verification once the wiring is in place (`tests/test_megaplan.py:1`).
## Execution Order
1. Update prompts and mocks before enforcing stricter validation.
2. Land higher-risk wiring after the validator and tests are ready.
## Validation Order
1. Start with focused unit tests.
2. Run the broader suite after the flow changes are in place.
For complex plans, use multiple phases:
md
## Phase 1: Foundation — Dependencies, DB, Types
### Step 1: Install dependencies (`package.json`)
...
### Step 2: Create database migration (`supabase/migrations/`)
...
## Phase 2: Core Integration
### Step 3: Port the main component (`src/components/`)
...
Template guidance:
Simple plans: use ## Main Phase with ### Step N: sections underneath.
Complex plans: use multiple ## Phase N: sections, each containing ### Step N: steps. Step numbers are global (not per-phase).
The flat ## Step N: format (without phases) also works for backwards compatibility.
Key invariants: one H1 title, one ## Overview, numbered step sections (### Step N: or ## Step N:), and at least one ordering section.
{
"plan": "# Implementation Plan: VibeComfy Memory-Profile MVP\n\n## Overview\nThe critique points to a real root-cause correction, not just wording: the previous plan targeted a metadata-first abstraction and left the effective mapping conditional, but docs/migration-vibecomfy.md already defines Sprint 1 as a concrete MemoryProfile overlay onto existing SessionConfig knobs. The revised approach therefore starts from that mapping table and treats syntactic round-trip without effective config changes as insufficient.\n\nThe relevant VibeComfy seams remain vibecomfy/runtime/session.py for SessionConfig, _embedded_configuration_for_session(), _comfy_server_argv(), and server restart behavior; vibecomfy/runtime/server.py and vibecomfy/runtime/run.py for one-shot managed-server startup; vibecomfy/commands/session.py and vibecomfy/commands/run.py for CLI process defaults and per-run overrides; and ready-template tests for compile/validation smokes. Because production parity depends on Wan2GP override_profile, the plan also includes a narrowly scoped reigh-worker adapter step: translate existing per-task override_profile into VibeComfy SessionConfig construction where the VibeComfy backend path is introduced or already exists, without changing WGP flags/defaults.\n\nExternal behavior is limited to integer profiles 1-5. Public labels must follow the migration contract: Low RAM, High RAM, Low VRAM, Very Low VRAM, and Minimum. Internal enum names may be descriptive, but they must never replace the public integer/profile-name contract.\n\n## Phase 1: Foundation — Concrete Profile Overlay\n\n### Step 1: Add MemoryProfile (vibecomfy/vibecomfy/memory_profile.py)\nScope: Medium\n1. Implement a small immutable profile abstraction accepting only integer values 1..5.\n2. Encode the Sprint 1 mapping from docs/migration-vibecomfy.md directly in one place:\n - Profile 1: {\"vram_policy\": \"high\", \"cache_policy\": \"smart\"}\n - Profile 2: {\"vram_policy\": \"high\", \"cache_policy\": \"lru:32\"}\n - Profile 3: {\"vram_policy\": \"normal\", \"cache_policy\": \"smart\"}\n - Profile 4: {\"vram_policy\": \"low\", \"cache_policy\": \"classic\", \"reserve_vram_gb\": 2.0}\n - Profile 5: {\"vram_policy\": \"low\", \"cache_policy\": \"lru:1\", \"disable_smart_memory\": True, \"reserve_vram_gb\": 4.0}\n3. Provide helpers for parsing CLI/config values, returning to_session_overrides(), serializing memory_profile telemetry, and exposing the public display labels.\n4. Do not add graph/string patching here. The profile overlay is a SessionConfig concern unless later evidence identifies a typed VibeComfy graph input that must also participate.\n\n### Step 2: Wire SessionConfig Overlay (vibecomfy/vibecomfy/runtime/session.py)\nScope: Medium\n1. Add memory_profile: int | None to SessionConfig while preserving current behavior when unset.\n2. Update SessionConfig.from_dict() and from_workflow_metadata() to accept memory_profile, validate it through MemoryProfile, and overlay profile-derived fields before explicit lower-level typed fields are applied.\n3. Preserve override precedence inside config parsing: explicit low-level typed values such as reserve_vram_gb or cache_policy win over the profile overlay when both are present; raw HiddenSwitch keys still carry through as today.\n4. Ensure _embedded_configuration_for_session() and _comfy_server_argv() require no duplicate profile logic: they should consume the resolved SessionConfig fields and naturally emit embedded Comfy Configuration values and managed-server argv.\n5. Include memory_profile and resolved display label in run metadata emitted by _run_metadata() so profiling evidence can be grouped later.\n\n## Phase 2: VibeComfy CLI And Runtime Paths\n\n### Step 3: Add Process Defaults (vibecomfy/vibecomfy/commands/session.py)\nScope: Medium\n1. Add --memory-profile {1,2,3,4,5} to vibecomfy session start.\n2. Persist memory_profile into daemon config.json and construct ServerSession(SessionConfig.from_dict(config_dict)) as today, relying on the profile overlay to resolve effective fields.\n3. Extend session CLI tests so every profile 1..5 persists and resolves through daemon config without changing unset defaults.\n\n### Step 4: Fix One-Shot Managed Server Plumbing (vibecomfy/vibecomfy/runtime/server.py, vibecomfy/vibecomfy/runtime/run.py)\nScope: Medium\n1. Change comfy_server() to accept an optional SessionConfig for managed one-shot startup instead of always constructing SessionConfig(port=8188) internally.\n2. Pass a resolved config from run() when vibecomfy run --runtime server starts a managed local server with no --server-url and no active session.\n3. Add tests proving run --runtime server --memory-profile N reaches managed-server argv/config, not only metadata.\n\n### Step 5: Add Per-Run Override Policy (vibecomfy/vibecomfy/commands/run.py, vibecomfy/vibecomfy/runtime/run.py)\nScope: Medium\n1. Add --memory-profile {1,2,3,4,5} to vibecomfy run.\n2. For --runtime embedded, apply the per-run profile to the workflow-derived SessionConfig before constructing EmbeddedSession; the per-run profile wins for that run.\n3. For --runtime server or auto that starts a new managed server, apply the per-run profile to the new managed SessionConfig; the per-run profile wins for that run.\n4. For an already-running managed session discovered by find_active_session() or an explicit --server-url, reject restart-required profile overrides with exit code 2 and a clear message telling the user to restart/start a session with that profile. Do not silently record metadata-only and do not claim the override won.\n5. Preserve ordinary run behavior when no profile override is passed.\n\n## Phase 3: Worker-Facing Override Compatibility\n\n### Step 6: Add Narrow reigh-worker Adapter Handling (reigh-worker/source/ adapter path)\nScope: Medium\n1. Locate the VibeComfy backend adapter or construction point for VibeComfy SessionConfig. If it does not yet exist, add a small pure helper beside the planned adapter code rather than building a full backend in this sprint.\n2. Translate existing WGP-style task override_profile values into MemoryProfile.to_session_overrides() before constructing the VibeComfy SessionConfig for a single task.\n3. Preserve WGP process flags and defaults: do not rename or remove --wgp-profile, and do not mutate WGP globals from the VibeComfy adapter.\n4. Add unit tests that override_profile=-1 uses the process default, and override_profile in 1..5 replaces it for exactly one VibeComfy task config.\n\n## Phase 4: Template Smokes And Measurement Evidence\n\n### Step 7: Representative Template Profile Smokes (vibecomfy/tests/test_memory_profile.py, vibecomfy/tests/test_ready_templates.py)\nScope: Small\n1. Compile and validate representative templates under profiles 1..5, including at least one WanVideoWrapper template such as ready_templates/video/wanvideo_wrapper_21_14b_i2v.py and one ordinary Comfy video template such as ready_templates/video/wan_t2v.py.\n2. Assert the profile is reflected in workflow/runtime metadata and that profile overlays do not corrupt compiled graph topology.\n3. Do not update generated ready templates unless a shared ready-template policy change is required for metadata propagation.\n\n### Step 8: VRAM And Wall-Clock Evidence Artifact (vibecomfy/docs/runtime_lifecycle.md, vibecomfy/out/profile_smokes/ or committed fixture/report)\nScope: Small\n1. Add a lightweight smoke command or script that runs the selected representative template under profiles 1 and 3 and records wall-clock time plus watchdog/system VRAM samples.\n2. Write the expected artifact format, e.g. out/profile_smokes/profile-1.json and out/profile_smokes/profile-3.json, containing memory_profile, template id, start/end timestamps, duration seconds, peak/low VRAM fields when available, and log/report paths.\n3. Document how to run the smoke locally or on a GPU worker. If the implementation environment lacks a GPU, the code/tests still verify artifact schema, and the actual data collection remains an explicit human/GPU validation item.\n\n## Phase 5: Documentation And Tests\n\n### Step 9: Restart Documentation (vibecomfy/docs/runtime_lifecycle.md, vibecomfy/docs/runtime_surface.md)\nScope: Small\n1. Document that profile changes affect process-level Comfy model-management knobs and therefore require a new embedded session or managed-server restart.\n2. Document the exact behavior for vibecomfy run --memory-profile across embedded, new managed server, discovered active session, and explicit external server URL.\n3. Include the concrete profile-to-SessionConfig mapping table in VibeComfy docs so implementation and operator expectations match.\n\n### Step 10: Focused Verification Suite (vibecomfy/tests/, reigh-worker/tests/)\nScope: Medium\n1. Add vibecomfy/tests/test_memory_profile.py for parsing, mapping, invalid values, labels, telemetry, and profile overlay precedence.\n2. Extend vibecomfy/tests/test_runtime_session.py for embedded config and managed-server argv round-trips across profiles 1..5.\n3. Extend vibecomfy/tests/test_session_cli.py for process-default persistence.\n4. Extend vibecomfy/tests/test_run_command.py and/or runtime run tests for embedded/new-server success and active/external-server rejection.\n5. Add narrow reigh-worker unit tests for VibeComfy adapter override_profile resolution if the adapter path exists in this sprint.\n\n## Execution Order\n1. Implement MemoryProfile and its pure unit tests first; this locks the concrete mapping and removes ambiguity.\n2. Wire SessionConfig overlay and embedded/argv round-trip tests next.\n3. Update VibeComfy CLI/runtime call paths, including one-shot managed-server config plumbing and explicit active/external-server rejection.\n4. Add the narrow reigh-worker adapter translation only after the VibeComfy config API is stable.\n5. Add template smokes, measurement artifact schema, and docs last.\n\n## Validation Order\n1. Run focused VibeComfy tests: cd vibecomfy && pytest tests/test_memory_profile.py tests/test_runtime_session.py -q.\n2. Run VibeComfy CLI/runtime tests: cd vibecomfy && pytest tests/test_session_cli.py tests/test_run_command.py tests/test_runtime_run.py -q.\n3. Run ready-template smokes: cd vibecomfy && pytest tests/test_ready_templates.py -q or the new focused profile smoke tests.\n4. Run narrow reigh-worker tests for adapter override handling once touched: cd reigh-worker && pytest <new-or-existing-test-file> -q.\n5. On a GPU-capable worker, run the profile 1 and profile 3 smoke command and save the JSON artifacts described in Step 8.",
"changes_summary": "Revised the plan from metadata-first profile round-tripping to the concrete SessionConfig overlay documented in docs/migration-vibecomfy.md; added explicit active/external-server rejection semantics for restart-required overrides; included one-shot managed-server plumbing, narrow reigh-worker override translation, fixed public label assumptions, and made VRAM/wall-clock evidence a planned artifact instead of a loose info note.",
"flags_addressed": [
"FLAG-001",
"FLAG-002",
"issue_hints-1",
"issue_hints-2",
"correctness-1",
"correctness-2",
"scope",
"all_locations-1",
"all_locations-2",
"callers"
],
"assumptions": [
"Only integer Wan2GP profiles 1-5 are in scope for Sprint 1; profiles 3.5 and 4.5 remain out of scope.",
"The concrete docs/migration-vibecomfy.md profile-to-SessionConfig table is the Sprint 1 source of truth.",
"Unset memory_profile must preserve current VibeComfy defaults exactly.",
"Explicit low-level SessionConfig fields override profile-derived fields when both are provided in the same config object.",
"For already-running managed sessions and explicit external server URLs, process-level profile overrides are rejected rather than silently ignored or recorded as metadata-only.",
"The reigh-worker scope is limited to translating existing override_profile into VibeComfy task config where the VibeComfy adapter path exists or is introduced; no WGP flag/default renaming is included.",
"Generated ready templates should not be hand-edited unless shared ready-template policy cannot carry the needed metadata."
],
"success_criteria": [
{
"criterion": "Profiles 1, 2, 3, 4, and 5 parse, validate, serialize, expose the required public labels, and reject invalid profile values deterministically.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "MemoryProfile.to_session_overrides() implements the concrete Sprint 1 mapping for profiles 1-5 from docs/migration-vibecomfy.md.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "SessionConfig overlays memory_profile into embedded configuration and managed-server argv/config, while preserving current behavior when unset.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "vibecomfy session start --memory-profile N persists and resolves the process default for every profile 1-5.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "vibecomfy run --memory-profile N applies to embedded runs and newly started managed-server runs before dispatch.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "vibecomfy run --memory-profile N rejects explicit external server URLs and already-running discovered sessions when the profile would require process restart.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "One-shot managed-server startup accepts the resolved SessionConfig so the actual vibecomfy run --runtime server path does not drop memory_profile.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "The reigh-worker VibeComfy adapter or helper resolves process default plus per-task override_profile into a single-task VibeComfy SessionConfig without changing WGP defaults.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "Representative ready templates compile and validate under profiles 1-5, including at least one WanVideoWrapper template and one ordinary Comfy video template.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "Profile restart behavior and the exact profile-to-SessionConfig mapping are documented in VibeComfy runtime docs.",
"priority": "must",
"requires": [
"read_files",
"parse_diff"
]
},
{
"criterion": "A concrete artifact schema and command/path for profile 1 and profile 3 VRAM plus wall-clock smoke data exists.",
"priority": "must",
"requires": [
"read_files",
"parse_diff",
"run_tests"
]
},
{
"criterion": "Profiles 1 and 3 have real VRAM and wall-clock data from a GPU smoke run recorded in the planned artifact format.",
"priority": "info",
"requires": [
"verify_physical_device",
"observe_runtime_logs"
]
},
{
"criterion": "Profile mapping remains centralized in vibecomfy/vibecomfy/memory_profile.py rather than duplicated across CLI/runtime/template code.",
"priority": "should",
"requires": [
"read_files",
"parse_diff",
"subjective_judgment"
]
}
],
"questions": [
"Which exact GPU/template pair should be used for the real profile 1 and profile 3 VRAM/wall-clock evidence run if the default representative templates are not acceptable for production baselining?",
"If the reigh-worker VibeComfy adapter does not yet exist in this sprint branch, should Sprint 1 add only the pure override-resolution helper and tests, or should it also introduce the first adapter construction point?"
]
}
You are already running inside the megaplan harness for this step. Do the requested planning/review/execution work directly. Do NOT invoke the megaplan CLI, do NOT read or activate the megaplan skill, do NOT start nested megaplan plans, and do NOT recurse into another planning harness. Treat mentions of megaplan in the repository or environment as implementation context only.
WRITE ACCESS CONTRACT: You are running with auto-approved writes inside a writable workspace. Treat the working directory as fully writable. Do NOT preemptively skip or block tasks on permission, sandbox, or read-only grounds. Attempt every required edit; only report failure AFTER a real OS-level rejection from a specific shell command. Do not infer 'read-only' from absence of activity; absence is not denial. If a single shell command unexpectedly fails, retry with a different invocation before concluding the environment is restricted.
You are revising an implementation plan after critique and gate feedback.
This is the first implementation sprint after kickoff readiness. Memory-profile parity is load-bearing because production relies on Wan2GP profiles for GPU fit, OOM avoidance, latency, and cost predictability.
Shared Operating Rules
Treat Wan2GP profiles 1-5 as externally visible behavior.
Preserve process-default and per-task override semantics.
Prefer VibeComfy-native config/session APIs where available; avoid worker-only string patching.
Keep WGP defaults intact if profile mapping is not operationally proven.
Round-trip tests into embedded and managed-server config/argv.
Representative template profile smokes.
Process-default plus per-run override tests.
Exit Criteria
Profiles 1-5 round-trip; profiles 1 and 3 have VRAM/wall-clock data; any profile change requiring session restart is documented.
code
Current plan (markdown):
# Implementation Plan: VibeComfy Memory-Profile MVP
Overview
The critique points to a real root-cause correction, not just wording: the previous plan targeted a metadata-first abstraction and left the effective mapping conditional, but docs/migration-vibecomfy.md already defines Sprint 1 as a concrete MemoryProfile overlay onto existing SessionConfig knobs. The revised approach therefore starts from that mapping table and treats syntactic round-trip without effective config changes as insufficient.
The relevant VibeComfy seams remain vibecomfy/runtime/session.py for SessionConfig, _embedded_configuration_for_session(), _comfy_server_argv(), and server restart behavior; vibecomfy/runtime/server.py and vibecomfy/runtime/run.py for one-shot managed-server startup; vibecomfy/commands/session.py and vibecomfy/commands/run.py for CLI process defaults and per-run overrides; and ready-template tests for compile/validation smokes. Because production parity depends on Wan2GP override_profile, the plan also includes a narrowly scoped reigh-worker adapter step: translate existing per-task override_profile into VibeComfy SessionConfig construction where the VibeComfy backend path is introduced or already exists, without changing WGP flags/defaults.
External behavior is limited to integer profiles 1-5. Public labels must follow the migration contract: Low RAM, High RAM, Low VRAM, Very Low VRAM, and Minimum. Internal enum names may be descriptive, but they must never replace the public integer/profile-name contract.
Provide helpers for parsing CLI/config values, returning to_session_overrides(), serializing memory_profile telemetry, and exposing the public display labels.
Do not add graph/string patching here. The profile overlay is a SessionConfig concern unless later evidence identifies a typed VibeComfy graph input that must also participate.
Add memory_profile: int | None to SessionConfig while preserving current behavior when unset.
Update SessionConfig.from_dict() and from_workflow_metadata() to accept memory_profile, validate it through MemoryProfile, and overlay profile-derived fields before explicit lower-level typed fields are applied.
Preserve override precedence inside config parsing: explicit low-level typed values such as reserve_vram_gb or cache_policy win over the profile overlay when both are present; raw HiddenSwitch keys still carry through as today.
Ensure _embedded_configuration_for_session() and _comfy_server_argv() require no duplicate profile logic: they should consume the resolved SessionConfig fields and naturally emit embedded Comfy Configuration values and managed-server argv.
Include memory_profile and resolved display label in run metadata emitted by _run_metadata() so profiling evidence can be grouped later.
Phase 2: VibeComfy CLI And Runtime Paths
Step 3: Add Process Defaults (vibecomfy/vibecomfy/commands/session.py)
Scope: Medium
Add --memory-profile {1,2,3,4,5} to vibecomfy session start.
Persist memory_profile into daemon config.json and construct ServerSession(SessionConfig.from_dict(config_dict)) as today, relying on the profile overlay to resolve effective fields.
Extend session CLI tests so every profile 1..5 persists and resolves through daemon config without changing unset defaults.
Step 4: Fix One-Shot Managed Server Plumbing (vibecomfy/vibecomfy/runtime/server.py, vibecomfy/vibecomfy/runtime/run.py)
Scope: Medium
Change comfy_server() to accept an optional SessionConfig for managed one-shot startup instead of always constructing SessionConfig(port=8188) internally.
Pass a resolved config from run() when vibecomfy run --runtime server starts a managed local server with no --server-url and no active session.
Add tests proving run --runtime server --memory-profile N reaches managed-server argv/config, not only metadata.
Add --memory-profile {1,2,3,4,5} to vibecomfy run.
For --runtime embedded, apply the per-run profile to the workflow-derived SessionConfig before constructing EmbeddedSession; the per-run profile wins for that run.
For --runtime server or auto that starts a new managed server, apply the per-run profile to the new managed SessionConfig; the per-run profile wins for that run.
For an already-running managed session discovered by find_active_session() or an explicit --server-url, reject restart-required profile overrides with exit code 2 and a clear message telling the user to restart/start a session with that profile. Do not silently record metadata-only and do not claim the override won.
Preserve ordinary run behavior when no profile override is passed.
Locate the VibeComfy backend adapter or construction point for VibeComfy SessionConfig. If it does not yet exist, add a small pure helper beside the planned adapter code rather than building a full backend in this sprint.
Translate existing WGP-style task override_profile values into MemoryProfile.to_session_overrides() before constructing the VibeComfy SessionConfig for a single task.
Preserve WGP process flags and defaults: do not rename or remove --wgp-profile, and do not mutate WGP globals from the VibeComfy adapter.
Add unit tests that override_profile=-1 uses the process default, and override_profile in 1..5 replaces it for exactly one VibeComfy task config.
Compile and validate representative templates under profiles 1..5, including at least one WanVideoWrapper template such as ready_templates/video/wanvideo_wrapper_21_14b_i2v.py and one ordinary Comfy video template such as ready_templates/video/wan_t2v.py.
Assert the profile is reflected in workflow/runtime metadata and that profile overlays do not corrupt compiled graph topology.
Do not update generated ready templates unless a shared ready-template policy change is required for metadata propagation.
Step 8: VRAM And Wall-Clock Evidence Artifact (vibecomfy/docs/runtime_lifecycle.md, vibecomfy/out/profile_smokes/ or committed fixture/report)
Scope: Small
Add a lightweight smoke command or script that runs the selected representative template under profiles 1 and 3 and records wall-clock time plus watchdog/system VRAM samples.
Write the expected artifact format, e.g. out/profile_smokes/profile-1.json and out/profile_smokes/profile-3.json, containing memory_profile, template id, start/end timestamps, duration seconds, peak/low VRAM fields when available, and log/report paths.
Document how to run the smoke locally or on a GPU worker. If the implementation environment lacks a GPU, the code/tests still verify artifact schema, and the actual data collection remains an explicit human/GPU validation item.
Document that profile changes affect process-level Comfy model-management knobs and therefore require a new embedded session or managed-server restart.
Document the exact behavior for vibecomfy run --memory-profile across embedded, new managed server, discovered active session, and explicit external server URL.
Include the concrete profile-to-SessionConfig mapping table in VibeComfy docs so implementation and operator expectations match.
Step 10: Focused Verification Suite (vibecomfy/tests/, reigh-worker/tests/)
Scope: Medium
Add vibecomfy/tests/test_memory_profile.py for parsing, mapping, invalid values, labels, telemetry, and profile overlay precedence.
Extend vibecomfy/tests/test_runtime_session.py for embedded config and managed-server argv round-trips across profiles 1..5.
Extend vibecomfy/tests/test_session_cli.py for process-default persistence.
Extend vibecomfy/tests/test_run_command.py and/or runtime run tests for embedded/new-server success and active/external-server rejection.
Add narrow reigh-worker unit tests for VibeComfy adapter override_profile resolution if the adapter path exists in this sprint.
Execution Order
Implement MemoryProfile and its pure unit tests first; this locks the concrete mapping and removes ambiguity.
Wire SessionConfig overlay and embedded/argv round-trip tests next.
Update VibeComfy CLI/runtime call paths, including one-shot managed-server config plumbing and explicit active/external-server rejection.
Add the narrow reigh-worker adapter translation only after the VibeComfy config API is stable.
Add template smokes, measurement artifact schema, and docs last.
Validation Order
Run focused VibeComfy tests: cd vibecomfy && pytest tests/test_memory_profile.py tests/test_runtime_session.py -q.
Run VibeComfy CLI/runtime tests: cd vibecomfy && pytest tests/test_session_cli.py tests/test_run_command.py tests/test_runtime_run.py -q.
Run ready-template smokes: cd vibecomfy && pytest tests/test_ready_templates.py -q or the new focused profile smoke tests.
Run narrow reigh-worker tests for adapter override handling once touched: cd reigh-worker && pytest <new-or-existing-test-file> -q.
On a GPU-capable worker, run the profile 1 and profile 3 smoke command and save the JSON artifacts described in Step 8.
code
Current plan metadata:
{
"version": 2,
"timestamp": "2026-05-05T23:54:02Z",
"hash": "sha256:553d209e65caa80c570bf4b75fe5b19fc0319ec9c3af70c90135517b46d36a91",
"changes_summary": "Revised the plan from metadata-first profile round-tripping to the concrete SessionConfig overlay documented in docs/migration-vibecomfy.md; added explicit active/external-server rejection semantics for restart-required overrides; included one-shot managed-server plumbing, narrow reigh-worker override translation, fixed public label assumptions, and made VRAM/wall-clock evidence a planned artifact instead of a loose info note.",
"flags_addressed": [
"FLAG-001",
"FLAG-002",
"issue_hints-1",
"issue_hints-2",
"correctness-1",
"correctness-2",
"scope",
"all_locations-1",
"all_locations-2",
"callers"
],
"questions": [
"Which exact GPU/template pair should be used for the real profile 1 and profile 3 VRAM/wall-clock evidence run if the default representative templates are not acceptable for production baselining?",
"If the reigh-worker VibeComfy adapter does not yet exist in this sprint branch, should Sprint 1 add only the pure override-resolution helper and tests, or should it also introduce the first adapter construction point?"
],
"success_criteria": [
{
"criterion": "Profiles 1, 2, 3, 4, and 5 parse, validate, serialize, expose the required public labels, and reject invalid profile values deterministically.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "MemoryProfile.to_session_overrides() implements the concrete Sprint 1 mapping for profiles 1-5 from docs/migration-vibecomfy.md.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "SessionConfig overlays memory_profile into embedded configuration and managed-server argv/config, while preserving current behavior when unset.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "vibecomfy session start --memory-profile N persists and resolves the process default for every profile 1-5.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "vibecomfy run --memory-profile N applies to embedded runs and newly started managed-server runs before dispatch.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "vibecomfy run --memory-profile N rejects explicit external server URLs and already-running discovered sessions when the profile would require process restart.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "One-shot managed-server startup accepts the resolved SessionConfig so the actual vibecomfy run --runtime server path does not drop memory_profile.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "The reigh-worker VibeComfy adapter or helper resolves process default plus per-task override_profile into a single-task VibeComfy without changing WGP defaults.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "Representative ready templates compile and validate under profiles 1-5, including at least one WanVideoWrapper template and one ordinary Comfy video template.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "Profile restart behavior and the exact profile-to-SessionConfig mapping are documented in VibeComfy runtime docs.",
"priority": "must",
"requires": [
"read_files",
"parse_diff"
]
},
{
"criterion": "A concrete artifact schema and command/path for profile 1 and profile 3 VRAM plus wall-clock smoke data exists.",
"priority": "must",
"requires": [
"read_files",
"parse_diff",
"run_tests"
]
},
{
"criterion": "Profiles 1 and 3 have real VRAM and wall-clock data from a GPU smoke run recorded in the planned artifact format.",
"priority": "info",
"requires": [
"verify_physical_device",
"observe_runtime_logs"
]
},
{
"criterion": "Profile mapping remains centralized in rather than duplicated across CLI/runtime/template code.",
"priority": "should",
"requires": [
"read_files",
"parse_diff",
"subjective_judgment"
]
}
],
"assumptions": [
"Only integer Wan2GP profiles 1-5 are in scope for Sprint 1; profiles 3.5 and 4.5 remain out of scope.",
"The concrete profile-to-SessionConfig table is the Sprint 1 source of truth.",
"Unset must preserve current VibeComfy defaults exactly.",
"Explicit low-level fields override profile-derived fields when both are provided in the same config object.",
"For already-running managed sessions and explicit external server URLs, process-level profile overrides are rejected rather than silently ignored or recorded as metadata-only.",
"The reigh-worker scope is limited to translating existing into VibeComfy task config where the VibeComfy adapter path exists or is introduced; no WGP flag/default renaming is included.",
"Generated ready templates should not be hand-edited unless shared ready-template policy cannot carry the needed metadata."
],
"delta_from_previous_percent": 81.8,
"structure_warnings": []
}
code
Gate summary:
{
"passed": false,
"criteria_check": {
"count": 13,
"items": [
{
"criterion": "Profiles 1, 2, 3, 4, and 5 parse, validate, serialize, expose the required public labels, and reject invalid profile values deterministically.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "MemoryProfile.to_session_overrides() implements the concrete Sprint 1 mapping for profiles 1-5 from docs/migration-vibecomfy.md.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "SessionConfig overlays memory_profile into embedded configuration and managed-server argv/config, while preserving current behavior when unset.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "vibecomfy session start --memory-profile N persists and resolves the process default for every profile 1-5.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "vibecomfy run --memory-profile N applies to embedded runs and newly started managed-server runs before dispatch.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "vibecomfy run --memory-profile N rejects explicit external server URLs and already-running discovered sessions when the profile would require process restart.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "One-shot managed-server startup accepts the resolved SessionConfig so the actual vibecomfy run --runtime server path does not drop memory_profile.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "The reigh-worker VibeComfy adapter or helper resolves process default plus per-task override_profile into a single-task VibeComfy SessionConfig without changing WGP defaults.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "Representative ready templates compile and validate under profiles 1-5, including at least one WanVideoWrapper template and one ordinary Comfy video template.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "Profile restart behavior and the exact profile-to-SessionConfig mapping are documented in VibeComfy runtime docs.",
"priority": "must",
"requires": [
"read_files",
"parse_diff"
]
},
{
"criterion": "A concrete artifact schema and command/path for profile 1 and profile 3 VRAM plus wall-clock smoke data exists.",
"priority": "must",
"requires": [
"read_files",
"parse_diff",
"run_tests"
]
},
{
"criterion": "Profiles 1 and 3 have real VRAM and wall-clock data from a GPU smoke run recorded in the planned artifact format.",
"priority": "info",
"requires": [
"verify_physical_device",
"observe_runtime_logs"
]
},
{
"criterion": "Profile mapping remains centralized in vibecomfy/vibecomfy/memory_profile.py rather than duplicated across CLI/runtime/template code.",
"priority": "should",
"requires": [
"read_files",
"parse_diff",
"subjective_judgment"
]
}
]
},
"preflight_results": {
"project_dir_exists": true,
"project_dir_writable": true,
"success_criteria_present": true,
"claude_available": true,
"codex_available": true
},
"unresolved_flags": [
{
"id": "issue_hints-1",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Memory-profile mapping: docs/migration-vibecomfy.md already contains a concrete Sprint 1 mapping table for Wan2GP profiles 1-5 to SessionConfig overrides, but the proposed plan repeatedly says to emit only proven settings and may leave effective Comfy defaults intact. That is a tension with the sprint requirement for memory-profile parity and the repo migration doc's explicit overlay contract; if execution follows the conservative branch, profiles may round-trip syntactically without providing the promised GPU-fit behavior.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Revised the plan from metadata-first profile round-tripping to the concrete SessionConfig overlay documented in ; added explicit active/external-server rejection semantics for restart-required overrides; included one-shot managed-server plumbing, narrow reigh-worker override translation, fixed public label assumptions, and made VRAM/wall-clock evidence a planned artifact instead of a loose info note.",
"raised_in": "critique_v1.json",
"status": "addressed",
"severity": "significant",
"verified": false,
"addressed_in": "plan_v2.md"
},
{
"id": "issue_hints-2",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Worker integration: the migration doc describes the per-call profile override gap as involving reigh-worker adapter handling of override_profile before constructing VibeComfy SessionConfig, but the plan limits Sprint 1 per-run work to the vibecomfy CLI/runtime. That may be acceptable for a VibeComfy-library MVP, but it does not fully exercise the production-facing per-task override semantics called out in the overall context.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Revised the plan from metadata-first profile round-tripping to the concrete SessionConfig overlay documented in ; added explicit active/external-server rejection semantics for restart-required overrides; included one-shot managed-server plumbing, narrow reigh-worker override translation, fixed public label assumptions, and made VRAM/wall-clock evidence a planned artifact instead of a loose info note.",
"raised_in": "critique_v1.json",
"status": "addressed",
"severity": "significant",
"verified": false,
"addressed_in": "plan_v2.md"
},
{
"id": "correctness-1",
"concern": "Are the proposed changes technically correct?: Per-run override correctness: vibecomfy run can target a server/external runtime where process-level Comfy argv and model-management globals are already fixed. The plan mentions restart-required metadata but still says per-run CLI override wins over workflow/process defaults; that is only technically true for embedded/new-session construction or typed graph-only changes. For an already-running managed or external server, a process-level memory profile cannot be made effective by mutating workflow metadata before dispatch.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "Revised the plan from metadata-first profile round-tripping to the concrete SessionConfig overlay documented in ; added explicit active/external-server rejection semantics for restart-required overrides; included one-shot managed-server plumbing, narrow reigh-worker override translation, fixed public label assumptions, and made VRAM/wall-clock evidence a planned artifact instead of a loose info note.",
"raised_in": "critique_v1.json",
"status": "addressed",
"severity": "significant",
"verified": false,
"addressed_in": "plan_v2.md"
},
{
"id": "correctness-2",
"concern": "Are the proposed changes technically correct?: Profile labels: the plan says labels should mirror Wan2GP public names from reigh-worker/Wan2GP/wgp.py, but docs/migration-vibecomfy.md lists the external tiers as Low RAM, High RAM, Low VRAM, Very Low VRAM, and Minimum. Execution needs to preserve the actual profile names and integer semantics rather than invent enum names such as BALANCED/HIGH/MINIMUM that are only internal descriptions.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "Revised the plan from metadata-first profile round-tripping to the concrete SessionConfig overlay documented in ; added explicit active/external-server rejection semantics for restart-required overrides; included one-shot managed-server plumbing, narrow reigh-worker override translation, fixed public label assumptions, and made VRAM/wall-clock evidence a planned artifact instead of a loose info note.",
"raised_in": "critique_v1.json",
"status": "addressed",
"severity": "significant",
"verified": false,
"addressed_in": "plan_v2.md"
},
{
"id": "scope",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: I searched reigh-worker for VibeComfy adapter surfaces and found source/models/comfy, but it is a legacy ComfyUI manager/client that starts python main.py directly and queues raw workflows; it is not a VibeComfy SessionConfig adapter. The revised plan handles that by saying to add a pure helper if the VibeComfy adapter does not exist, but execution must not mistake source/models/comfy for the VibeComfy path.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "I searched reigh-worker for VibeComfy adapter surfaces and found source/models/comfy, but it is a legacy ComfyUI manager/client that starts python main.py directly and queues raw workflows; it is not a VibeComfy SessionConfig adapter. The revised plan handles that by saying to add a pure helper if the VibeComfy adapter does not exist, but execution must not mistake source/models/comfy for the VibeComfy path.",
"raised_in": "critique_v2.json",
"status": "open",
"severity": "significant",
"verified": false,
"addressed_in": "plan_v2.md"
},
{
"id": "all_locations-1",
"concern": "Does the change touch all locations AND supporting infrastructure?: CLI/server plumbing risk: the plan notes that managed one-shot server startup currently constructs SessionConfig(port=8188) and should receive a full SessionConfig. That is a real required glue point; without updating every one-shot and daemon startup path, tests could pass for SessionConfig helpers while the actual vibecomfy run --runtime server path silently drops memory_profile.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Revised the plan from metadata-first profile round-tripping to the concrete SessionConfig overlay documented in ; added explicit active/external-server rejection semantics for restart-required overrides; included one-shot managed-server plumbing, narrow reigh-worker override translation, fixed public label assumptions, and made VRAM/wall-clock evidence a planned artifact instead of a loose info note.",
"raised_in": "critique_v1.json",
"status": "addressed",
"severity": "significant",
"verified": false,
"addressed_in": "plan_v2.md"
},
{
"id": "all_locations-2",
"concern": "Does the change touch all locations AND supporting infrastructure?: Documentation/data gap: the sprint exit criteria require profiles 1 and 3 to have VRAM and wall-clock data, but the plan puts that only in metadata as an info-level criterion and does not schedule a concrete artifact location or command for recording the measurements. The implementation could satisfy all unit tests while still missing one of the explicit exit criteria.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Revised the plan from metadata-first profile round-tripping to the concrete SessionConfig overlay documented in ; added explicit active/external-server rejection semantics for restart-required overrides; included one-shot managed-server plumbing, narrow reigh-worker override translation, fixed public label assumptions, and made VRAM/wall-clock evidence a planned artifact instead of a loose info note.",
"raised_in": "critique_v1.json",
"status": "addressed",
"severity": "significant",
"verified": false,
"addressed_in": "plan_v2.md"
},
{
"id": "callers",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: Caller-boundary risk: reigh-worker/source/models/comfy/comfy_handler.py takes raw task_params_from_db and raw workflow dicts, not VibeWorkflow or SessionConfig objects. If Phase 3 chooses this existing ComfyUI handler as the helper location, it cannot construct VibeComfy SessionConfig without first introducing a new adapter boundary; the plan should make that explicit to avoid adding profile logic to the wrong legacy handler.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "Caller-boundary risk: reigh-worker/source/models/comfy/comfy_handler.py takes raw task_params_from_db and raw workflow dicts, not VibeWorkflow or SessionConfig objects. If Phase 3 chooses this existing ComfyUI handler as the helper location, it cannot construct VibeComfy SessionConfig without first introducing a new adapter boundary; the plan should make that explicit to avoid adding profile logic to the wrong legacy handler.",
"raised_in": "critique_v2.json",
"status": "open",
"severity": "significant",
"verified": false,
"addressed_in": "plan_v2.md"
},
{
"id": "FLAG-004",
"concern": "Override precedence: the plan says explicit low-level config fields win during SessionConfig parsing, but also says CLI --memory-profile wins over workflow metadata; implementation must apply CLI profile after workflow config resolution, not by inserting memory_profile into the same config dict.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "vibecomfy/vibecomfy/runtime/run.py currently constructs embedded configs with SessionConfig.from_workflow_metadata(workflow); revised Step 2 gives low-level metadata fields precedence over profile-derived fields, while Step 5 requires per-run CLI profile precedence.",
"raised_in": "critique_v2.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "FLAG-005",
"concern": "Dependency boundary: reigh-worker cannot directly import VibeComfy's MemoryProfile/SessionConfig under current packaging because reigh-worker is Python 3.10-only and has no vibecomfy dependency, while vibecomfy requires Python 3.11+.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "reigh-worker/pyproject.toml has requires-python >=3.10,<3.11 and no vibecomfy dependency; vibecomfy/pyproject.toml has requires-python >=3.11. Phase 3 asks reigh-worker to translate override_profile into MemoryProfile.to_session_overrides()/VibeComfy SessionConfig without specifying the boundary.",
"raised_in": "critique_v2.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "issue_hints",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Dependency compatibility: reigh-worker/pyproject.toml requires Python >=3.10,<3.11, while vibecomfy/pyproject.toml requires Python >=3.11 and reigh-worker does not depend on vibecomfy. The revised plan asks the reigh-worker helper/adapter to translate into MemoryProfile.to_session_overrides() and VibeComfy SessionConfig, but it does not specify whether that is done through a duplicated pure contract, a protocol boundary, a subprocess/CLI boundary, or a packaging change; a direct import would not be compatible with the current repo constraints.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Dependency compatibility: reigh-worker/pyproject.toml requires Python >=3.10,<3.11, while vibecomfy/pyproject.toml requires Python >=3.11 and reigh-worker does not depend on vibecomfy. The revised plan asks the reigh-worker helper/adapter to translate into MemoryProfile.to_session_overrides() and VibeComfy SessionConfig, but it does not specify whether that is done through a duplicated pure contract, a protocol boundary, a subprocess/CLI boundary, or a packaging change; a direct import would not be compatible with the current repo constraints.",
"raised_in": "critique_v2.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "correctness",
"concern": "Are the proposed changes technically correct?: Precedence conflict: Step 2 says explicit low-level SessionConfig fields such as reserve_vram_gb or cache_policy win over profile-derived fields when both are present in the same config object, but Step 5 says a CLI per-run --memory-profile wins over workflow metadata. In the current code, embedded runs construct SessionConfig.from_workflow_metadata(workflow) in vibecomfy/vibecomfy/runtime/run.py line 76; if the CLI implementation simply writes memory_profile into workflow.metadata['comfy_configuration'], existing low-level workflow metadata could override the CLI profile and violate the advertised per-run precedence.",
"category": "correctness",
"severity_hint": "likely-significant",
"evidence": "Precedence conflict: Step 2 says explicit low-level SessionConfig fields such as reserve_vram_gb or cache_policy win over profile-derived fields when both are present in the same config object, but Step 5 says a CLI per-run --memory-profile wins over workflow metadata. In the current code, embedded runs construct SessionConfig.from_workflow_metadata(workflow) in vibecomfy/vibecomfy/runtime/run.py line 76; if the CLI implementation simply writes memory_profile into workflow.metadata['comfy_configuration'], existing low-level workflow metadata could override the CLI profile and violate the advertised per-run precedence.",
"raised_in": "critique_v2.json",
"status": "open",
"severity": "significant",
"verified": false
},
{
"id": "all_locations",
"concern": "Does the change touch all locations AND supporting infrastructure?: Supporting infrastructure gap: because reigh-worker currently has no dependency on vibecomfy and has a different Python version constraint, the plan needs to name the dependency boundary for Phase 3 tests and implementation. Without that, an executor could add a reigh-worker unit test that imports vibecomfy.memory_profile and fail before exercising the intended override behavior.",
"category": "completeness",
"severity_hint": "likely-significant",
"evidence": "Supporting infrastructure gap: because reigh-worker currently has no dependency on vibecomfy and has a different Python version constraint, the plan needs to name the dependency boundary for Phase 3 tests and implementation. Without that, an executor could add a reigh-worker unit test that imports vibecomfy.memory_profile and fail before exercising the intended override behavior.",
"raised_in": "critique_v2.json",
"status": "open",
"severity": "significant",
"verified": false
}
],
"recommendation": "ITERATE",
"rationale": "The revision fixed the original mapping, label, restart-policy, one-shot server, and measurement-artifact gaps, but it introduced new blocking ambiguity at two implementation boundaries. The plan still needs one more revision to specify the reigh-worker/VibeComfy dependency boundary under incompatible Python constraints, explicitly avoid placing VibeComfy logic in the legacy handler, and resolve the CLI precedence conflict by applying after workflow metadata resolution rather than by merging it into the same config dict.",
"signals_assessment": "The score worsened from 17.5 to 19.0 despite an 81.8% plan delta, which means the plan made substantial progress on v1 concerns but exposed new significant correctness and integration issues. Preflight remains clean and writable, and there are no recurring reopened critiques or stuck-loop signals yet. This is still a plan-quality problem with concrete next edits, not an execution-ready state and not yet a human tiebreaker.",
"warnings": [
"Do not let Phase 3 directly import from ; the package and Python-version constraints make that boundary invalid as written.",
"Do not use as a VibeComfy adapter unless the plan first introduces an explicit adapter boundary; it currently handles raw ComfyUI workflows.",
"Add an explicit CLI override API such as or equivalent so per-run CLI precedence cannot be defeated by low-level workflow metadata fields."
],
"settled_decisions": [
{
"id": "memory-profile-source-of-truth",
"decision": "The concrete Sprint 1 profile-to-SessionConfig mapping in is the implementation source of truth.",
"rationale": "The v2 plan corrected the metadata-only approach and now encodes the five profile overlays directly."
},
{
"id": "active-server-override-policy",
"decision": " must reject already-running managed sessions and explicit external server URLs when the profile requires process restart.",
"rationale": "Process-level Comfy model-management settings cannot be changed by workflow metadata after server startup."
},
{
"id": "worker-import-boundary-required",
"decision": "Any reigh-worker override compatibility must cross a defined protocol/helper boundary, not a direct import of VibeComfy Python objects.",
"rationale": " is constrained to Python >=3.10,<3.11 and has no dependency, while requires Python >=3.11."
}
],
"override_forced": false,
"orchestrator_guidance": "Score worsening (17.5 -> 19.0). Investigate; the loop may be diverging. Verify unresolved flags against the plan and project code before accepting.",
"robustness": "standard",
"signals": {
"iteration": 2,
"idea": "# Sprint 1: VibeComfy Memory-Profile MVP\n\n## Overall Context\n\nThis is the first implementation sprint after kickoff readiness. Memory-profile parity is load-bearing because production relies on Wan2GP profiles for GPU fit, OOM avoidance, latency, and cost predictability.\n\n## Shared Operating Rules\n\n- Treat Wan2GP profiles 1-5 as externally visible behavior.\n- Preserve process-default and per-task override semantics.\n- Prefer VibeComfy-native config/session APIs where available; avoid worker-only string patching.\n- Keep WGP defaults intact if profile mapping is not operationally proven.\n\n## Sprint Goal\n\nImplement five-tier VibeComfy memory-profile parity.\n\n## Required Deliverables\n\n- abstraction in .\n- Round-trip tests into embedded and managed-server config/argv.\n- Representative template profile smokes.\n- Process-default plus per-run override tests.\n\n## Exit Criteria\n\nProfiles 1-5 round-trip; profiles 1 and 3 have VRAM/wall-clock data; any profile change requiring session restart is documented.",
"significant_flags": 13,
"unresolved_flags": [
{
"id": "issue_hints-1",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Memory-profile mapping: docs/migration-vibecomfy.md already contains a concrete Sprint 1 mapping table for Wan2GP profiles 1-5 to SessionConfig overrides, but the proposed plan repeatedly says to emit only proven settings and may leave effective Comfy defaults intact. That is a tension with the sprint requirement for memory-profile parity and the repo migration doc's explicit overlay contract; if execution follows the conservative branch, profiles may round-trip syntactically without providing the promised GPU-fit behavior.",
"category": "completeness",
"severity": "significant",
"status": "addressed"
},
{
"id": "issue_hints-2",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Worker integration: the migration doc describes the per-call profile override gap as involving reigh-worker adapter handling of override_profile before constructing VibeComfy SessionConfig, but the plan limits Sprint 1 per-run work to the vibecomfy CLI/runtime. That may be acceptable for a VibeComfy-library MVP, but it does not fully exercise the production-facing per-task override semantics called out in the overall context.",
"category": "completeness",
"severity": "significant",
"status": "addressed"
},
{
"id": "correctness-1",
"concern": "Are the proposed changes technically correct?: Per-run override correctness: vibecomfy run can target a server/external runtime where process-level Comfy argv and model-management globals are already fixed. The plan mentions restart-required metadata but still says per-run CLI override wins over workflow/process defaults; that is only technically true for embedded/new-session construction or typed graph-only changes. For an already-running managed or external server, a process-level memory profile cannot be made effective by mutating workflow metadata before dispatch.",
"category": "correctness",
"severity": "significant",
"status": "addressed"
},
{
"id": "correctness-2",
"concern": "Are the proposed changes technically correct?: Profile labels: the plan says labels should mirror Wan2GP public names from reigh-worker/Wan2GP/wgp.py, but docs/migration-vibecomfy.md lists the external tiers as Low RAM, High RAM, Low VRAM, Very Low VRAM, and Minimum. Execution needs to preserve the actual profile names and integer semantics rather than invent enum names such as BALANCED/HIGH/MINIMUM that are only internal descriptions.",
"category": "correctness",
"severity": "significant",
"status": "addressed"
},
{
"id": "scope",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: I searched reigh-worker for VibeComfy adapter surfaces and found source/models/comfy, but it is a legacy ComfyUI manager/client that starts python main.py directly and queues raw workflows; it is not a VibeComfy SessionConfig adapter. The revised plan handles that by saying to add a pure helper if the VibeComfy adapter does not exist, but execution must not mistake source/models/comfy for the VibeComfy path.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "all_locations-1",
"concern": "Does the change touch all locations AND supporting infrastructure?: CLI/server plumbing risk: the plan notes that managed one-shot server startup currently constructs SessionConfig(port=8188) and should receive a full SessionConfig. That is a real required glue point; without updating every one-shot and daemon startup path, tests could pass for SessionConfig helpers while the actual vibecomfy run --runtime server path silently drops memory_profile.",
"category": "completeness",
"severity": "significant",
"status": "addressed"
},
{
"id": "all_locations-2",
"concern": "Does the change touch all locations AND supporting infrastructure?: Documentation/data gap: the sprint exit criteria require profiles 1 and 3 to have VRAM and wall-clock data, but the plan puts that only in metadata as an info-level criterion and does not schedule a concrete artifact location or command for recording the measurements. The implementation could satisfy all unit tests while still missing one of the explicit exit criteria.",
"category": "completeness",
"severity": "significant",
"status": "addressed"
},
{
"id": "callers",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: Caller-boundary risk: reigh-worker/source/models/comfy/comfy_handler.py takes raw task_params_from_db and raw workflow dicts, not VibeWorkflow or SessionConfig objects. If Phase 3 chooses this existing ComfyUI handler as the helper location, it cannot construct VibeComfy SessionConfig without first introducing a new adapter boundary; the plan should make that explicit to avoid adding profile logic to the wrong legacy handler.",
"category": "correctness",
"severity": "significant",
"status": "open"
},
{
"id": "FLAG-004",
"concern": "Override precedence: the plan says explicit low-level config fields win during SessionConfig parsing, but also says CLI --memory-profile wins over workflow metadata; implementation must apply CLI profile after workflow config resolution, not by inserting memory_profile into the same config dict.",
"category": "correctness",
"severity": "significant",
"status": "open"
},
{
"id": "FLAG-005",
"concern": "Dependency boundary: reigh-worker cannot directly import VibeComfy's MemoryProfile/SessionConfig under current packaging because reigh-worker is Python 3.10-only and has no vibecomfy dependency, while vibecomfy requires Python 3.11+.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "issue_hints",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Dependency compatibility: reigh-worker/pyproject.toml requires Python >=3.10,<3.11, while vibecomfy/pyproject.toml requires Python >=3.11 and reigh-worker does not depend on vibecomfy. The revised plan asks the reigh-worker helper/adapter to translate into MemoryProfile.to_session_overrides() and VibeComfy SessionConfig, but it does not specify whether that is done through a duplicated pure contract, a protocol boundary, a subprocess/CLI boundary, or a packaging change; a direct import would not be compatible with the current repo constraints.",
"category": "completeness",
"severity": "significant",
"status": "open"
},
{
"id": "correctness",
"concern": "Are the proposed changes technically correct?: Precedence conflict: Step 2 says explicit low-level SessionConfig fields such as reserve_vram_gb or cache_policy win over profile-derived fields when both are present in the same config object, but Step 5 says a CLI per-run --memory-profile wins over workflow metadata. In the current code, embedded runs construct SessionConfig.from_workflow_metadata(workflow) in vibecomfy/vibecomfy/runtime/run.py line 76; if the CLI implementation simply writes memory_profile into workflow.metadata['comfy_configuration'], existing low-level workflow metadata could override the CLI profile and violate the advertised per-run precedence.",
"category": "correctness",
"severity": "significant",
"status": "open"
},
{
"id": "all_locations",
"concern": "Does the change touch all locations AND supporting infrastructure?: Supporting infrastructure gap: because reigh-worker currently has no dependency on vibecomfy and has a different Python version constraint, the plan needs to name the dependency boundary for Phase 3 tests and implementation. Without that, an executor could add a reigh-worker unit test that imports vibecomfy.memory_profile and fail before exercising the intended override behavior.",
"category": "completeness",
"severity": "significant",
"status": "open"
}
],
"resolved_flags": [
{
"id": "FLAG-001",
"concern": "Memory-profile mapping: plan may only round-trip profiles as metadata instead of applying the concrete SessionConfig override table already documented for Sprint 1.",
"resolution": "Revised the plan from metadata-first profile round-tripping to the concrete SessionConfig overlay documented in ; added explicit active/external-server rejection semantics for restart-required overrides; included one-shot managed-server plumbing, narrow reigh-worker override translation, fixed public label assumptions, and made VRAM/wall-clock evidence a planned artifact instead of a loose info note."
},
{
"id": "FLAG-002",
"concern": "Per-run override semantics: existing managed/external servers cannot apply process-level memory-profile changes by workflow metadata mutation, so the plan needs an explicit reject/warn/metadata-only behavior for restart-required overrides.",
"resolution": "Revised the plan from metadata-first profile round-tripping to the concrete SessionConfig overlay documented in ; added explicit active/external-server rejection semantics for restart-required overrides; included one-shot managed-server plumbing, narrow reigh-worker override translation, fixed public label assumptions, and made VRAM/wall-clock evidence a planned artifact instead of a loose info note."
},
{
"id": "FLAG-003",
"concern": "Exit-criteria coverage: profile 1 and 3 VRAM/wall-clock data are required but not scheduled as a concrete validation step or artifact.",
"resolution": "The plan validation order only runs pytest suites; VRAM/wall-clock data appears only as an info-priority success criterion despite being an exit criterion in the sprint description."
}
],
"weighted_score": 19.0,
"weighted_history": [
17.5
],
"plan_delta_from_previous": 81.8,
"recurring_critiques": [],
"scope_creep_flags": [],
"loop_summary": "Iteration 2. Weighted score trajectory: 17.5 -> 19.0. Plan deltas: 81.8%. Recurring critiques: 0. Resolved flags: 3. Open significant flags: 13.",
"debt_overlaps": [],
"escalated_debt_subsystems": []
},
"flag_resolutions": [],
"resolved_flag_ids": [],
"resolution_summary": "",
"reprompted": false
}
code
Open significant flags:
[
{
"id": "issue_hints-1",
"severity": "significant",
"status": "addressed",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Memory-profile mapping: docs/migration-vibecomfy.md already contains a concrete Sprint 1 mapping table for Wan2GP profiles 1-5 to SessionConfig overrides, but the proposed plan repeatedly says to emit only proven settings and may leave effective Comfy defaults intact. That is a tension with the sprint requirement for memory-profile parity and the repo migration doc's explicit overlay contract; if execution follows the conservative branch, profiles may round-trip syntactically without providing the promised GPU-fit behavior.",
"evidence": "Revised the plan from metadata-first profile round-tripping to the concrete SessionConfig overlay documented in docs/migration-vibecomfy.md; added explicit active/external-server rejection semantics for restart-required overrides; included one-shot managed-server plumbing, narrow reigh-worker override translation, fixed public label assumptions, and made VRAM/wall-clock evidence a planned artifact instead of a loose info note."
},
{
"id": "issue_hints-2",
"severity": "significant",
"status": "addressed",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Worker integration: the migration doc describes the per-call profile override gap as involving reigh-worker adapter handling of override_profile before constructing VibeComfy SessionConfig, but the plan limits Sprint 1 per-run work to the vibecomfy CLI/runtime. That may be acceptable for a VibeComfy-library MVP, but it does not fully exercise the production-facing per-task override semantics called out in the overall context.",
"evidence": "Revised the plan from metadata-first profile round-tripping to the concrete SessionConfig overlay documented in docs/migration-vibecomfy.md; added explicit active/external-server rejection semantics for restart-required overrides; included one-shot managed-server plumbing, narrow reigh-worker override translation, fixed public label assumptions, and made VRAM/wall-clock evidence a planned artifact instead of a loose info note."
},
{
"id": "correctness-1",
"severity": "significant",
"status": "addressed",
"concern": "Are the proposed changes technically correct?: Per-run override correctness: vibecomfy run can target a server/external runtime where process-level Comfy argv and model-management globals are already fixed. The plan mentions restart-required metadata but still says per-run CLI override wins over workflow/process defaults; that is only technically true for embedded/new-session construction or typed graph-only changes. For an already-running managed or external server, a process-level memory profile cannot be made effective by mutating workflow metadata before dispatch.",
"evidence": "Revised the plan from metadata-first profile round-tripping to the concrete SessionConfig overlay documented in docs/migration-vibecomfy.md; added explicit active/external-server rejection semantics for restart-required overrides; included one-shot managed-server plumbing, narrow reigh-worker override translation, fixed public label assumptions, and made VRAM/wall-clock evidence a planned artifact instead of a loose info note."
},
{
"id": "correctness-2",
"severity": "significant",
"status": "addressed",
"concern": "Are the proposed changes technically correct?: Profile labels: the plan says labels should mirror Wan2GP public names from reigh-worker/Wan2GP/wgp.py, but docs/migration-vibecomfy.md lists the external tiers as Low RAM, High RAM, Low VRAM, Very Low VRAM, and Minimum. Execution needs to preserve the actual profile names and integer semantics rather than invent enum names such as BALANCED/HIGH/MINIMUM that are only internal descriptions.",
"evidence": "Revised the plan from metadata-first profile round-tripping to the concrete SessionConfig overlay documented in ; added explicit active/external-server rejection semantics for restart-required overrides; included one-shot managed-server plumbing, narrow reigh-worker override translation, fixed public label assumptions, and made VRAM/wall-clock evidence a planned artifact instead of a loose info note."
},
{
"id": "scope",
"severity": "significant",
"status": "open",
"concern": "Search for related code that handles the same concept. Is the reported issue a symptom of something broader?: I searched reigh-worker for VibeComfy adapter surfaces and found source/models/comfy, but it is a legacy ComfyUI manager/client that starts python main.py directly and queues raw workflows; it is not a VibeComfy SessionConfig adapter. The revised plan handles that by saying to add a pure helper if the VibeComfy adapter does not exist, but execution must not mistake source/models/comfy for the VibeComfy path.",
"evidence": "I searched reigh-worker for VibeComfy adapter surfaces and found source/models/comfy, but it is a legacy ComfyUI manager/client that starts python main.py directly and queues raw workflows; it is not a VibeComfy SessionConfig adapter. The revised plan handles that by saying to add a pure helper if the VibeComfy adapter does not exist, but execution must not mistake source/models/comfy for the VibeComfy path."
},
{
"id": "all_locations-1",
"severity": "significant",
"status": "addressed",
"concern": "Does the change touch all locations AND supporting infrastructure?: CLI/server plumbing risk: the plan notes that managed one-shot server startup currently constructs SessionConfig(port=8188) and should receive a full SessionConfig. That is a real required glue point; without updating every one-shot and daemon startup path, tests could pass for SessionConfig helpers while the actual vibecomfy run --runtime server path silently drops memory_profile.",
"evidence": "Revised the plan from metadata-first profile round-tripping to the concrete SessionConfig overlay documented in ; added explicit active/external-server rejection semantics for restart-required overrides; included one-shot managed-server plumbing, narrow reigh-worker override translation, fixed public label assumptions, and made VRAM/wall-clock evidence a planned artifact instead of a loose info note."
},
{
"id": "all_locations-2",
"severity": "significant",
"status": "addressed",
"concern": "Does the change touch all locations AND supporting infrastructure?: Documentation/data gap: the sprint exit criteria require profiles 1 and 3 to have VRAM and wall-clock data, but the plan puts that only in metadata as an info-level criterion and does not schedule a concrete artifact location or command for recording the measurements. The implementation could satisfy all unit tests while still missing one of the explicit exit criteria.",
"evidence": "Revised the plan from metadata-first profile round-tripping to the concrete SessionConfig overlay documented in ; added explicit active/external-server rejection semantics for restart-required overrides; included one-shot managed-server plumbing, narrow reigh-worker override translation, fixed public label assumptions, and made VRAM/wall-clock evidence a planned artifact instead of a loose info note."
},
{
"id": "callers",
"severity": "significant",
"status": "open",
"concern": "Find the callers of the changed function. What arguments do they actually pass? Does the fix handle all of them?: Caller-boundary risk: reigh-worker/source/models/comfy/comfy_handler.py takes raw task_params_from_db and raw workflow dicts, not VibeWorkflow or SessionConfig objects. If Phase 3 chooses this existing ComfyUI handler as the helper location, it cannot construct VibeComfy SessionConfig without first introducing a new adapter boundary; the plan should make that explicit to avoid adding profile logic to the wrong legacy handler.",
"evidence": "Caller-boundary risk: reigh-worker/source/models/comfy/comfy_handler.py takes raw task_params_from_db and raw workflow dicts, not VibeWorkflow or SessionConfig objects. If Phase 3 chooses this existing ComfyUI handler as the helper location, it cannot construct VibeComfy SessionConfig without first introducing a new adapter boundary; the plan should make that explicit to avoid adding profile logic to the wrong legacy handler."
},
{
"id": "FLAG-004",
"severity": "significant",
"status": "open",
"concern": "Override precedence: the plan says explicit low-level config fields win during SessionConfig parsing, but also says CLI --memory-profile wins over workflow metadata; implementation must apply CLI profile after workflow config resolution, not by inserting memory_profile into the same config dict.",
"evidence": "vibecomfy/vibecomfy/runtime/run.py currently constructs embedded configs with SessionConfig.from_workflow_metadata(workflow); revised Step 2 gives low-level metadata fields precedence over profile-derived fields, while Step 5 requires per-run CLI profile precedence."
},
{
"id": "FLAG-005",
"severity": "significant",
"status": "open",
"concern": "Dependency boundary: reigh-worker cannot directly import VibeComfy's MemoryProfile/SessionConfig under current packaging because reigh-worker is Python 3.10-only and has no vibecomfy dependency, while vibecomfy requires Python 3.11+.",
"evidence": "reigh-worker/pyproject.toml has requires-python >=3.10,<3.11 and no vibecomfy dependency; vibecomfy/pyproject.toml has requires-python >=3.11. Phase 3 asks reigh-worker to translate override_profile into MemoryProfile.to_session_overrides()/VibeComfy SessionConfig without specifying the boundary."
},
{
"id": "issue_hints",
"severity": "significant",
"status": "open",
"concern": "Did the work fully address the issue hints, user notes, and approved plan requirements?: Dependency compatibility: reigh-worker/pyproject.toml requires Python >=3.10,<3.11, while vibecomfy/pyproject.toml requires Python >=3.11 and reigh-worker does not depend on vibecomfy. The revised plan asks the reigh-worker helper/adapter to translate into MemoryProfile.to_session_overrides() and VibeComfy SessionConfig, but it does not specify whether that is done through a duplicated pure contract, a protocol boundary, a subprocess/CLI boundary, or a packaging change; a direct import would not be compatible with the current repo constraints.",
"evidence": "Dependency compatibility: reigh-worker/pyproject.toml requires Python >=3.10,<3.11, while vibecomfy/pyproject.toml requires Python >=3.11 and reigh-worker does not depend on vibecomfy. The revised plan asks the reigh-worker helper/adapter to translate into MemoryProfile.to_session_overrides() and VibeComfy SessionConfig, but it does not specify whether that is done through a duplicated pure contract, a protocol boundary, a subprocess/CLI boundary, or a packaging change; a direct import would not be compatible with the current repo constraints."
},
{
"id": "correctness",
"severity": "significant",
"status": "open",
"concern": "Are the proposed changes technically correct?: Precedence conflict: Step 2 says explicit low-level SessionConfig fields such as reserve_vram_gb or cache_policy win over profile-derived fields when both are present in the same config object, but Step 5 says a CLI per-run --memory-profile wins over workflow metadata. In the current code, embedded runs construct SessionConfig.from_workflow_metadata(workflow) in vibecomfy/vibecomfy/runtime/run.py line 76; if the CLI implementation simply writes memory_profile into workflow.metadata['comfy_configuration'], existing low-level workflow metadata could override the CLI profile and violate the advertised per-run precedence.",
"evidence": "Precedence conflict: Step 2 says explicit low-level SessionConfig fields such as reserve_vram_gb or cache_policy win over profile-derived fields when both are present in the same config object, but Step 5 says a CLI per-run --memory-profile wins over workflow metadata. In the current code, embedded runs construct SessionConfig.from_workflow_metadata(workflow) in vibecomfy/vibecomfy/runtime/run.py line 76; if the CLI implementation simply writes memory_profile into workflow.metadata['comfy_configuration'], existing low-level workflow metadata could override the CLI profile and violate the advertised per-run precedence."
},
{
"id": "all_locations",
"severity": "significant",
"status": "open",
"concern": "Does the change touch all locations AND supporting infrastructure?: Supporting infrastructure gap: because reigh-worker currently has no dependency on vibecomfy and has a different Python version constraint, the plan needs to name the dependency boundary for Phase 3 tests and implementation. Without that, an executor could add a reigh-worker unit test that imports vibecomfy.memory_profile and fail before exercising the intended override behavior.",
"evidence": "Supporting infrastructure gap: because reigh-worker currently has no dependency on vibecomfy and has a different Python version constraint, the plan needs to name the dependency boundary for Phase 3 tests and implementation. Without that, an executor could add a reigh-worker unit test that imports vibecomfy.memory_profile and fail before exercising the intended override behavior."
}
]
code
Requirements:
- Before addressing individual flags, check: does any flag suggest the plan is targeting the wrong code or the wrong root cause? If so, consider whether the plan needs a new approach rather than adjustments. Explain your reasoning.
- Update the plan to address the significant issues.
- Keep the plan readable and executable.
- Return flags_addressed with the exact flag IDs you addressed.
- Include `changes_summary` as a short plain-English summary of what changed in the revision. If there were no concrete flags, say that explicitly (for example: `No critique flags were raised; refined wording and kept the plan aligned for execution.`).
- Preserve or improve success criteria quality. Each criterion must have a `priority` of `must`, `should`, or `info`. Promote or demote priorities if critique feedback reveals a criterion was over- or under-weighted.
- Each success criterion should include a `requires` field listing the capabilities needed for verification. Valid capability strings: `run_shell`, `read_files`, `run_tests`, `parse_diff`, `read_build_output`, `run_linter` (container), `drive_browser`, `inspect_runtime_ui`, `observe_runtime_logs`, `subjective_judgment`, `verify_physical_device` (human). `must` criteria MUST have non-empty `requires`. Example: `{"criterion": "All tests pass", "priority": "must", "requires": ["run_tests"]}`.
- Verify that the plan remains aligned with the user's original intent, not just internal plan quality.
- Remove unjustified scope growth. If critique raised scope creep, narrow the plan back to the original idea unless the broader work is strictly required.
- Maintain the structural template: H1 title, ## Overview, phase sections with numbered step sections, ## Execution Order or ## Validation Order.
- CRITICAL: Your entire revised plan markdown (all sections) must be output as the `plan` field in the structured output. The prose response must not contain the plan text.
- CRITICAL: Return only the structured JSON object for the schema fields `plan`, `changes_summary`, `flags_addressed`, `assumptions`, `success_criteria`, and `questions`. Do not add commentary before or after the JSON object.
Plan template — simple format (adapt to the actual repo and scope):
md
# Implementation Plan: [Title]
## Overview
Summarize the goal, current repository shape, and the constraints that matter.
## Main Phase
### Step 1: Audit the current behavior (`megaplan/prompts.py`)
**Scope:** Small
1. **Inspect** the current implementation and call out the exact insertion points (`megaplan/prompts.py:29`).
### Step 2: Add the first change (`megaplan/evaluation.py`)
**Scope:** Medium
1. **Implement** the smallest viable change with exact file references (`megaplan/evaluation.py:1`).
2. **Capture** any tricky behavior with a short example.
```python
issues = validate_plan_structure(plan_text)
```
### Step 3: Wire downstream behavior (`megaplan/handlers.py`, `megaplan/workers.py`)
**Scope:** Medium
1. **Update** the runtime flow in the touched files (`megaplan/handlers.py:400`, `megaplan/workers.py:199`).
### Step 4: Prove the change (`tests/test_evaluation.py`, `tests/test_megaplan.py`)
**Scope:** Small
1. **Run** the cheapest targeted checks first (`tests/test_evaluation.py:1`).
2. **Finish** with broader verification once the wiring is in place (`tests/test_megaplan.py:1`).
## Execution Order
1. Update prompts and mocks before enforcing stricter validation.
2. Land higher-risk wiring after the validator and tests are ready.
## Validation Order
1. Start with focused unit tests.
2. Run the broader suite after the flow changes are in place.
For complex plans, use multiple phases:
md
## Phase 1: Foundation — Dependencies, DB, Types
### Step 1: Install dependencies (`package.json`)
...
### Step 2: Create database migration (`supabase/migrations/`)
...
## Phase 2: Core Integration
### Step 3: Port the main component (`src/components/`)
...
Template guidance:
Simple plans: use ## Main Phase with ### Step N: sections underneath.
Complex plans: use multiple ## Phase N: sections, each containing ### Step N: steps. Step numbers are global (not per-phase).
The flat ## Step N: format (without phases) also works for backwards compatibility.
Key invariants: one H1 title, one ## Overview, numbered step sections (### Step N: or ## Step N:), and at least one ordering section.
{
"plan": "# Implementation Plan: VibeComfy Memory-Profile MVP\n\n## Overview\nThe latest critique identifies two real boundary issues, not just plan phrasing. First, the implementation must not target reigh-worker/source/models/comfy as if it were the VibeComfy adapter: that code is a legacy raw-ComfyUI path that starts Comfy directly and queues raw workflow dictionaries, not VibeWorkflow or SessionConfig. Second, reigh-worker cannot directly import VibeComfy Python objects because reigh-worker is Python 3.10-only and has no VibeComfy dependency, while vibecomfy requires Python 3.11+. The revised plan therefore keeps the concrete MemoryProfile implementation inside VibeComfy and defines the worker-facing contract as numeric CLI/config protocol only: pass profile numbers across the boundary, let VibeComfy resolve them.\n\nThe core VibeComfy work remains the same: implement a concrete MemoryProfile overlay from docs/migration-vibecomfy.md, wire it through SessionConfig, embedded configuration, managed-server argv, session defaults, one-shot server startup, per-run CLI overrides, ready-template smokes, restart documentation, and profile 1/3 measurement artifacts. The key precedence rule is now explicit: workflow metadata is resolved first; a CLI --memory-profile override is applied after that resolution and overwrites profile-controlled low-level fields for that run.\n\nExternal behavior is limited to integer profiles 1-5. Public labels must follow the migration contract: Low RAM, High RAM, Low VRAM, Very Low VRAM, and Minimum. Internal names may be descriptive, but public output and telemetry must preserve the integer/profile-label contract.\n\n## Phase 1: Foundation — Concrete Profile Overlay\n\n### Step 1: Add MemoryProfile (vibecomfy/vibecomfy/memory_profile.py)\nScope: Medium\n1. Implement a small immutable profile abstraction accepting only integer values 1..5.\n2. Encode the Sprint 1 mapping from docs/migration-vibecomfy.md directly in one place:\n - Profile 1: {\"vram_policy\": \"high\", \"cache_policy\": \"smart\"}\n - Profile 2: {\"vram_policy\": \"high\", \"cache_policy\": \"lru:32\"}\n - Profile 3: {\"vram_policy\": \"normal\", \"cache_policy\": \"smart\"}\n - Profile 4: {\"vram_policy\": \"low\", \"cache_policy\": \"classic\", \"reserve_vram_gb\": 2.0}\n - Profile 5: {\"vram_policy\": \"low\", \"cache_policy\": \"lru:1\", \"disable_smart_memory\": True, \"reserve_vram_gb\": 4.0}\n3. Provide helpers for parsing CLI/config values, returning to_session_overrides(), serializing memory_profile telemetry, and exposing public display labels.\n4. Add an override helper such as apply_to_session_config(config, *, override_existing: bool) or SessionConfig.with_memory_profile_override(profile) so callers can choose normal config precedence or CLI override precedence without mutating workflow metadata.\n5. Do not add graph or string patching here. The Sprint 1 profile overlay is a SessionConfig concern.\n\n### Step 2: Wire SessionConfig Normal Precedence (vibecomfy/vibecomfy/runtime/session.py)\nScope: Medium\n1. Add memory_profile: int | None to SessionConfig while preserving current behavior when unset.\n2. Update SessionConfig.from_dict() and from_workflow_metadata() to accept memory_profile, validate it through MemoryProfile, and overlay profile-derived fields before explicit lower-level typed fields are applied.\n3. Preserve normal config precedence inside config parsing: explicit low-level typed values such as reserve_vram_gb or cache_policy win over profile-derived fields when they appear in the same config object; raw HiddenSwitch keys carry through as today.\n4. Ensure _embedded_configuration_for_session() and _comfy_server_argv() do not duplicate profile logic. They should consume resolved SessionConfig fields and naturally emit embedded Comfy Configuration values and managed-server argv.\n5. Include memory_profile and resolved display label in run metadata emitted by _run_metadata() so profiling evidence can be grouped later.\n\n### Step 3: Add Explicit CLI Override Precedence (vibecomfy/vibecomfy/runtime/session.py, vibecomfy/vibecomfy/runtime/run.py)\nScope: Medium\n1. Add a clear API for per-run CLI override precedence that starts from an already resolved SessionConfig and then overwrites the profile-controlled fields with MemoryProfile.to_session_overrides().\n2. Use this API only for explicit CLI/runtime overrides, never for normal metadata parsing.\n3. Add tests proving workflow metadata such as {\"reserve_vram_gb\": 12, \"cache_policy\": \"none\"} can remain authoritative during normal parsing, but --memory-profile 4 applied afterward overwrites those controlled fields for the run.\n\n## Phase 2: VibeComfy CLI And Runtime Paths\n\n### Step 4: Add Process Defaults (vibecomfy/vibecomfy/commands/session.py)\nScope: Medium\n1. Add --memory-profile {1,2,3,4,5} to vibecomfy session start.\n2. Persist memory_profile into daemon config.json and construct ServerSession(SessionConfig.from_dict(config_dict)) as today, relying on the profile overlay to resolve effective fields.\n3. Extend session CLI tests so every profile 1..5 persists and resolves through daemon config without changing unset defaults.\n\n### Step 5: Fix One-Shot Managed Server Plumbing (vibecomfy/vibecomfy/runtime/server.py, vibecomfy/vibecomfy/runtime/run.py)\nScope: Medium\n1. Change comfy_server() to accept an optional SessionConfig for managed one-shot startup instead of always constructing SessionConfig(port=8188) internally.\n2. Pass a resolved config from run() when vibecomfy run --runtime server starts a managed local server with no --server-url and no active session.\n3. Add tests proving run --runtime server --memory-profile N reaches managed-server argv/config, not only metadata.\n\n### Step 6: Add Per-Run Override Policy (vibecomfy/vibecomfy/commands/run.py, vibecomfy/vibecomfy/runtime/run.py)\nScope: Medium\n1. Add --memory-profile {1,2,3,4,5} to vibecomfy run.\n2. For --runtime embedded, resolve SessionConfig.from_workflow_metadata(workflow) first, then apply the CLI memory profile via the explicit override API from Step 3 before constructing EmbeddedSession.\n3. For --runtime server or auto that starts a new managed server, resolve workflow/default config first, then apply the CLI memory profile before spawning the managed server.\n4. For an already-running managed session discovered by find_active_session() or an explicit --server-url, reject restart-required profile overrides with exit code 2 and a clear message telling the user to restart/start a session with that profile. Do not silently record metadata-only and do not claim the override won.\n5. Preserve ordinary run behavior when no profile override is passed.\n\n## Phase 3: Worker-Facing Numeric Protocol Boundary\n\n### Step 7: Define The Worker Boundary Without Direct Imports (reigh-worker/source/, vibecomfy CLI docs/tests)\nScope: Medium\n1. Do not import vibecomfy.memory_profile, SessionConfig, or any VibeComfy Python module from reigh-worker.\n2. Do not place VibeComfy profile logic in reigh-worker/source/models/comfy; that path is legacy raw-ComfyUI and not a VibeComfy adapter.\n3. Add or update only a narrow Python 3.10-compatible helper at an explicit VibeComfy adapter boundary, for example reigh-worker/source/runtime/vibecomfy_profile.py or the actual future VibeComfy backend adapter module, that resolves process default plus per-task override_profile into a numeric --memory-profile N CLI argument or equivalent JSON/env field.\n4. Keep the worker helper numeric-only: validate -1 or 1..5, choose the effective number, and pass it over the subprocess/CLI/config protocol. VibeComfy remains the only codebase that maps profile numbers to SessionConfig fields.\n5. If no VibeComfy backend adapter exists yet, add only this pure numeric helper and tests; do not introduce a full backend or retrofit the legacy raw-ComfyUI handler.\n6. Preserve WGP process flags and defaults: do not rename or remove --wgp-profile, and do not mutate WGP globals from the VibeComfy helper.\n\n## Phase 4: Template Smokes And Measurement Evidence\n\n### Step 8: Representative Template Profile Smokes (vibecomfy/tests/test_memory_profile.py, vibecomfy/tests/test_ready_templates.py)\nScope: Small\n1. Compile and validate representative templates under profiles 1..5, including at least one WanVideoWrapper template such as ready_templates/video/wanvideo_wrapper_21_14b_i2v.py and one ordinary Comfy video template such as ready_templates/video/wan_t2v.py.\n2. Assert the profile is reflected in workflow/runtime metadata and that profile overlays do not corrupt compiled graph topology.\n3. Do not update generated ready templates unless a shared ready-template policy change is required for metadata propagation.\n\n### Step 9: VRAM And Wall-Clock Evidence Artifact (vibecomfy/docs/runtime_lifecycle.md, vibecomfy/out/profile_smokes/ or committed fixture/report)\nScope: Small\n1. Add a lightweight smoke command or script that runs the selected representative template under profiles 1 and 3 and records wall-clock time plus watchdog/system VRAM samples.\n2. Write the expected artifact format, e.g. out/profile_smokes/profile-1.json and out/profile_smokes/profile-3.json, containing memory_profile, template id, start/end timestamps, duration seconds, peak/low VRAM fields when available, and log/report paths.\n3. Document how to run the smoke locally or on a GPU worker. If the implementation environment lacks a GPU, the code/tests still verify artifact schema, and the actual data collection remains an explicit human/GPU validation item.\n\n## Phase 5: Documentation And Tests\n\n### Step 10: Restart And Mapping Documentation (vibecomfy/docs/runtime_lifecycle.md, vibecomfy/docs/runtime_surface.md)\nScope: Small\n1. Document that profile changes affect process-level Comfy model-management knobs and therefore require a new embedded session or managed-server restart.\n2. Document the exact behavior for vibecomfy run --memory-profile across embedded, new managed server, discovered active session, and explicit external server URL.\n3. Include the concrete profile-to-SessionConfig mapping table in VibeComfy docs.\n4. Document the reigh-worker boundary: workers pass numeric profiles to VibeComfy through CLI/config protocol and must not import VibeComfy Python objects under the current Python-version constraints.\n\n### Step 11: Focused Verification Suite (vibecomfy/tests/, reigh-worker/tests/)\nScope: Medium\n1. Add vibecomfy/tests/test_memory_profile.py for parsing, mapping, invalid values, labels, telemetry, normal metadata precedence, and explicit CLI override precedence.\n2. Extend vibecomfy/tests/test_runtime_session.py for embedded config and managed-server argv round-trips across profiles 1..5.\n3. Extend vibecomfy/tests/test_session_cli.py for process-default persistence.\n4. Extend vibecomfy/tests/test_run_command.py and/or runtime run tests for embedded/new-server success, active/external-server rejection, and CLI override winning over workflow metadata.\n5. Add narrow reigh-worker unit tests for the numeric helper only: no VibeComfy imports, no legacy source/models/comfy modification, override_profile=-1 uses the process default, and override_profile in 1..5 emits one-run numeric profile protocol data.\n\n## Execution Order\n1. Implement MemoryProfile and pure VibeComfy unit tests first; this locks the concrete mapping and labels.\n2. Wire SessionConfig normal overlay and explicit CLI override APIs before changing any command code.\n3. Update VibeComfy CLI/runtime call paths, including one-shot managed-server config plumbing and explicit active/external-server rejection.\n4. Add the worker-facing numeric helper only after VibeComfy accepts --memory-profile; keep it import-free and away from legacy source/models/comfy.\n5. Add template smokes, measurement artifact schema, and docs last.\n\n## Validation Order\n1. Run focused VibeComfy tests: cd vibecomfy && pytest tests/test_memory_profile.py tests/test_runtime_session.py -q.\n2. Run VibeComfy CLI/runtime tests: cd vibecomfy && pytest tests/test_session_cli.py tests/test_run_command.py tests/test_runtime_run.py -q.\n3. Run ready-template smokes: cd vibecomfy && pytest tests/test_ready_templates.py -q or the new focused profile smoke tests.\n4. Run the worker numeric-boundary tests without importing VibeComfy: cd reigh-worker && pytest <new-or-existing-test-file> -q.\n5. On a GPU-capable worker, run the profile 1 and profile 3 smoke command and save the JSON artifacts described in Step 9.",
"changes_summary": "Resolved the new boundary issues by making the reigh-worker work numeric-protocol only, explicitly forbidding direct VibeComfy imports and avoiding the legacy raw-ComfyUI handler. Also added a dedicated CLI override API so --memory-profile is applied after workflow metadata resolution and can override low-level metadata fields for that run.",
"flags_addressed": [
"scope",
"callers",
"FLAG-004",
"FLAG-005",
"issue_hints",
"correctness",
"all_locations"
],
"assumptions": [
"Only integer Wan2GP profiles 1-5 are in scope for Sprint 1; profiles 3.5 and 4.5 remain out of scope.",
"The concrete docs/migration-vibecomfy.md profile-to-SessionConfig table is the Sprint 1 source of truth.",
"Unset memory_profile must preserve current VibeComfy defaults exactly.",
"Normal workflow/config parsing gives explicit low-level fields precedence over profile-derived fields.",
"Explicit CLI --memory-profile is a different operation from normal parsing and is applied after workflow metadata resolution, overwriting profile-controlled low-level fields for that run.",
"For already-running managed sessions and explicit external server URLs, process-level profile overrides are rejected rather than silently ignored or recorded as metadata-only.",
"Under current packaging, reigh-worker must not import VibeComfy Python modules; it can only pass numeric profile data over a CLI/config/subprocess protocol.",
"The legacy reigh-worker/source/models/comfy raw-ComfyUI handler is not the VibeComfy adapter and should not receive this profile logic.",
"Generated ready templates should not be hand-edited unless shared ready-template policy cannot carry the needed metadata."
],
"success_criteria": [
{
"criterion": "Profiles 1, 2, 3, 4, and 5 parse, validate, serialize, expose the required public labels, and reject invalid profile values deterministically.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "MemoryProfile.to_session_overrides() implements the concrete Sprint 1 mapping for profiles 1-5 from docs/migration-vibecomfy.md.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "SessionConfig overlays memory_profile into embedded configuration and managed-server argv/config, while preserving current behavior when unset.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "Normal config parsing lets explicit low-level config fields override profile-derived fields, while explicit CLI override applied after parsing overwrites profile-controlled fields for that run.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "vibecomfy session start --memory-profile N persists and resolves the process default for every profile 1-5.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "vibecomfy run --memory-profile N applies to embedded runs and newly started managed-server runs before dispatch.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "vibecomfy run --memory-profile N rejects explicit external server URLs and already-running discovered sessions when the profile would require process restart.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "One-shot managed-server startup accepts the resolved SessionConfig so the actual vibecomfy run --runtime server path does not drop memory_profile.",
"priority": "must",
"requires": [
"run_tests",
"parse_diff"
]
},
{
"criterion": "The reigh-worker numeric helper resolves process default plus per-task override_profile into one-run --memory-profile N protocol data without importing VibeComfy or changing WGP defaults.",
"priority": "must",
"requires": [
"run_tests",
"read_files",
"parse_diff"
]
},
{
"criterion": "No VibeComfy memory-profile logic is added to reigh-worker/source/models/comfy unless a separate explicit VibeComfy adapter boundary is introduced.",
"priority": "must",
"requires": [
"read_files",
"parse_diff"
]
},
{
"criterion": "Representative ready templates compile and validate under profiles 1-5, including at least one WanVideoWrapper template and one ordinary Comfy video template.",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "Profile restart behavior, exact profile-to-SessionConfig mapping, and worker numeric protocol boundary are documented in VibeComfy runtime docs.",
"priority": "must",
"requires": [
"read_files",
"parse_diff"
]
},
{
"criterion": "A concrete artifact schema and command/path for profile 1 and profile 3 VRAM plus wall-clock smoke data exists.",
"priority": "must",
"requires": [
"read_files",
"parse_diff",
"run_tests"
]
},
{
"criterion": "Profiles 1 and 3 have real VRAM and wall-clock data from a GPU smoke run recorded in the planned artifact format.",
"priority": "info",
"requires": [
"verify_physical_device",
"observe_runtime_logs"
]
},
{
"criterion": "Profile mapping remains centralized in vibecomfy/vibecomfy/memory_profile.py rather than duplicated across CLI/runtime/template code.",
"priority": "should",
"requires": [
"read_files",
"parse_diff",
"subjective_judgment"
]
}
],
"questions": [
"Which exact GPU/template pair should be used for the real profile 1 and profile 3 VRAM/wall-clock evidence run if the default representative templates are not acceptable for production baselining?"
]
}