Skip to content

feat(jobs): surface text/STRING node outputs in local jobs status as text_outputs (BE-3346) - #550

Open
mattmillerai wants to merge 4 commits into
mainfrom
matt/be-3346-jobs-text-outputs
Open

feat(jobs): surface text/STRING node outputs in local jobs status as text_outputs (BE-3346)#550
mattmillerai wants to merge 4 commits into
mainfrom
matt/be-3346-jobs-text-outputs

Conversation

@mattmillerai

Copy link
Copy Markdown
Collaborator

ELI-5

When a ComfyUI workflow has a node that produces text — like a Gemini node describing an image, or a ShowText node — that text is stored by ComfyUI but comfy jobs status never showed it. You could only get it by manually curl-ing the server's /history endpoint. This PR makes comfy jobs status include those text outputs, so tools built on comfy-cli (like comfy-local-mcp) can read captions/descriptions/VLM tags without shelling out to curl.

What changed

  • New pure helper extract_text_outputs(record) in comfy_client.py, next to extract_output_entries. For each node_id in the history record's outputs, when node_output["text"] is a list, it keeps the str items and returns {node_id: [text, ...]}, omitting nodes with no text. Dict-shape tolerant (non-dict outputs/node → skipped, never raises).
  • Wired into the local jobs status snapshot (_snapshot) as an always-present additive key "text_outputs": extract_text_outputs(body) on the history branch, {} on the queued/running branch. All existing keys (outputs, outputs_by_node, outputs_by_item, error, status) are unchanged — additive only.
  • Pretty renderer shows a bounded per-entry preview (first line, ~120 chars, [node_id] <preview>). The --json path emits the full untruncated strings, exactly like the existing error payload.

Why

Text outputs (GeminiNode image descriptions, ShowText, anything emitting ui.text) live in GET /history/<prompt_id> under outputs[node_id]["text"] as bare strings, but the media-key flatten (images/gifs/videos/audio/files, each requiring a dict with filename) drops them. This blocks local LLM/vision workflows (captioning, VLM tagging, prompt expansion) through the comfy-cli → comfy-local-mcp toolchain.

Because comfy-local-mcp's job_status returns comfy-cli's envelope data verbatim, this additive key flows through the MCP with zero code changes there (a follow-up will just update the MCP docstring + version floor).

Scope / judgment calls

  • Out of scope (v1), per the ticket: the cloud snapshot (_cloud_status_snapshot — belongs to the cloud sibling ticket), comfy download materializing text to files, and other UI-output keys (string, etc.).
  • _wait_fetch_snapshot (jobs wait) is intentionally untouched: when the server is up it reuses _snapshot (inheriting the new key); its on-disk fallback is a minimal shape and out of scope for this jobs status ticket.
  • Empty strings under text are preserved as legitimate (empty) text outputs rather than silently dropped; only non-str items in the list are filtered out.

Testing

  • New unit tests for extract_text_outputs: text present / absent / non-list text / mixed-type items (only strings kept) / non-dict outputs & node / int node-id coercion.
  • New _snapshot tests: text_outputs grouped-by-node with full untruncated strings on the history branch; {} on the no-text history branch; {} on the queued/running branch.
  • New pretty-render test asserting the per-entry preview is truncated (first line only, marker) while the full text is not rendered in pretty mode.
  • pytest (2583 passed, 37 skipped), ruff check ., and ruff format --check . all pass (verified against the CI-pinned ruff 0.15.15).

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 25 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: eb3a1292-3549-4a57-ac23-fd8a19437668

📥 Commits

Reviewing files that changed from the base of the PR and between 98325c9 and 04ee8d3.

📒 Files selected for processing (4)
  • comfy_cli/comfy_client.py
  • comfy_cli/command/jobs.py
  • tests/comfy_cli/command/test_transfer_download.py
  • tests/comfy_cli/jobs/test_jobs.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch matt/be-3346-jobs-text-outputs
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch matt/be-3346-jobs-text-outputs

Comment @coderabbitai help to get the list of available commands.

@mattmillerai mattmillerai added cursor-review Request Cursor bot review agent-coded PR authored by the agent-work loop labels Jul 17, 2026
@mattmillerai
mattmillerai marked this pull request as ready for review July 17, 2026 20:38
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Jul 17, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Cursor Review — Consolidated panel

Triggered by @mattmillerai.

⚠️ Review failed

Judge call failed (status=parse_error): Could not parse JSON findings from output. First 500 chars:
I've verified the code and line anchors. My analysis confirms: line 733 builds `f"[{node_id}] {first}"` and line 735 adds it to a Rich table cell (markup enabled by default), the line-730 guard misfires on leading-newline text, and the preview count is unbounded despite the "bounded" comment.

[
  {
    "file": "comfy_cli/command/jobs.py",
    "line": 733,
    "side": "RIGHT",
    "severity": "high",
    "body": "`node_id` and `text` are interpolated into `f\"[{node_id}] {first}\"` and handed to

Re-trigger by removing and re-adding the cursor-review label.

@bigcat88

Copy link
Copy Markdown
Contributor

This PR currently conflicts with main — GitHub reports mergeable: CONFLICTING, so it needs a rebase before I can review it and I'm skipping it in the current review sweep.

Please rebase (or merge main in) and I'll pick it up on the next pass. main moved a fair bit in the last day, including #614 (ANSI sanitisation across the pretty-print call sites) and #628 (the duplicate server_died error-code fix that had main red), so a refresh may also clear unrelated CI noise on this branch.

…st lines, cap entries (BE-3346)

Cursor review flagged three issues in the pretty-render text preview added by
this PR: node id/text are interpolated into a plain f-string handed to a Rich
table cell, so bracket-containing server text gets parsed as markup instead of
shown literally; the first-line guard returns an empty string when the text
starts with a blank line instead of skipping to the first non-blank line; and
the loop had no cap on total preview lines despite the "bounded preview"
comment. Build the preview as Text (not a markup string), strip before
splitting lines, and cap at _TEXT_PREVIEW_LIMIT entries with a "N more" note.
@mattmillerai

Copy link
Copy Markdown
Collaborator Author

Rebased onto latest main (merge commit 278ccc3, resolving the conflicts @bigcat88 flagged) and pushed a follow-up fix for the Cursor review findings that came through in the raw (unparsed) judge output on the text-output preview added by this PR:

  • Preview cells were built as plain f-strings handed to a Rich table, so server-supplied node text containing [...] would be interpreted as markup instead of rendered literally — now built as rich.text.Text so it's always literal.
  • The "first line" guard returned an empty string when text started with a blank line (\n\nactual content → blank preview) — now strips before splitting so the first non-blank line surfaces.
  • The preview loop was unbounded despite the "bounded preview" comment (only per-entry chars were capped, not entry count) — now capped at _TEXT_PREVIEW_LIMIT (20) entries with an "N more" note.

Added regression tests for all three (test_render_status_pretty_text_preview_skips_leading_blank_lines, _is_not_rich_markup, _bounds_entry_count). Full local suite (3657 passed) and ruff check/format are green.

@mattmillerai
mattmillerai requested a review from bigcat88 July 30, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-coded PR authored by the agent-work loop cursor-review Request Cursor bot review enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants