Skip to content

agent/89: Flaky test: status_reports_stopped_when_saved_comfyui_pid_is_gone races other tests for its "unused" port - #90

Merged
mikeroysoft-agent merged 1 commit into
mainfrom
agent/89
Oct 25, 2026
Merged

mikeroysoft-agent merged 1 commit into
mainfrom
agent/89

Conversation

@mikeroysoft-agent

Copy link
Copy Markdown
Collaborator

Closes #89

Gate report

Gate report

Host toolchain

ROCm: unavailable
Kernel: 7.2.5-3-omarchy
amdgpu: unavailable

  • conflict-markers: PASS
  • clippy: PASS
  • tests: PASS
  • smoke: PASS
  • leak-scan: PASS

@mikeroysoft-agent

Copy link
Copy Markdown
Collaborator Author

Review: issue #89, flaky ComfyUI stale-state test

Scope: The diff changes one line in one file: apps/rocm/src/comfyui.rs, inside the #[cfg(test)] mod tests block. The issue estimated "1 line, 1 file", and the diff matches.

Spec check (issue #89 acceptance criteria and agent brief)

Criterion Status Evidence
The test no longer calls unused_local_port() and uses port 0 instead Met review.diff:9-10 replaces unused_local_port()? with let port = 0;. In the snapshot, the test body at apps/rocm/src/comfyui.rs:2736-2762 has no unused_local_port, so the issue's awk … | grep -c check prints 0.
The existing assertions are unchanged Met The diff doesn't touch them. In the snapshot they are still status: stopped, next step: rocm comfyui start and !status: starting or running (apps/rocm/src/comfyui.rs:2758-2760).
unused_local_port() and the other tests are left alone Met The helper at :2306 is unchanged. Its other callers at :3976, :4071, :4141, :4291 and :4683 are untouched.
No changes to non-test code Met The only hunk is in mod tests (review.diff:5).
The full suite and clippy pass Met (per gate) The gate report shows tests: PASS and clippy: PASS. Neither "no longer used" nor "dead code" problems can come up, because unused_local_port still has 5 callers.
Passes 20 times in a row Not checked here I didn't run builds or tests, as instructed. The change makes the test deterministic: nothing can listen on 127.0.0.1:0, so the status probe can never get a connection and can't mistake another test's listener for a running ComfyUI.

The type is fine. port is passed to ComfyUiState { port, .. } at :2747, so the literal 0 is inferred as u16, the same type unused_local_port() returned.

Standards check

AGENTS.md and CONTRIBUTING.md have no rule about changelogs or test-only changes that this diff would need to meet. The diff adds no new abstraction.

Required fixes

None.

Optional suggestions

None.

VERDICT: APPROVE

@mikeroysoft-agent mikeroysoft-agent added factory-approved Reviewer APPROVE recorded by the factory; merge-stage precondition and removed factory-approved Reviewer APPROVE recorded by the factory; merge-stage precondition labels Oct 25, 2026
@mikeroysoft-agent

Copy link
Copy Markdown
Collaborator Author

Standards

I found no violations. The diff changes one line inside a #[cfg(test)] test body (review.diff:9-10). No documented convention applies to it, and the gate already covers clippy.

Spec (issue #89)

I checked each acceptance criterion against the diff and the snapshot:

  • Does not call unused_local_port(); uses port 0. Met. review.diff:9-10 replaces let port = unused_local_port()?; with let port = 0;. In the snapshot, the test body (snapshot/apps/rocm/src/comfyui.rs:2736-2762) has no other call to unused_local_port, so the issue's awk … | grep -c check would print 0.
  • Existing assertions unchanged. Met. The diff has only that one hunk. The assertions for status: stopped, next step: rocm comfyui start and !starting or running at snapshot/.../comfyui.rs:2758-2760 are untouched.
  • Port 0 can never be reached. I checked the code path the test exercises. evaluate_running_state (comfyui.rs:1173-1182) probes the port through endpoint_is_reachable → TcpStream::connect_timeout (comfyui.rs:1211-1217), and nothing treats port 0 as a special value. A connection to 127.0.0.1:0 always fails. Because pid: 0, process_is_running returns false (comfyui.rs:1221), so the test can only resolve to Stopped. That removes the race.
  • Out of scope respected. Met. unused_local_port() (comfyui.rs:2306) is unchanged. The other callers at 3976, 4071, 4141, 4291 and 4683 are unchanged. No non-test code is touched.
  • 20 runs in a row / full suite / clippy. The gate report covers these (tests PASS, clippy PASS). I did not run anything.

Required fixes

None.

Optional suggestions

None.

VERDICT: APPROVE

@mikeroysoft-agent mikeroysoft-agent added factory-approved Reviewer APPROVE recorded by the factory; merge-stage precondition and removed factory-approved Reviewer APPROVE recorded by the factory; merge-stage precondition labels Oct 25, 2026
Signed-off-by: mikeroysoft-agent <339795455+mikeroysoft-agent@users.noreply.github.com>
@mikeroysoft-agent

Copy link
Copy Markdown
Collaborator Author

Findings for issue #89

Scope: The diff changes 1 line in 1 file (apps/rocm/src/comfyui.rs), and only inside mod tests. This matches the issue's estimated size and the agent brief.

Spec check against issue #89

  • The test no longer calls unused_local_port() and uses port 0: met. review.diff:9-10 swaps let port = unused_local_port()?; for let port = 0;. Running the issue's own awk … | grep -c unused_local_port on the snapshot test body finds 0 matches.
  • Existing assertions unchanged: met. The diff contains no assertion lines. The snapshot test body still asserts status: stopped, next step: rocm comfyui start and !… "status: starting or running".
  • Out of scope respected: met. unused_local_port() and the other tests that call it are untouched; the other callers remain in the file. No non-test code changes.
  • 20 consecutive runs, full cargo test -p rocm, clippy: the gate report is the authority here: tests PASS and clippy PASS. I did not run the 20-run loop, as instructed. A literal port of 0 cannot be bound by any other test, so the race the issue describes cannot happen.
  • Type inference: let port = 0; takes its type from ComfyUiState { port, … }, so no cast or annotation is needed. Clippy passed.

Standards check

  • The change follows the existing test style and adds no new abstraction. There is nothing in AGENTS.md or CONTRIBUTING.md that this one-line test fix conflicts with.

Required fixes

None.

Optional suggestions

None.

VERDICT: APPROVE

@mikeroysoft-agent mikeroysoft-agent added the factory-approved Reviewer APPROVE recorded by the factory; merge-stage precondition label Oct 25, 2026
@mikeroysoft-agent
mikeroysoft-agent merged commit f2abe50 into main Oct 25, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

factory-approved Reviewer APPROVE recorded by the factory; merge-stage precondition

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: status_reports_stopped_when_saved_comfyui_pid_is_gone races other tests for its "unused" port

1 participant