Skip to content

Add client_id to progress_text binary WS messages#12540

Open
christian-byrne wants to merge 4 commits intomasterfrom
progress-text-prompt-id
Open

Add client_id to progress_text binary WS messages#12540
christian-byrne wants to merge 4 commits intomasterfrom
progress-text-prompt-id

Conversation

@christian-byrne
Copy link
Contributor

@christian-byrne christian-byrne commented Feb 20, 2026

Summary

Add prompt_id to progress_text binary WS messages (eventType 3) for parallel workflow execution support.

Changes

  • Add supports_progress_text_metadata feature flag to SERVER_FEATURE_FLAGS
  • Extend send_progress_text() to accept optional prompt_id param with auto-resolution from get_executing_context() and last_prompt_id fallback
  • When client advertises support, send new binary format: [4B event_type][4B prompt_id_len][prompt_id][4B node_id_len][node_id][text]
  • Legacy format preserved for clients without the flag

Wire Format

New (when supports_progress_text_metadata flag is set):

[4B event_type=3][4B prompt_id_len][prompt_id_bytes][4B node_id_len][node_id_bytes][text_bytes]

Legacy (unchanged):

[4B event_type=3][4B node_id_len][node_id_bytes][text_bytes]

Deployment

Can be deployed independently in any order — feature flag negotiation ensures graceful degradation.

Part of COM-12671

API Node PR Checklist

Scope

  • Is API Node Change

Pricing & Billing

  • Need pricing update
  • No pricing update

If Need pricing update:

  • Metronome rate cards updated
  • Auto‑billing tests updated and passing

QA

  • QA done
  • QA not required

Comms

  • Informed Kosinkadink

@notion-workspace
Copy link

@christian-byrne christian-byrne added the Core Core team dependency label Feb 20, 2026
@christian-byrne christian-byrne force-pushed the progress-text-prompt-id branch 2 times, most recently from f817b3f to 0f9e15f Compare February 20, 2026 08:33
@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 30213e6e-4f3d-47ea-9427-50b9b94a86e0

📥 Commits

Reviewing files that changed from the base of the PR and between 83df2a8 and 09e9bdb.

📒 Files selected for processing (1)
  • server.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • server.py

📝 Walkthrough

Walkthrough

This PR adds a server feature flag supports_progress_text_metadata and extends progress-text handling to include an optional prompt_id. PromptServer.send_progress_text gains an optional prompt_id and, when the target client advertises the flag, encodes a length-prefixed prompt_id before node_id and text. Call sites were updated to retrieve and pass prompt_id from execution context: client utilities call get_executing_context(), image nodes include prompt_id in hidden outputs, IO/typing exposes PROMPT_ID, and execution/input construction threads prompt_id through get_input_data and sync payloads.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title mentions 'client_id' but the actual changes add 'prompt_id' to progress_text messages, which is the primary change throughout the changeset. Update the title to reflect the main change: 'Add prompt_id to progress_text binary WS messages' or similar, to accurately represent the changeset.
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description accurately details the addition of prompt_id to progress_text messages, the new feature flag, wire format changes, and deployment considerations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@comfy_api_nodes/util/client.py`:
- Around line 449-452: The lazy import of get_executing_context inside the block
that calls PromptServer.instance.send_progress_text triggers the pipeline linter
import-outside-toplevel warning; either move the import to the top of the module
(add "from comfy_execution.utils import get_executing_context" alongside other
imports) and remove the in-function import so the call in the code uses the
top-level symbol, or if that creates a circular import, keep the lazy import but
add a pylint disable comment (e.g., # pylint: disable=import-outside-toplevel)
immediately above the local import to acknowledge the intentional pattern;
update the code around get_executing_context and
PromptServer.instance.send_progress_text accordingly.

@Kosinkadink
Copy link
Member

Getting the prompt_id inside the node is a bit ugly at the moment. Maybe this is worth adding prompt_id as a hidden type, so that the context id can be automatically passed on the HiddenHolder when declared on the node?

Add supports_progress_text_metadata feature flag and extend
send_progress_text() to accept optional prompt_id param. When
prompt_id is provided and the client supports the new format,
the binary wire format includes a length-prefixed prompt_id field:

  [4B event_type][4B prompt_id_len][prompt_id][4B node_id_len][node_id][text]

Legacy format preserved for clients without the flag.

Both callers (nodes_images.py, client.py) updated to pass prompt_id
from get_executing_context().

Part of COM-12671: parallel workflow execution support.

Amp-Thread-ID: https://ampcode.com/threads/T-019c79f7-f19b-70d9-b662-0687cc206282
- Add PROMPT_ID as a new hidden type in the Hidden enum, HiddenHolder,
  HiddenInputTypeDict, and execution engine resolution (both V3 and legacy)
- Refactor GetImageSize to use cls.hidden.prompt_id instead of manually
  calling get_executing_context() — addresses reviewer feedback
- Remove lazy import of get_executing_context from nodes_images.py
- Add docstrings to send_progress_text, _display_text, HiddenHolder,
  and HiddenHolder.from_dict

Amp-Thread-ID: https://ampcode.com/threads/T-019ca1cb-0150-7549-8b1b-6713060d3408
@christian-byrne christian-byrne marked this pull request as ready for review February 28, 2026 10:31
@christian-byrne christian-byrne changed the title Add prompt_id to progress_text binary WS messages Add client_id to progress_text binary WS messages Feb 28, 2026
@christian-byrne
Copy link
Contributor Author

christian-byrne commented Feb 28, 2026

We actually need to be sending client_id AND prompt_id, updating PR now.

@christian-byrne christian-byrne marked this pull request as draft February 28, 2026 10:47
- Default sid to self.client_id when not explicitly provided, matching
  every other WS message dispatch (executing, executed, progress_state, etc.)
- Previously sid=None caused broadcast to all connected clients
- Format signature per ruff, remove redundant comments
- Add unit tests for routing, legacy format, and new prompt_id format

Amp-Thread-ID: https://ampcode.com/threads/T-019ca3ce-c530-75dd-8d68-349e745a022e
Copy-paste stub tests don't verify the real implementation and add
maintenance burden without meaningful coverage.

Amp-Thread-ID: https://ampcode.com/threads/T-019ca3ce-c530-75dd-8d68-349e745a022e
@christian-byrne christian-byrne marked this pull request as ready for review March 4, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Core Core team dependency Core-Important

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants