[Issue 101][eval-and-fix] Fix VideoAutoencoderKLWrapper.forward return contract (closes pollockjj/mydevelopment#192)#46
Conversation
…n 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.
…egression 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.
Codex Review — Cycle 1Overall: patch is correct No findings. |
There was a problem hiding this comment.
Pull request overview
Fixes VideoAutoencoderKLWrapper.forward() to honor the wrapper’s decode() return contract (plain torch.Tensor) by removing an invalid .sample dereference, and adds a focused regression test to prevent reintroduction.
Changes:
- Update
VideoAutoencoderKLWrapper.forward()to usex = self.decode(z)(no.sample). - Add
tests-unit/comfy_test/seedvr_vae_wrapper_forward_test.pyto exercisewrapper.forward(x)end-to-end via stubs and assert.sampleis absent from the forward source.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
comfy/ldm/seedvr/vae.py |
Removes invalid .sample access in VideoAutoencoderKLWrapper.forward() so it returns the decoded tensor directly. |
tests-unit/comfy_test/seedvr_vae_wrapper_forward_test.py |
Adds regression coverage for the wrapper forward() return contract and source guard against .sample. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Melian PR-Review — Cycle 1 — DECISION: CONTINUE — blocking findings remain.HEAD SHA reviewed: Why we are continuing1 blocking finding(s) remain. The slicer will address them and the next cycle will re-review the resulting head SHA. Blocking findings
Raw signal
Verdict rationale (raw)
This comment is posted by Melian's FSM ( |
Codex Review — Cycle 2Overall: patch is correct No findings. |
Melian PR-Review — Cycle 2 — DECISION: CONTINUE — blocking findings remain.HEAD SHA reviewed: Why we are continuing1 blocking finding(s) remain. The slicer will address them and the next cycle will re-review the resulting head SHA. Blocking findings
Raw signal
Verdict rationale (raw)
This comment is posted by Melian's FSM ( |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codex Review — Cycle 3Overall: patch is correct No findings. |
Melian PR-Review — Cycle 3 — DECISION: CONTINUE — blocking findings remain.HEAD SHA reviewed: Why we are continuing1 blocking finding(s) remain. The slicer will address them and the next cycle will re-review the resulting head SHA. Blocking findings
Raw signal
Verdict rationale (raw)
This comment is posted by Melian's FSM ( |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Plan: Fix VideoAutoencoderKLWrapper.forward to honor decode tensor return contract
Overview
VideoAutoencoderKLWrapper.forward()onpollockjj/ComfyUI:issue_101(HEAD80c91503, post-Comfy-Org#190) callsself.decode(z).sample, butVideoAutoencoderKLWrapper.decode()returns a plaintorch.Tensor(per the post-Comfy-Org#189 / PR #34 normalization). Direct wrapper invocation viaforward(x)therefore raisesAttributeError: 'Tensor' object has no attribute 'sample'on the existingdecode(z).sampleline. The fix removes the spurious.sampleaccess soforwardreturns the decoded tensor directly. A regression test exerciseswrapper.forward(x)end-to-end and asserts the returned(x_out, z, p)triple is well-formed — binary type/shape equality plus a source-introspection check that.sampleis absent from the post-fix forward body. This plan is the wrapper-class sibling of merged PR #44 (closed Comfy-Org#190); the parent classVideoAutoencoderKL.forwardis already fixed and is explicitly off-limits here.Diagnosis Summary
The buggy method body, captured live from
issue_101:comfy/ldm/seedvr/vae.pylines 2228–2232 (Ground Truth Probe GTP-3):Live AST probe of
VideoAutoencoderKLWrapper(GTP-1) confirms the class defines__init__,forward,encode,decode, andset_memory_limit— i.e.decode(no underscore) IS a member of the wrapper subclass (unlike the parentVideoAutoencoderKL, which only hasdecode_), so the callself.decode(z)itself resolves correctly. The bug is the.sampledereference on thedecodereturn. The wrapper'sdecode()body (GTP-4) returns a plaintorch.Tensor(the post-rearrange / lab-color-transferred output) at the finalreturn xstatement; nothing in that return chain produces an object with a.sampleattribute. Every direct invocation ofwrapper.forward(x)raisesAttributeError: 'Tensor' object has no attribute 'sample'immediately afterself.decode(z)returns.The pre-fix run against
issue_101:comfy/ldm/seedvr/vae.pyraisesAttributeError: 'Tensor' object has no attribute 'sample'for every test path that exerciseswrapper.forward(x). The same invocation post-fix exits 0 with2 passed. AC-1 / AC-2 capture this A/B pair as committed pytest logs. The fix is a one-line edit insidewrapper.forward: replacex = self.decode(z).samplewithx = self.decode(z). No other method body, no other class, no signature change.Affected Repositories
pollockjj/ComfyUIis the deliverable: the fix tocomfy/ldm/seedvr/vae.pyand the new regression test undertests-unit/comfy_test/land here onissue_192(cut fromissue_101HEAD80c91503) and PR back intoissue_101. This mirrors PR #44 (issue_190→issue_101) and PR #34 (issue_189→issue_101).pollockjj/mydevelopmentis the bookkeeping target: every committed artifact undergithub_issues/192/slice1/(pytest logs, AST source extracts, grep transcripts, scope-bounded diff, companion-regression log) lives on the outer workspace'sissue_192branch and PRs back intomainas the standard[bookkeeping] [Issue 101][eval-and-fix]pattern (see merged PRs Comfy-Org#197–Comfy-Org#201 and Comfy-Org#205–Comfy-Org#207 for the precedent).Asset Readiness
origin/issue_101is80c91503pergit log --oneline origin/issue_101 -1seedvr_vae_forward_test.pyalready exits 0 against this same venv onorigin/issue_101github_issues/192/slice1/are writable/tracked onissue_192Research and Methodology
Plan Foundations Comment URL: https://github.com/pollockjj/mydevelopment/issues/192#issuecomment-4382275426
Plan Foundations Comment Pin:
comment-id=IC_kwDOR2e1q88AAAABBTQ3Yg edited-at=2026-05-05T19:17:44ZDetected Scope:
none— byte-identical port of the established Comfy-Org#190 / PR #44 pattern to the immediately-adjacent subclass; the existing wrapperdecode()return contract IS the spec, and the fix duplicates that contract correctly insidewrapper.forward()and adds a regression test that locks the contract.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
wrapper.forward()—type(x_out) is torch.Tensor,type(z) is torch.Tensor,type(p) is torch.Tensor,x_out.shape == decode_out.shape,z.shape == posterior.squeeze(2).shape, plusp is posterior(identity preservation of the encode-side tuple member). No tolerance bands; no statistical tests. Source authority is the live source ofcomfy/ldm/seedvr/vae.pyon the issue's base branch (issue_101HEAD80c91503), captured verbatim under## Ground Truth Probes.Binding parent-issue directives quoted verbatim from pollockjj/mydevelopment#192 issue body (the tracking issue this plan finalizes):
These five directives bound the scope of every AC below. The wrapper.encode / wrapper.decode methods remain bit-identical; the parent class
VideoAutoencoderKL(forward, encode, decode_, slicing_, tiled_) is untouched; signatures ofencode()/decode_()/decode()/forward()are preserved verbatim; the test harness setsoriginal_image_videoto a 5-D tensor on the standin even when the stub bypasses the guard, so the test honors Boss's directive on guard-state setup.Tools, Pipeline, and Measurements
Plan Foundations Comment URL: https://github.com/pollockjj/mydevelopment/issues/192#issuecomment-4382275426
Plan Foundations Comment Pin:
comment-id=IC_kwDOR2e1q88AAAABBTQ3Yg edited-at=2026-05-05T19:17:44ZExisting 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 invocation; sister testseedvr_vae_forward_test.pyexercises the same venvtorch.venv/pin on the deliverable slot/home/johnj/dev_cuda_1/ComfyUI/.venv/comfy.ldm.seedvr.vae.VideoAutoencoderKLWrapperissue_101HEAD80c91503gitast,inspect,re.venv/Pipeline: edit one method body in one source file (
comfy/ldm/seedvr/vae.py,VideoAutoencoderKLWrapper.forward, lines 2228–2232 on the issue_101 side) → add one new test filetests-unit/comfy_test/seedvr_vae_wrapper_forward_test.py→ runpytestagainst the new test on issue_192 HEAD (post-fix capture) and against the same test withvae.pyreverted toissue_101:comfy/ldm/seedvr/vae.py(pre-fix capture) → commit pytest logs, AST-extracted forward source, grep transcripts, and scope-boundedgit difftogithub_issues/192/slice1/on the bookkeeping branch.Measurements: the only "measurement" is binary type and shape equality on the three tensor returns of
wrapper.forward()plus identity preservation of the encode-side posteriorp. There is no metric, no anchor, no statistical 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 origin/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']— i.e.decode(no underscore) IS a member of the wrapper subclass (unlike the parentVideoAutoencoderKL, which only hasdecode_), soself.decode(z)insidewrapper.forwardresolves correctly; the bug is solely the.sampledereference on the tensor return.cd /home/johnj/dev_cuda_1/ComfyUI && git show origin/issue_101:comfy/ldm/seedvr/vae.py | python3 -c 'import ast,sys; src=sys.stdin.read(); tree=ast.parse(src); [print(f"line range: {m.lineno}-{m.end_lineno}") 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"]'line range: 2228-2232— i.e. on the issue_101 sideVideoAutoencoderKLWrapper.forwardspans exactly five lines (2228–2232). AC-4's scope-diff stanza pins every diff hunk on thevae.pyside to this range.cd /home/johnj/dev_cuda_1/ComfyUI && git show origin/issue_101:comfy/ldm/seedvr/vae.py | sed -n '2228,2232p'.sampleon the tensor return ofself.decode(z)at line 2231; that one literal is the entire bug, and removing it is the entire fix.cd /home/johnj/dev_cuda_1/ComfyUI && git show origin/issue_101:comfy/ldm/seedvr/vae.py | sed -n '2247,2335p'decode(self, z)body (lines 2247–2335 on issue_101 — the post-Comfy-Org#189 / PR #34 normalized body): begins with the four guards onoriginal_image_video(None / non-tensor / non-5-D /img_dimsNone /img_dimsnon-2-tuple /tiled_argsnon-dict), thenlatent = z.view(b, 16, -1, h, w)rescale, then eitherx = tiled_vae(latent, self, **self.tiled_args, encode=False)(whenenable_tiling) orx = super().decode_(latent), then rearrange/trim/lab_color_transfer/unsqueeze/even-dim trim, terminating atreturn x. The final return statement is a plaintorch.Tensor; no wrapper object with a.sampleattribute appears anywhere in this body. The decode contract verified here is the post-fix shapewrapper.forwardmust consume directly.cd /home/johnj/dev_cuda_1/ComfyUI && git ls-tree --name-only origin/issue_101 tests-unit/comfy_test/ | grep -E 'seedvr'issue_101HEADtests-unit/comfy_test/contains nine seedvr-related tests; none of them isseedvr_vae_wrapper_forward_test.py, so the new test the plan introduces does not yet exist on the base branch. AC-5's pre-fix-fingerprint cites GTP-5 to lock the absence ofseedvr_vae_wrapper_forward_test.py.cd /home/johnj/dev_cuda_1/ComfyUI && git show origin/issue_101:comfy/ldm/seedvr/vae.py | sed -n '2218,2226p'__init__initializesoriginal_image_video,img_dims,enable_tiling,tiled_args,freeze_encoderas attribute-named fields the test standin must populate (per the binding directive "the regression harness must set this attribute"). The standin in the new test sets these manually after__new__+nn.Module.__init__to avoid running the real__init__(which allocates the full VAE weight set).Every literal API surface the ACs below cite —
VideoAutoencoderKLWrapper,encode,decode,forward, the.sampleattribute reference on line 2231, theself.decode(z)call site (line 2231), the parent classVideoAutoencoderKLand its members, theoriginal_image_video/img_dims/enable_tiling/tiled_args/freeze_encoderinstance attributes the standin populates, thedecode_parent method, the base-branchtests-unit/comfy_test/directory contents, and the wrapper.forward line range[2228, 2232]on the issue_101 side — is anchored to one of GTP-1, GTP-2, GTP-3, GTP-4, GTP-5, GTP-6 above.Created Surface Contract
tests-unit/comfy_test/seedvr_vae_wrapper_forward_test.pyissue_192. Defines two pytest test functions that exerciseVideoAutoencoderKLWrapper.forward()against a stub built via__new__+nn.Module.__init__(mirrors the existing_make_standinpattern fromtests-unit/comfy_test/test_seedvr_vae_decode_guards.py): (1)test_wrapper_forward_returns_tensor_triple— usesmonkeypatch.setattrto replaceVideoAutoencoderKLWrapper.encodewith a stub returning canonical(z, p)andVideoAutoencoderKLWrapper.decodewith a stub returning a canonicaltorch.Tensor, setsoriginal_image_videoto a 5-D tensor andimg_dimsto a 2-tuple on the standin (per Boss's directive in the issue body even though the stub bypasses the guard), invokeswrapper.forward(x), asserts the return is a 3-tuple, asserts each member is atorch.Tensor, assertsx_out.shape == decode_out.shape, assertsz.shape == posterior.squeeze(2).shape, assertstorch.equal(x_out, decode_out), assertstorch.equal(z, posterior.squeeze(2)), and assertsp is posterior(identity preservation of the encode-side tuple member). (2)test_wrapper_forward_source_has_no_sample_access— usesinspect.getsource(VideoAutoencoderKLWrapper.forward)and asserts".sample" not in src. The test setscomfy.cli_args.args.cpu = Truewhen CUDA is unavailable, mirroring the sister test's import preamble.github_issues/192/slice1/pytest_post_fix.logissue_192. Verbatim stdout/stderr ofcd /home/johnj/dev_cuda_1/ComfyUI && python3 -m pytest tests-unit/comfy_test/seedvr_vae_wrapper_forward_test.py -vrun on issue_192 HEAD. Final non-blank summary line ends with2 passed.github_issues/192/slice1/pytest_pre_fix.logissue_192. Verbatim stdout/stderr of the same pytest invocation captured aftercd /home/johnj/dev_cuda_1/ComfyUI && git checkout origin/issue_101 -- comfy/ldm/seedvr/vae.pyis applied to the deliverable working tree (the test file from issue_192 HEAD remains in place; onlyvae.pyis reverted). Captures oneAttributeError: 'Tensor' object has no attribute 'sample'failure ontest_wrapper_forward_returns_tensor_tripleplus a passed result ontest_wrapper_forward_source_has_no_sample_access(the source check fails post-fix detection because.sampleIS in the pre-fix body — so this asserts the inverse on the pre-fix run via the failure of the same assertion the post-fix run satisfies). The deliverable working tree is restored to issue_192 HEAD viacd /home/johnj/dev_cuda_1/ComfyUI && git restore --source=HEAD comfy/ldm/seedvr/vae.pyimmediately after capture.github_issues/192/slice1/forward_source.txtissue_192. Verbatim AST-extracted source ofVideoAutoencoderKLWrapper.forwardfrom issue_192 HEADcomfy/ldm/seedvr/vae.py, produced bycd /home/johnj/dev_cuda_1/ComfyUI && python3 -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=="VideoAutoencoderKLWrapper"][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/192/slice1/forbidden_attrs_grep.logissue_192. Output ofgrep -n -E '\.sample' github_issues/192/slice1/forward_source.txt(ortruecontinuation if grep exit 1). The committed log records exit code 1 and zero matching lines.github_issues/192/slice1/scope_diff.txtissue_192. Output ofcd /home/johnj/dev_cuda_1/ComfyUI && git diff origin/issue_101..issue_192 -- comfy/ldm/seedvr/vae.py. The diff shows zero hunks outside the body ofVideoAutoencoderKLWrapper.forward(lines 2228–2232 on the issue_101 side per GTP-2);VideoAutoencoderKLWrapper.__init__,VideoAutoencoderKLWrapper.encode,VideoAutoencoderKLWrapper.decode,VideoAutoencoderKLWrapper.set_memory_limit, and the entire parent classVideoAutoencoderKLare unchanged. The artifact contains the verbatim diff plus a final stanza listing every@@-hunk header range and confirming each falls inside[2228, 2232]on the-side.github_issues/192/slice1/test_source.txtissue_192. Verbatim copy produced bycp /home/johnj/dev_cuda_1/ComfyUI/tests-unit/comfy_test/seedvr_vae_wrapper_forward_test.py github_issues/192/slice1/test_source.txt. AC-5 verifies the file defines exactly the two named test functions and their assertion shape.Slices
Slice 1: Fix VideoAutoencoderKLWrapper.forward
.sampleaccessKind: implementation
Objective: Prove that
VideoAutoencoderKLWrapper.forward()returns the tensor produced byself.decode(z)directly — without dereferencing.sample— and that the change is scoped strictly to the body ofVideoAutoencoderKLWrapper.forward(no other method body, no other class touched), with the companion seedvr regression suite still exiting pytest-green onissue_192HEAD after the wrapper.forward edit lands.Acceptance Criteria
cd /home/johnj/dev_cuda_1/ComfyUI && python3 -m pytest tests-unit/comfy_test/seedvr_vae_wrapper_forward_test.py -vexits 0 with2 passedin the summary line — verified by committed artifactgithub_issues/192/slice1/pytest_post_fix.logwhose last non-blank line ends with2 passed.AttributeError: 'Tensor' object has no attribute 'sample'ontest_wrapper_forward_returns_tensor_tripleand anAssertionError: assert ".sample" not in srcontest_wrapper_forward_source_has_no_sample_access(Diagnosis Summary §"Diagnosis Summary"; GTP-3, GTP-4)2 passedVideoAutoencoderKLWrapper.forward()returns the tensor produced byself.decode(z)directly — without dereferencing.sample— and that the change is scoped strictly to the body ofVideoAutoencoderKLWrapper.forward(no other method body, no other class touched), with the companion seedvr regression suite still exiting pytest-green onissue_192HEAD after the wrapper.forward edit lands."tests-unit/comfy_test/seedvr_vae_wrapper_forward_test.py -vproves the same observable flips across the fix:github_issues/192/slice1/pytest_pre_fix.logrecords theAttributeError: 'Tensor' object has no attribute 'sample'failure ontest_wrapper_forward_returns_tensor_tripleplus theassert ".sample" not in srcfailure ontest_wrapper_forward_source_has_no_sample_accessaftercd /home/johnj/dev_cuda_1/ComfyUI && git checkout origin/issue_101 -- comfy/ldm/seedvr/vae.py, andgithub_issues/192/slice1/pytest_post_fix.logrecords pytest exit 0 with2 passedaftercd /home/johnj/dev_cuda_1/ComfyUI && git restore --source=HEAD comfy/ldm/seedvr/vae.pyrestores issue_192 HEAD.python3 -m pytest tests-unit/comfy_test/seedvr_vae_wrapper_forward_test.py -vinvocation raisesAttributeError: 'Tensor' object has no attribute 'sample'from insidewrapper.forwardwhenvae.pyis reverted to issue_101, and the source-introspection test fails because.sampleis present in the pre-fix forward body (Diagnosis Summary §"Diagnosis Summary"; GTP-3)2 passedand zeroAttributeErrorfailuresVideoAutoencoderKLWrapper.forward()returns the tensor produced byself.decode(z)directly — without dereferencing.sample— and that the change is scoped strictly to the body ofVideoAutoencoderKLWrapper.forward(no other method body, no other class touched), with the companion seedvr regression suite still exiting pytest-green onissue_192HEAD after the wrapper.forward edit lands."VideoAutoencoderKLWrapper.forwardon issue_192 HEAD contains zero occurrences of the literal.sample— verified by committed artifactsgithub_issues/192/slice1/forward_source.txt(the extracted body) andgithub_issues/192/slice1/forbidden_attrs_grep.log(grep -n -E '\.sample' forward_source.txtexit code 1, zero matching lines).VideoAutoencoderKLWrapper.forward()returns the tensor produced byself.decode(z)directly — without dereferencing.sample— and that the change is scoped strictly to the body ofVideoAutoencoderKLWrapper.forward(no other method body, no other class touched), with the companion seedvr regression suite still exiting pytest-green onissue_192HEAD after the wrapper.forward edit lands."cd /home/johnj/dev_cuda_1/ComfyUI && git diff origin/issue_101..issue_192 -- comfy/ldm/seedvr/vae.pyproduces hunks confined to the line range ofVideoAutoencoderKLWrapper.forwardon the issue_101 side (lines 2228–2232 per GTP-2) and zero hunks touchingVideoAutoencoderKLWrapper.__init__,VideoAutoencoderKLWrapper.encode,VideoAutoencoderKLWrapper.decode,VideoAutoencoderKLWrapper.set_memory_limit, or any line of the parent classVideoAutoencoderKL(per GTP-1) — verified by committed artifactgithub_issues/192/slice1/scope_diff.txt. The artifact contains the verbatim diff plus a final stanza listing every@@-hunk header range and confirming each falls inside[2228, 2232]on the-side.VideoAutoencoderKLWrapper.forward()returns the tensor produced byself.decode(z)directly — without dereferencing.sample— and that the change is scoped strictly to the body ofVideoAutoencoderKLWrapper.forward(no other method body, no other class touched), with the companion seedvr regression suite still exiting pytest-green onissue_192HEAD after the wrapper.forward edit lands."tests-unit/comfy_test/seedvr_vae_wrapper_forward_test.pyon issue_192 defines exactly two pytest test functions whose names aretest_wrapper_forward_returns_tensor_tripleandtest_wrapper_forward_source_has_no_sample_access; the first usesmonkeypatch.setattrto stubVideoAutoencoderKLWrapper.encodeandVideoAutoencoderKLWrapper.decode, setswrapper.original_image_videoto a 5-Dtorch.Tensorandwrapper.img_dimsto a 2-tuple on the__new__+nn.Module.__init__standin, invokeswrapper.forward(x), and asserts (a) the return is a 3-tuple, (b)type(x_out) is torch.TensorANDtype(z) is torch.TensorANDtype(p) is torch.Tensor, (c)x_out.shape == decode_out.shape(binary, no tolerance band), (d)z.shape == posterior.squeeze(2).shape(binary), (e)torch.equal(x_out, decode_out)ANDtorch.equal(z, posterior.squeeze(2)), (f)p is posterior(identity); the second runsinspect.getsource(VideoAutoencoderKLWrapper.forward)and asserts".sample" not in src— verified by committed artifactgithub_issues/192/slice1/test_source.txt(cp /home/johnj/dev_cuda_1/ComfyUI/tests-unit/comfy_test/seedvr_vae_wrapper_forward_test.py github_issues/192/slice1/test_source.txt) plus the AC-1 pytest log showing both test names in thePASSEDlines.VideoAutoencoderKLWrapper.forward()returns the tensor produced byself.decode(z)directly — without dereferencing.sample— and that the change is scoped strictly to the body ofVideoAutoencoderKLWrapper.forward(no other method body, no other class touched), with the companion seedvr regression suite still exiting pytest-green onissue_192HEAD after the wrapper.forward edit lands."Constraints
python3python3 -m pytest tests-unit/comfy_test/seedvr_vae_wrapper_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_192cut fromissue_101(HEAD80c91503); PR target =issue_101github_issues/192/slice1/*) land onpollockjj/mydevelopment:issue_192cut frommain; PR target =main(standard[bookkeeping] [Issue 101][eval-and-fix]pattern)VideoAutoencoderKLWrapper.forwardincomfy/ldm/seedvr/vae.py(VideoAutoencoderKLWrapper.__init__,VideoAutoencoderKLWrapper.encode,VideoAutoencoderKLWrapper.decode,VideoAutoencoderKLWrapper.set_memory_limit, and the entire parent classVideoAutoencoderKLare off-limits)encode()/decode_()/decode()/forward()signatures or return shapes (issue body explicit "plan drift" guard)pytestfrom the deliverable slot's.venv/— REUSE; no installcomfy.ldm.seedvr.vae.VideoAutoencoderKLWrapperimport path — REUSE; verified by GTP-1git,grep, AST extraction via stdlibastmodule — REUSE_make_standinshape pattern fromtests-unit/comfy_test/test_seedvr_vae_decode_guards.py— REUSE (__new__+nn.Module.__init__+ manual attribute population), already established in this codebasegithub_issues/192/slice1/are the only added paths in the bookkeeping repo.sample) → A/B pytest pair: post-fix log on issue_192 HEAD plus pre-fix log captured withvae.pytransiently reverted toorigin/issue_101(Slice 1 AC-1, Slice 1 AC-2).samplein wrapper.forward body) → AST-extracted committed source plus zero-match grep transcript (Slice 1 AC-3)git diff origin/issue_101..issue_192 -- vae.pywith hunk-range enumeration (Slice 1 AC-4)git stashor external decision deferral..gitignorerules for safe generated bulk, or discarded generated debris.issue_192(e.g. the?? github_issues/192/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 origin/issue_101 -- comfy/ldm/seedvr/vae.py) MUST be undone viagit restore --source=HEAD 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
VideoAutoencoderKL.forward(lines 2194–2207 on the pre-Init docker support (Nvidia and AMD) Comfy-Org/ComfyUI#190 issue_101 source) — same bug class but already fixed by pollockjj/mydevelopment#190 / merged PR [Issue 101][eval-and-fix] Fix VideoAutoencoderKL.forward return contract (closes pollockjj/mydevelopment#190) #44 (HEAD80c91503). Do not touch.VideoAutoencoderKLWrapper.decode(lines 2247–2335 on issue_101) — already covered by pollockjj/mydevelopment#189 / merged PR [Issue 101][eval-and-fix] Keep batch/time axes distinct for single-frame decode (closes pollockjj/mydevelopment#189) #34's tiled-path normalization plus pollockjj/mydevelopment#194 / merged PR [Issue 101][eval-and-fix] Add SeedVR2 decode state guards (closes pollockjj/mydevelopment#194) #43'soriginal_image_video/img_dims/tiled_argsguards. Do not touch.VideoAutoencoderKL.encode(),VideoAutoencoderKL.decode_(), orVideoAutoencoderKLWrapper.encode()— 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 ofwrapper.encode()/wrapper.decode()outsidewrapper.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,torch.equal(...),p is posterior).wrapper.forwardbeyond removing the.sampleaccess on line 2231. Thewith torch.no_grad() if self.freeze_encoder else nullcontext():context manager, theself.encode(x)call, and thereturn x, z, ptriple are preserved verbatim.Tracked in pollockjj/mydevelopment Comfy-Org#192 (bookkeeping PR pollockjj/mydevelopment#208).