Skip to content

Answered a query against a parked external-stream workflow. - #76

Closed
moetemp wants to merge 3 commits into
moe/AI-198-o7-py-5-constructor-publishfrom
moe/AI-198-o7-py-6-parked-run-query
Closed

moetemp wants to merge 3 commits into
moe/AI-198-o7-py-5-constructor-publishfrom
moe/AI-198-o7-py-6-parked-run-query

Conversation

@moetemp

@moetemp moetemp commented Oct 5, 2026

Copy link
Copy Markdown
Owner

This PR fixes queries against a workflow parked on an external stream.

What changed?

When a completion answers a legacy query, _emit_external_stream_commands returns before it adds any external stream command, so neither the stream snapshot nor the progress marker goes out beside the answer. _LEGACY_QUERY_ID is held in step with Core's LEGACY_QUERY_ID. A new integration case parks a run on an empty stream, queries it, then publishes and checks that the run finishes with no failed Workflow Task.

Part of AI-198 (epic AI-37).

Why?

A parked run has no open Workflow Task, so the server sends a query on a task of its own. Core allows nothing beside the answer on that task. The instance still added the wait set it had registered, so Core refused the completion and the query timed out. That activation ran no workflow code, so there's nothing new to report anyway.

This PR comes before the channel wake on purpose. The bug is already in Max's prototype, but there it only bites a query against a parked run. From the wake PR on, every completion carries a WorkflowStreamChannels report, so on a channel server every legacy query completion has a command beside its answer. With the wake first, the continue-as-new case in test_continuation.py, where a Signal handler continues as new while a consumer waits, polls with a query and times out. The worker logs Core's refusal: "Workflow completion had a legacy query response along with other commands". With this fix first, the wake lands on a chain where queries already work.

How did you test it?

Link to a test plan if any -

  • Unit Tests
  • Staging
  • End to End Tests

Without the fix, the new case times out. With it, the case, the whole external stream suite and tests/streams pass on the dev server the fixtures start and with -E against a local channel server. The lint set is clean.

A parked Run has no open Workflow Task, so the server dispatches a query on a
task of its own and Core allows nothing beside the answer there. The instance
still reported the registered wait set, Core refused the completion, and the
query timed out.
The id is Core's, and nothing in this file said where it is defined, so a
rename over there would be found by a failing query rather than by grep.
@moetemp moetemp added the skip-changelog Changelog entry rides another PR label Oct 5, 2026
@moetemp

moetemp commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

Replaced by #105 in the v5 series (phase 1, Signal wake only). The branch stays as a pin.

@moetemp moetemp closed this Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Changelog entry rides another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant