Skip to content

Report actual senders and external input in SuperStepStartInfo - #1005

Open
PratikDhanave (PratikDhanave) wants to merge 1 commit into
microsoft:mainfrom
PratikDhanaveFork:fix-superstep-sending-executors-and-external
Open

Report actual senders and external input in SuperStepStartInfo#1005
PratikDhanave (PratikDhanave) wants to merge 1 commit into
microsoft:mainfrom
PratikDhanaveFork:fix-superstep-sending-executors-and-external

Conversation

@PratikDhanave

Copy link
Copy Markdown
Contributor

Problem

stepTracer.Advance (workflow/inproc/tracer.go) builds SuperStepStartInfo from StepContext.Keys(). But StepContext is keyed by the message target (MessagesFor(target) — "messages queued for the given target executor"). So:

  • SendingExecutors reports receivers, not senders. Its doc says "the unique identifiers of Executor instances that sent messages during the previous SuperStep", but it was populated with the executors that will receive/run the step.
  • HasExternalMessages is dead code. The identity == "" branch never fires because the map key is the target ID (never empty). The external signal lives on the envelope (MessageEnvelope.SourceID / IsExternal()), which Advance never inspected — so it was always false, even for the initial external input.

Fix

Iterate the queued envelopes (step.MessagesFor(target).All()) and derive the info from each envelope: collect distinct non-empty SourceIDs as SendingExecutors, and set HasExternalMessages when any envelope IsExternal() (empty SourceID).

Test

TestSuperStepStartInfo_ReportsSendersAndExternalMessages runs start → sink with an external input and asserts: the first superstep has HasExternalMessages == true; the pure receiver sink is never listed as a sender; and the actual sender message-handler appears in SendingExecutors. Fails before the fix (HasExternalMessages=false, SendingExecutors=[sink]), passes after. Full ./workflow/... suite green under -race -shuffle.

stepTracer.Advance derived SuperStepStartInfo from StepContext.Keys(), but
StepContext is keyed by the message TARGET (MessagesFor(target)). So
SendingExecutors was populated with the executors that RECEIVE the step's
messages rather than the ones that sent them (contradicting its doc), and
HasExternalMessages was dead code: the map key is never the empty string, so
the external branch never fired.

The sender/external signal lives on each envelope: SourceID names the sender
and an empty SourceID (IsExternal) marks external input. Iterate the queued
envelopes and collect distinct non-empty SourceIDs as SendingExecutors, and
set HasExternalMessages when any envelope is external.
Copilot AI lite review requested due to automatic review settings September 6, 2026 04:26
@github-actions github-actions Bot added area:workflow Changes files in the workflow area size:medium At most 100 changed lines across at most 5 files labels Sep 6, 2026
@github-actions github-actions Bot added the pending-auto-risk Automatic risk classification is in progress label Sep 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change aligns SuperStepStartInfo with its documented semantics and adds a targeted regression test covering the previously incorrect behavior.

Pull request overview

Fixes SuperStepStartInfo reporting in the in-proc workflow tracer by deriving sender/external-input metadata from queued MessageEnvelopes (source-of-truth), rather than from StepContext’s target-keyed map.

Changes:

  • Update stepTracer.Advance to compute SendingExecutors from envelope.SourceID and HasExternalMessages from envelope.IsExternal().
  • Preserve determinism/uniqueness of SendingExecutors via sort + compact.
  • Add a regression test validating correct sender vs receiver reporting and external-input detection.
File summaries
File Description
workflow/inproc/tracer.go Build SuperStepStartInfo from message envelopes so senders and external inputs are reported correctly.
workflow/inproc/events_test.go Adds regression test ensuring senders/external inputs are correctly reflected in SuperStepStartInfo.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot added risk:low Limited blast radius and straightforward rollback and removed pending-auto-risk Automatic risk classification is in progress labels Sep 6, 2026
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Scope: user-visible behavior (internal stepTracer.Advance logic change that alters the values reported in the already-public SuperStepStartInfo.SendingExecutors / HasExternalMessages fields consumed via SuperStepStartedEvent)

Changed Go contract: No exported types/fields were added, removed, or renamed. workflow.SuperStepStartInfo.SendingExecutors and .HasExternalMessages (declared in workflow/event.go) keep their existing shapes; only the unexported stepTracer.Advance (workflow/inproc/tracer.go) computation changed to derive these values from each queued MessageEnvelope's SourceID/IsExternal() instead of the StepContext map keys (which are message targets, not senders).

Upstream evidence reviewed:

  • dotnet/src/Microsoft.Agents.AI.Workflows/SuperStepStartInfo.cs — identical concept and doc: "The unique identifiers of Executor instances that sent messages during the previous SuperStep" for SendingExecutors, and HasExternalMessages for external input, confirming the Go doc comment the PR now honors is the same cross-repo contract.
  • dotnet/src/Microsoft.Agents.AI.Workflows/Execution/StepContext.csQueuedMessages/MessagesFor(target) is keyed by message target, mirroring Go's StepContext.MessagesFor(target).
  • dotnet/src/Microsoft.Agents.AI.Workflows/Execution/MessageEnvelope.cs — sender identity and externality live on the envelope (Source, SourceId, IsExternal), the same place Go's fix now reads SourceID/IsExternal() from.
  • dotnet/src/Microsoft.Agents.AI.Workflows/InProc/InProcStepTracer.cs — the reference tracer implementation.

Result: aligned. This is a Go-internal correctness fix that brings the computed values in line with the documented SuperStepStartInfo contract, which matches the equivalent .NET field names, docs, and target-keyed StepContext/envelope-sourced design. No public Go API surface changed, so public-api-change is not applicable, and no cross-repo divergence was introduced.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by Go API Consistency Review Agent · copilot · auto · 69.5 AIC · ⌖ 5.47 AIC · ⊞ 9.5K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:workflow Changes files in the workflow area risk:low Limited blast radius and straightforward rollback size:medium At most 100 changed lines across at most 5 files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants