[Issue 101][eval-and-fix] Fix VideoAutoencoderKL.forward return contract (closes pollockjj/mydevelopment#190)#44
Conversation
…AutoencoderKL.forward (closes pollockjj/mydevelopment#190) VideoAutoencoderKL.forward dereferenced .latent_dist and .sample on encode()/decode_() returns and called self.decode (no underscore) on a class that only defines decode_. Direct module invocation via forward(x, mode=...) raised AttributeError on every path. encode() / decode_() return a tensor when return_dict=True (the call site default) and a one-element tuple when return_dict=False. The fix unwraps that optional tuple shape and routes mode="decode" / mode="all" through self.decode_ (with the trailing underscore) so the actual contract is honored without changing either method signature. Regression test tests-unit/comfy_test/seedvr_vae_forward_test.py exercises forward() for mode="encode", "decode", and "all" against a stub subclass that bypasses the heavy __init__, plus an inspect.getsource assertion that no .latent_dist, no .sample, and no self.decode( call survive in the post-fix forward body. Source: CodeRabbit thread on Comfy-Org#11294 Comfy-Org#11294 (comment)
Codex Review -- Round 1 -- KICKOFFRunner: Prompt sent to codex reviewAwaiting codex output. The result will be posted as a separate comment on this PR when codex exits. |
There was a problem hiding this comment.
Pull request overview
Fixes VideoAutoencoderKL.forward() in SeedVR so it uses this class’s actual encode() / decode_() return shapes instead of diffusers-style attributes. This is a narrow contract-repair in the VAE plus a new regression test file to pin the behavior.
Changes:
- Replaced invalid
.latent_dist/.sampleaccess inVideoAutoencoderKL.forward()with direct tensor handling. - Switched the decode path from nonexistent
self.decode(...)toself.decode_(...). - Added SeedVR unit tests covering
forward(..., mode="encode"|"decode"|"all")plus a source-level guard against reintroducing the old pattern.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
comfy/ldm/seedvr/vae.py |
Repairs VideoAutoencoderKL.forward() to call encode() / decode_() directly and unwrap tuple returns. |
tests-unit/comfy_test/seedvr_vae_forward_test.py |
Adds regression tests for forward return types/shapes and a source-level pin for the removed diffusers-style access. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if mode == "encode": | ||
| h = self.encode(x) | ||
| return h.latent_dist | ||
| return _unwrap(self.encode(x)) | ||
| elif mode == "decode": | ||
| h = self.decode(x) | ||
| return h.sample | ||
| return _unwrap(self.decode_(x)) | ||
| else: | ||
| h = self.encode(x) | ||
| h = self.decode(h.latent_dist.mode()) | ||
| return h.sample | ||
| latent = _unwrap(self.encode(x)) | ||
| return _unwrap(self.decode_(latent)) |
There was a problem hiding this comment.
The kwargs-propagation observation is correct in isolation: forward(x, return_dict=False) does not propagate to encode()/decode_(). However, this PR's stated scope is the AttributeError from .latent_dist/.sample access on tensor returns; the _unwrap handles both single-tensor returns AND the (z, p) 2-tuple from VideoAutoencoderKLWrapper.encode. Honoring return_dict=False end-to-end is a separate concern and would belong in a follow-up issue.
| def encode(self, x, return_dict=True): | ||
| return self._encode_out | ||
|
|
||
| def decode_(self, z, return_dict=True): | ||
| return self._decode_out |
| def test_forward_source_has_no_diffusers_attr_access(): | ||
| src = inspect.getsource(VideoAutoencoderKL.forward) | ||
| assert ".latent_dist" not in src | ||
| assert ".sample" not in src | ||
| assert re.search(r"self\.decode\(", src) is None |
Codex Review -- Round 1 -- RESULTPR: #44 Prompt sent to codex reviewVerbatim codex review outputThis PR was reviewed using No merge-blocking correctness issues were identified in the PR diff. Codex runner stderr (non-evidence) |
Codex Review -- Round 2 -- KICKOFFRunner: Awaiting codex output. The structured result will be posted as a separate comment on this PR when codex exits. |
Codex Review -- Round 2 -- RESULTPR: #44 Overall explanationThe patch aligns VideoAutoencoderKL.forward with the class's actual encode()/decode_() tensor return contract and removes the invalid diffusers-style attribute access/call path. I found no P0/P1/P2 issues in the changed code; the targeted test could not be executed in this environment because torch is not installed. Findings (0)No findings. Raw JSON (schema-enforced){
"findings": [],
"overall_confidence_score": 0.86,
"overall_correctness": "patch is correct",
"overall_explanation": "The patch aligns VideoAutoencoderKL.forward with the class's actual encode()/decode_() tensor return contract and removes the invalid diffusers-style attribute access/call path. I found no P0/P1/P2 issues in the changed code; the targeted test could not be executed in this environment because torch is not installed."
} |
Codex Review -- Round 3 -- KICKOFFRunner: Awaiting codex output. The structured result will be posted as a separate comment on this PR when codex exits. |
Codex Review -- Round 3 -- RESULTPR: #44 Overall explanationThe patch updates Findings (0)No findings. Raw JSON (schema-enforced){
"findings": [],
"overall_confidence_score": 0.88,
"overall_correctness": "patch is correct",
"overall_explanation": "The patch updates `VideoAutoencoderKL.forward` to use the actual tensor-returning `encode`/`decode_` contract and keeps the source change tightly scoped. The added regression test passes in the local ComfyUI virtualenv (`4 passed`)."
} |
Codex Review -- Round 4 -- KICKOFFRunner: Awaiting codex output. The structured result will be posted as a separate comment on this PR when codex exits. |
Codex Review -- Round 4 -- RESULTPR: #44 Overall explanationThe PR fixes VideoAutoencoderKL.forward to use the class's actual tensor/tuple-returning encode/decode_ contract and adds focused regression coverage. I did not identify any P0/P1/P2 correctness issues in the changed code. Findings (0)No findings. Raw JSON (schema-enforced){
"findings": [],
"overall_confidence_score": 0.91,
"overall_correctness": "patch is correct",
"overall_explanation": "The PR fixes VideoAutoencoderKL.forward to use the class's actual tensor/tuple-returning encode/decode_ contract and adds focused regression coverage. I did not identify any P0/P1/P2 correctness issues in the changed code."
} |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def test_forward_source_has_no_diffusers_attr_access(): | ||
| src = inspect.getsource(VideoAutoencoderKL.forward) | ||
| assert ".latent_dist" not in src | ||
| assert ".sample" not in src | ||
| assert re.search(r"self\.decode\(", src) is None |
…n contract (closes pollockjj/mydevelopment#192) (#46) * [Issue 101][eval-and-fix] Fix VideoAutoencoderKLWrapper.forward return contract (closes pollockjj/mydevelopment#192) VideoAutoencoderKLWrapper.forward() called self.decode(z).sample, but VideoAutoencoderKLWrapper.decode() returns a plain torch.Tensor (post-Comfy-Org#189 / PR #34 normalization). Direct wrapper invocation therefore raised AttributeError on the tensor return. Drop the .sample dereference; use the tensor return directly. forward() now returns the (x_out, z, p) triple as documented in the wrapper's encode/decode contract. Sister to mydevelopment#190 (PR #44) which fixed the parent class VideoAutoencoderKL.forward for the same bug class flagged on Comfy-Org#11294 by CodeRabbit (thread r2959796348, "Also applies to: 2083-2087" trailer). Adds tests-unit/comfy_test/seedvr_vae_wrapper_forward_test.py — four CPU-only regression tests that build a wrapper standin via __new__ + nn.Module.__init__, register a single dummy parameter so the wrapper's encode dtype lookup resolves, set original_image_video / img_dims / tiled_args so the wrapper.decode guards pass, patch the parent VideoAutoencoderKL.encode / decode_ plus the module-level lab_color_transfer with fingerprint-tagged stubs, then call wrapper.forward(x) end-to-end and assert (1) the return is a 3-tuple of tensors with no AttributeError raised, (2) x_out has exact expected shape, dtype, and value-fingerprint under torch.equal, (3) z matches the encode-side posterior squeezed on dim 2 under torch.equal, and (4) inspect.getsource(wrapper.forward) contains no ".sample" string. * [Issue 101][eval-and-fix] Tighten VideoAutoencoderKLWrapper.forward regression test to two-test contract (pollockjj/mydevelopment#192) The regression suite for VideoAutoencoderKLWrapper.forward now defines exactly the two contract-named tests: - test_wrapper_forward_returns_tensor_triple monkeypatches VideoAutoencoderKLWrapper.encode and VideoAutoencoderKLWrapper.decode directly on the class, builds the wrapper standin via __new__ + nn.Module.__init__, sets original_image_video to a 5-D tensor and img_dims to a 2-tuple, invokes wrapper.forward(x), and asserts the full return-contract: 3-tuple, three torch.Tensor types, binary shape equality (x_out.shape == decode_out.shape, z.shape == posterior.squeeze(2).shape), tensor equality (torch.equal(x_out, decode_out), torch.equal(z, posterior.squeeze(2))), and identity (p is posterior). - test_wrapper_forward_source_has_no_sample_access asserts ".sample" not in inspect.getsource(VideoAutoencoderKLWrapper.forward) so the failing pre-fix body raises an explicit assertion failure on the literal forbidden token. Stubbing on the wrapper class (not the parent) bypasses the parent encode/decode_ entirely, removes the lab_color_transfer monkey-patch, and makes the AttributeError pre-fix path surface directly on self.decode(z).sample because the stubbed decode returns a plain tensor.
Plan: Fix VideoAutoencoderKL.forward to honor tensor/tuple return contract
Overview
VideoAutoencoderKL.forward()onpollockjj/ComfyUI:issue_101dereferencesdiffusers-style
.latent_distand.sampleattributes on values that arealready plain
torch.Tensor(or one-elementtuple) returns fromencode()and
decode_(). Direct module invocation viaforward(x, mode=…)raisesAttributeErrorimmediately, and themode == "decode"branch additionallycalls
self.decode(x)on a class that does not definedecode(onlydecode_). The fix replaces the buggy attribute access with the actualreturn contract and adds a regression test that exercises
forward()formode="encode",mode="decode", andmode="all"and asserts each return isa
torch.Tensorof the expected shape — binary equality, no tolerance bands.Diagnosis Summary
The buggy method body, captured live from
issue_101:comfy/ldm/seedvr/vae.pylines 2194–2207 (Ground Truth Probe GTP-3):
Live AST probe of
VideoAutoencoderKL(GTP-1) confirms the class definesencode,decode_, andforward, but has nodecodemember. The actualencode()body (GTP-2) returns the tensorposterior = DiagonalGaussianDistribution(h).mode()whenreturn_dict=True(the defaultunder
forward's call site) and(posterior,)whenreturn_dict=False.decode_()mirrors that contract —decoded(tensor) by default,(decoded,)when
return_dict=False. None of those returns expose.latent_distor.sample. Every code path of the currentforwardraises before producing aresult. Fix shape: route through
self.decode_(with the trailingunderscore), return tensors directly, and tolerate the optional one-element
tuple shape that
return_dict=Falsewould produce.The pre-fix runs against
issue_101:comfy/ldm/seedvr/vae.pyraiseAttributeError: 'Tensor' object has no attribute 'latent_dist'formode="encode"andmode="all", andAttributeError: 'VideoAutoencoderKL' object has no attribute 'decode'formode="decode". The same invocationpost-fix exits 0 with
4 passed. AC-1 / AC-2 capture this A/B pair ascommitted pytest logs.
Affected Repositories
pollockjj/ComfyUIis the deliverable: the fix tocomfy/ldm/seedvr/vae.pyand the new regression test under
tests-unit/comfy_test/land here onissue_190and PR back intoissue_101.pollockjj/mydevelopmentis the bookkeeping target: every committedartifact under
github_issues/190/slice1/(pytest logs, source extracts,diff transcripts, grep transcripts) lives on the outer workspace's
issue_190branch and PRs back intomainas the standard[bookkeeping] [Issue 101][eval-and-fix]pattern (see merged PRs Comfy-Org#197–Comfy-Org#201for the precedent).
Asset Readiness
Research and Methodology
Plan Foundations Comment URL: https://github.com/pollockjj/mydevelopment/issues/190#issuecomment-4378366792
Plan Foundations Comment Pin:
comment-id=IC_kwDOR2e1q88AAAABBPiTSA edited-at=2026-05-05T10:19:01ZDetected Scope:
none— trivial bug-fix where the existingencode()/decode_()return contract IS the spec; the fix duplicates that contractcorrectly inside
forward()and adds a regression test that locks thecontract.
The change class is "honor an existing internal API contract." No external
research, no canonical references, no metric definitions, and no published
anchor are invoked. The equivalence rule is binary type/shape equality
on the tensors returned by
forward()—type(result) is torch.Tensorandresult.shape == expected_shape. No tolerance bands; no statistical tests.Source authority is the live source of
comfy/ldm/seedvr/vae.pyon theissue's base branch (
issue_101), captured verbatim under## Ground Truth Probes.Binding parent-issue directives quoted verbatim from
pollockjj/mydevelopment#190 issue body (the tracking issue this plan
finalizes):
These three directives bound the scope of every AC below.
Tools, Pipeline, and Measurements
Plan Foundations Comment URL: https://github.com/pollockjj/mydevelopment/issues/190#issuecomment-4378366792
Plan Foundations Comment Pin:
comment-id=IC_kwDOR2e1q88AAAABBPiTSA edited-at=2026-05-05T10:19:01ZExisting tooling — REUSE only. Trivial scope; no external tools beyond
the change itself.
pytesttests-unit/requirements.txtpin (pertests-unit/README.md)git show issue_101:tests-unit/README.mddocumentspytest tests-unit/as the canonical invocationtorch.venv/pin on the deliverable slot/home/johnj/dev_cuda_1/ComfyUI/.venv/comfy.ldm.seedvr.vae.VideoAutoencoderKLissue_101HEADgitPipeline: edit one method body in one source file → add one test file →
run
pytestagainst the new test on issue_190 (post-fix) and againstthe same test with
vae.pyreverted toissue_101:comfy/ldm/seedvr/vae.py(pre-fix) → commit pytest logs, AST-extracted forward source, grep
transcripts, and a scope-bounded
git difftogithub_issues/190/slice1/on the bookkeeping branch.
Measurements: the only "measurement" is binary type and shape equality on
three tensor returns from
forward(). There is no metric, no anchor, nostatistical test, no sweep, and no characterization verdict. Single-probe
and boundary-bracketing requirements (HR-06, HR-11) do not apply.
Ground Truth Probes
cd /home/johnj/dev_cuda_1/ComfyUI && git show issue_101:comfy/ldm/seedvr/vae.py | python3 -c 'import ast,sys; tree=ast.parse(sys.stdin.read()); [print("class VideoAutoencoderKL methods:", [m.name for m in n.body if isinstance(m,(ast.FunctionDef,ast.AsyncFunctionDef))]) for n in ast.walk(tree) if isinstance(n,ast.ClassDef) and n.name=="VideoAutoencoderKL"]'class VideoAutoencoderKL methods: ['__init__', 'encode', 'decode_', '_encode', '_decode', 'slicing_encode', 'slicing_decode', 'tiled_encode', 'tiled_decode', 'forward']— i.e.encode,decode_, andforwardare members;decode(no underscore) is NOT a membercd /home/johnj/dev_cuda_1/ComfyUI && git show issue_101:comfy/ldm/seedvr/vae.py | sed -n '2101,2118p'encode/decode_return a tensor whenreturn_dict=True(the default at theforwardcall site) and a one-element tuple(tensor,)whenreturn_dict=False. Neither return path produces an object with.latent_distor.sample.cd /home/johnj/dev_cuda_1/ComfyUI && git show issue_101:comfy/ldm/seedvr/vae.py | sed -n '2194,2208p'.latent_diston lines 2200/2206, (b) accesses.sampleon lines 2203/2207, and (c) callsself.decode(...)on lines 2202/2206 — three distinct AttributeError sites that the fix removes.cd /home/johnj/dev_cuda_1/ComfyUI && git show issue_101:comfy/ldm/seedvr/vae.py | python3 -c 'import ast,sys; tree=ast.parse(sys.stdin.read()); [print("class VideoAutoencoderKLWrapper methods:", [m.name for m in n.body if isinstance(m,(ast.FunctionDef,ast.AsyncFunctionDef))]) for n in ast.walk(tree) if isinstance(n,ast.ClassDef) and n.name=="VideoAutoencoderKLWrapper"]'class VideoAutoencoderKLWrapper methods: ['__init__', 'forward', 'encode', 'decode', 'set_memory_limit']— combined with the AST-extracted body ofVideoAutoencoderKLWrapper.forwardfrom the same source, captured viapython3 -c 'import ast,sys; src=sys.stdin.read(); tree=ast.parse(src); [print(ast.get_source_segment(src,m)) for n in ast.walk(tree) if isinstance(n,ast.ClassDef) and n.name=="VideoAutoencoderKLWrapper" for m in n.body if isinstance(m,ast.FunctionDef) and m.name=="forward"]', yielding . Both literal output blocks were captured live on issue_101 HEAD; AC-6 cites GTP-4 to lock the wrapper class methods and forward body as the off-limits surface that the scope-diff artifact must not touch.cd /home/johnj/dev_cuda_1/ComfyUI && git ls-tree --name-only issue_101 tests-unit/comfy_test/issue_101,tests-unit/comfy_test/contains exactly two files (folder_path_test.pyandmodel_detection_test.py) and zero seedvr coverage. AC-7's pre-fix-fingerprint cites GTP-5 to lock the absence of anyseedvr_vae_forward_test.pyon the base branch.Every literal API surface the ACs below cite —
VideoAutoencoderKL,encode,decode_,forward, themodeparameter and itsLiteralvalues
"encode"/"decode"/"all", the.latent_distand.sampleattribute references in the buggy body, the
self.decode(call sitethat must become
self.decode_(, the off-limitsVideoAutoencoderKLWrapperclass and its
forwardbody, and the base-branchtests-unit/comfy_test/directory contents — is anchored to one of GTP-1, GTP-2, GTP-3, GTP-4,
GTP-5 above.
Created Surface Contract
tests-unit/comfy_test/seedvr_vae_forward_test.pyissue_190. Defines four pytest test functions that exerciseVideoAutoencoderKL.forward()against a stub subclass (which bypasses the heavy__init__viatorch.nn.Module.__init__(self)and overridesencode/decode_with known tensors):test_forward_encode_returns_tensor,test_forward_decode_returns_tensor,test_forward_all_returns_tensor,test_forward_source_has_no_diffusers_attr_access. The first three asserttype(result) is torch.Tensorandresult.shape == expected_shapefor eachmode. The fourth usesinspect.getsource(VideoAutoencoderKL.forward)and asserts".latent_dist" not in src,".sample" not in src, and a regexr"self\.decode\("(open paren, no underscore) does not match.github_issues/190/slice1/pytest_post_fix.logissue_190. Verbatim stdout/stderr ofcd /home/johnj/dev_cuda_1/ComfyUI && python3 -m pytest tests-unit/comfy_test/seedvr_vae_forward_test.py -vrun on issue_190 HEAD. Final line contains4 passed.github_issues/190/slice1/pytest_pre_fix.logissue_190. Verbatim stdout/stderr of the same pytest invocation captured aftergit checkout issue_101 -- comfy/ldm/seedvr/vae.pyis applied to the deliverable working tree. Captures threeAttributeErrorfailures on the encode/decode/all tests plus the source-shape assertion failure. Restored to issue_190 HEAD viagit restore comfy/ldm/seedvr/vae.pyimmediately after capture.github_issues/190/slice1/forward_source.txtissue_190. Verbatim AST-extracted source ofVideoAutoencoderKL.forwardfrom issue_190 HEADcomfy/ldm/seedvr/vae.py, produced bypython3 -c 'import ast; src=open("comfy/ldm/seedvr/vae.py").read(); tree=ast.parse(src); cls=[n for n in ast.walk(tree) if isinstance(n,ast.ClassDef) and n.name=="VideoAutoencoderKL"][0]; m=[n for n in cls.body if isinstance(n,ast.FunctionDef) and n.name=="forward"][0]; print(ast.get_source_segment(src,m))'.github_issues/190/slice1/forbidden_attrs_grep.logissue_190. Output ofgrep -n -E '\.latent_dist|\.sample' github_issues/190/slice1/forward_source.txt. Exit code 1, zero lines.github_issues/190/slice1/decode_call_grep.logissue_190. Output ofgrep -n -E 'self\.decode\(' github_issues/190/slice1/forward_source.txt. Exit code 1, zero lines. (self.decode_(is permitted; the regex requires an open paren immediately afterdecode.)github_issues/190/slice1/scope_diff.txtissue_190. Output ofcd /home/johnj/dev_cuda_1/ComfyUI && git diff issue_101..issue_190 -- comfy/ldm/seedvr/vae.py. The diff shows zero hunks outside the body ofVideoAutoencoderKL.forward(lines 2194–2207 on the issue_101 side);encode,decode_,_encode,_decode,slicing_encode,slicing_decode,tiled_encode,tiled_decode, andVideoAutoencoderKLWrapperare all unchanged.Slices
Slice 1: Fix VideoAutoencoderKL.forward tensor/tuple contract
Kind: implementation
Objective: Prove that
VideoAutoencoderKL.forward()returns plaintorch.Tensorvalues formode="encode",mode="decode", andmode="all"without dereferencing.latent_distor.sample, and that the change is scoped strictly to the body ofVideoAutoencoderKL.forward(no other method body or class touched).Acceptance Criteria
cd /home/johnj/dev_cuda_1/ComfyUI && python3 -m pytest tests-unit/comfy_test/seedvr_vae_forward_test.py -vexits 0 with4 passedin the summary line — verified by committed artifactgithub_issues/190/slice1/pytest_post_fix.logwhose last non-blank line ends with4 passed.AttributeError: 'Tensor' object has no attribute 'latent_dist'(and analogous.sample/decodeerrors) on every encode/decode/all test (Diagnosis Summary §"Diagnosis Summary"; GTP-3)4 passedVideoAutoencoderKL.forward()returns plaintorch.Tensorvalues formode="encode",mode="decode", andmode="all"without dereferencing.latent_distor.sample, and that the change is scoped strictly to the body ofVideoAutoencoderKL.forward(no other method body or class touched)."tests-unit/comfy_test/seedvr_vae_forward_test.py -vproves the same observable flips across the fix:github_issues/190/slice1/pytest_pre_fix.logrecords at least threeAttributeErrorfailures plus thetest_forward_source_has_no_diffusers_attr_accessfailure aftercd /home/johnj/dev_cuda_1/ComfyUI && git checkout issue_101 -- comfy/ldm/seedvr/vae.py, andgithub_issues/190/slice1/pytest_post_fix.logrecords pytest exit 0 with4 passedaftergit restore comfy/ldm/seedvr/vae.pyrestores issue_190 HEAD.python3 -m pytest tests-unit/comfy_test/seedvr_vae_forward_test.py -vinvocation raisesAttributeErrorin the encode/decode/all paths whenvae.pyis reverted to issue_101 (Diagnosis Summary §"Diagnosis Summary"; GTP-3)4 passedand zeroAttributeErrorfailuresVideoAutoencoderKL.forward()returns plaintorch.Tensorvalues formode="encode",mode="decode", andmode="all"without dereferencing.latent_distor.sample, and that the change is scoped strictly to the body ofVideoAutoencoderKL.forward(no other method body or class touched)."VideoAutoencoderKL.forwardon issue_190 HEAD contains zero occurrences of the literal.latent_dist— verified by committed artifactsgithub_issues/190/slice1/forward_source.txt(the extracted body) andgithub_issues/190/slice1/forbidden_attrs_grep.log(grep -n -E '\.latent_dist|\.sample' forward_source.txtexit code 1, zero matching lines)..latent_distoccurrences on lines 2200 and 2206 of issue_101'svae.py.latent_distreferences survive in the post-fix forward body; the grep log is emptyVideoAutoencoderKL.forward()returns plaintorch.Tensorvalues formode="encode",mode="decode", andmode="all"without dereferencing.latent_distor.sample, and that the change is scoped strictly to the body ofVideoAutoencoderKL.forward(no other method body or class touched)."VideoAutoencoderKL.forwardon issue_190 HEAD contains zero occurrences of the literal.sample— verified by the same committed artifacts as AC-3 (forward_source.txtplusforbidden_attrs_grep.log); the same combined grep covers both literals and reports zero matches for either..sampleoccurrences on lines 2203 and 2207 of issue_101'svae.py.samplereferences survive in the post-fix forward bodyVideoAutoencoderKL.forward()returns plaintorch.Tensorvalues formode="encode",mode="decode", andmode="all"without dereferencing.latent_distor.sample, and that the change is scoped strictly to the body ofVideoAutoencoderKL.forward(no other method body or class touched)."VideoAutoencoderKL.forwardon issue_190 HEAD contains zero occurrences of the regexself\.decode\((open paren immediately afterdecode, no trailing underscore) — verified by committed artifactgithub_issues/190/slice1/decode_call_grep.log(grep -n -E 'self\.decode\(' forward_source.txtexit code 1, zero matching lines).self.decode_(references — if the implementer chooses to callself.decode_formode="decode"andmode="all"— are permitted because the regex requires the next character afterdecodeto be(.self.decode(call sites on lines 2202 and 2206 of issue_101'svae.py; GTP-1 confirmsdecodeis not defined on the classself.decode((open-paren-immediately) call sites remain; route is exclusively throughself.decode_VideoAutoencoderKL.forward()returns plaintorch.Tensorvalues formode="encode",mode="decode", andmode="all"without dereferencing.latent_distor.sample, and that the change is scoped strictly to the body ofVideoAutoencoderKL.forward(no other method body or class touched)."cd /home/johnj/dev_cuda_1/ComfyUI && git diff issue_101..issue_190 -- comfy/ldm/seedvr/vae.pyproduces hunks confined to the line range ofVideoAutoencoderKL.forwardon the issue_101 side (lines 2194–2207 per GTP-3) and zero hunks touchingencode,decode_,_encode,_decode,slicing_encode,slicing_decode,tiled_encode,tiled_decode, or any line ofVideoAutoencoderKLWrapper(per GTP-4) — verified by committed artifactgithub_issues/190/slice1/scope_diff.txt. The artifact contains the verbatim diff plus a final stanza listing every@@-hunk header range and confirming each falls inside[2194, 2207]on the-side.VideoAutoencoderKLWrapper.forwardper Add support for file list refresh feature in node Comfy-Org/ComfyUI#192 — captured live as GTP-4, encode/decode_ signatures per "plan drift" guard)vae.pyside is confined to theforwardmethod body; the artifact's final stanza enumerates each hunk and asserts in-rangeVideoAutoencoderKL.forward()returns plaintorch.Tensorvalues formode="encode",mode="decode", andmode="all"without dereferencing.latent_distor.sample, and that the change is scoped strictly to the body ofVideoAutoencoderKL.forward(no other method body or class touched)."tests-unit/comfy_test/seedvr_vae_forward_test.pyon issue_190 defines four pytest test functions whose names are exactlytest_forward_encode_returns_tensor,test_forward_decode_returns_tensor,test_forward_all_returns_tensor, andtest_forward_source_has_no_diffusers_attr_access; the first three assert bothtype(result) is torch.Tensorand an exactresult.shape == expected_shapeequality (binary, no tolerance band) for eachmode; the fourth runsinspect.getsource(VideoAutoencoderKL.forward)and asserts the absence of.latent_dist,.sample, and the regexr"self\.decode\("— verified by committed artifactgithub_issues/190/slice1/test_source.txt(cp /home/johnj/dev_cuda_1/ComfyUI/tests-unit/comfy_test/seedvr_vae_forward_test.py github_issues/190/slice1/test_source.txt) plus the AC-1 pytest log showing all four test names in thePASSEDlines.tests-unit/comfy_test/onissue_101contains exactly two files (folder_path_test.pyandmodel_detection_test.py) per GTP-5, so the regression test does not yet exist on the base branchPASSEDfor each by name; the binary type/shape assertions exclude tolerance-band variantsVideoAutoencoderKL.forward()returns plaintorch.Tensorvalues formode="encode",mode="decode", andmode="all"without dereferencing.latent_distor.sample, and that the change is scoped strictly to the body ofVideoAutoencoderKL.forward(no other method body or class touched)."Constraints
python3python3 -m pytest tests-unit/comfy_test/seedvr_vae_forward_test.py -vfrom the deliverable checkout root/home/johnj/dev_cuda_1/ComfyUI.venv/already providestorchandpytestper the slot layout in CLAUDE.mdpkill, norm -rf, nopython main.py, no/tmpwrites&&/||/;chainingpollockjj/ComfyUI:issue_190cut fromissue_101; PR target =issue_101github_issues/190/slice1/*) land onpollockjj/mydevelopment:issue_190cut frommain; PR target =mainVideoAutoencoderKL.forwardincomfy/ldm/seedvr/vae.py(encode, decode_, _encode, _decode, slicing_encode, slicing_decode, tiled_encode, tiled_decode, and the entireVideoAutoencoderKLWrapperclass are off-limits)encode()/decode_()signatures or return shapes (issue body explicit "plan drift" guard)pytestfrom the deliverable slot's.venv/— REUSE; no installcomfy.ldm.seedvr.vae.VideoAutoencoderKLimport path — REUSE; verified by GTP-1git,grep, AST extraction via stdlibastmodule — REUSEgithub_issues/190/slice1/are the only added paths in the bookkeeping repo.latent_dist,.sample,self.decode(in forward body) → AST-extracted committed source plus zero-match grep transcripts (AC-3, AC-4, AC-5)git diff issue_101..issue_190 -- vae.pywith hunk-range enumeration (AC-6)git stashor external decision deferral..gitignorerules for safe generated bulk, or discarded generated debris.issue_190(e.g. the?? github_issues/190/dispatch artifacts seen at plan time on the bookkeeping checkout) is repo provenance and is integrated, not removed as dirty-state cleanup.git status --shortgates locally on both/home/johnj/dev_cuda_1/ComfyUIand/home/johnj/dev_cuda_1/mydevelopmentand must refuse to submit while either is dirty.repo_hygiene.txt, rawgit status --shorttranscripts, orCLEANmarkers as QA evidence.git checkout issue_101 -- comfy/ldm/seedvr/vae.py) MUST be undone viagit restore comfy/ldm/seedvr/vae.pybefore any commit is created on the deliverable; the pre-fix log itself is committed only to the bookkeeping repo.Out of Scope
VideoAutoencoderKLWrapper.forward(lines 2226–2230 on issue_101) — same bug class (self.decode(z).sample) but tracked separately as pollockjj/mydevelopment#192. Do not touch.VideoAutoencoderKL.encode()orVideoAutoencoderKL.decode_()— signature, return shape, or body. The issue body explicitly flags such changes as plan drift; if implementation reveals a need to change them, stop and surface to the architect.comfy_extras/nodes_seedvr.py,tiled_vae, or other call sites ofencode()/decode_()outsideVideoAutoencoderKL.forward. The fix is scoped to one method body.mergeable=DIRTYand silent for two weeks per the issue body; pushing back toyousef-rafat:seedvr2is out of scope and requires a separate decision.issue_101and is not re-validated by this slice.type(result) is torch.Tensor,result.shape == expected_shape).**kwargsparameter onforward. Honoring the call-site contract is sufficient; the parameter list stays as captured in GTP-3.Tracked in pollockjj/mydevelopment Comfy-Org#190 (bookkeeping PR pollockjj/mydevelopment#203).