Skip to content

replay: a step object reused at two flow positions maps to one node id #6015

Open

Description

@MervinPraison

Summary

In Replay's graph and events (#6010), a step object that is used at two positions in one AgentFlow is mapped by id(obj). Both positions therefore get the same node_id, and the live highlight always lands on the first position.

Reproduce

from praisonaiagents import AgentFlow
def review(ctx): return "ok"
flow = AgentFlow(name="f", steps=[review, "draft", review])   # same object twice
# to_graph(flow): two step nodes (step:review, step:review#2), but step events for
# both executions carry node_id "step:review"

Fix direction

Track the step's position at run time (the executor already knows the index or path) and map it to the positional id (step:review#2) when emitting step_start/step_end, instead of looking up id(step_obj). Add a test with the same object at two positions, sequentially and inside a Loop.

Reported by the FINAL review of #6010 (Greptile P1, item 2); deferred as non-blocking.

Activity

  1. dajiaohuang commented on Oct 26, 2026

    @dajiaohuang
    Contributor

    I confirmed the current recorder resolves a step span through graph.ids.get(id(step)), so two positions sharing one callable cannot select distinct graph nodes. A simple per-object occurrence counter is not sufficient: a Loop revisits one position and should keep the same node id across iterations, while two positions using the same object need different ids. The executor should pass the graph position/path into span creation, preserving it through nested pattern execution. This also touches the step emission path being modified by the active #6016 variable-recording work; I am not publishing a competing workflows.py rewrite. A regression should assert both step_start and step_end IDs for two shared-callable positions, and stable IDs for those positions over multiple loop iterations. This is diagnosis/integration context, not a claim that #6016 already fixes this issue.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingclaudeAuto-trigger Claude analysisorigin/outsider

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions