Skip to content

fix(run): the edges inside a workflow instance are drawn from the run it nests - #239

Merged
endrix merged 2 commits into
mainfrom
fix/instance-run-overlay
Nov 24, 2026
Merged

endrix merged 2 commits into
mainfrom
fix/instance-run-overlay

Conversation

@endrix

@endrix endrix commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

What was wrong

A wfpy workflow instance, c = counted(instance="wf-out/<run>"), nests a past run. When the parent runs, it hands on the outputs that run recorded and runs nothing of counted, so the parent's run records nothing inside c.

Stepping into c from the parent, the view took the latest run of any workflow on its trail. Once the parent had run, that was the parent's run, so none of the edges inside the instance were green.

What changes

  • Node: GraphGModelSource carries the producer's meta.workflowInstance.run as WorkflowDiagramMetadata.RECORDED_RUN (wf:recordedRun). wfpy already exports it, so no producer change is needed.

  • Crumb: a drill-down into such a node puts the run on the crumb it adds (recordedRun). It is kept by:

    • the client's breadcrumb (buildNavigationTrail, parseTrail, normalizeTrail);
    • the extension's trail rewrite (glsp-activation.ts);
    • the server's trail parse (parseNavigationTrailArg).
  • Server (recorded-run.ts): the run a view is drawn from is the deepest crumb's past run. It is resolved as the producer reads it: relative to the file of the crumb above, with ~ for the home folder, and either the run's folder or its record.

  • Storage: a view at or below that crumb is drawn from that run:

    • its overlay is read from the run's folder, with instance paths measured from the crumb;
    • its agents come from that run's run.wf-agent-context.json;
    • the run picker lists that run alone.

    The parent's latest or chosen run no longer applies inside the instance.

Tests

  • recorded-run-overlay.test.ts uses a real run log in which counted ran first and parent after it:
    • the nested view shows the recorded run's tokens, including when the parent's run is chosen;
    • the run is found whether it is written as a folder or as its record;
    • a workflow nested inside the instance reads that run's records of it;
    • the run picker and the agents come from that run;
    • without recordedRun, the view takes the parent's run (the old behaviour, with no tokens);
    • recordedRunOfTrail resolution;
    • the node gets the arg.
  • recorded-run-crumb.test.ts: a double-click on an instance node puts the run on the crumb, and the breadcrumb keeps it for views further down. An ordinary nested workflow gets no run on its crumb.

Live check (wfpy harness)

inst_child.py (counted: Produce → Double → Num) was run first, then inst_parent.py, which nests that run as c. I opened inst_parent.py and stepped into c:

  • before the fix, 0 of 4 edges were green;
  • after the fix, 4 of 4 are green, carrying 7 and 14.

An ordinary nested workflow (sub_agents.py › child) still shows 12 of 12 green.

Review (/code-review medium), fixed in 8085ee1

  1. (important) Back at the parent. The client carried the instance's run as the selected run, so the parent view found none of its own runs. A requested run that is not one of the view's runs is now ignored there (runChosenFor), and the parent draws its own latest run. Checked live: after c, clicking the parent crumb shows 4 of 4 green.
  2. (important) A moved run. The trace used the run's stale outDir. The overlay's outDir is now the folder the run was found in.
  3. (important) Open View of a recorded instance. That view had no run on its crumb. The context menu item, WorkflowOpenViewAction and requestView now carry recordedRun.
  4. (important, not changed) Agents in a view below the instance are matched by bare name. wfpy's agent records carry no instance path, and every nested view matches agents this way, not only views inside an instance. This PR keeps that rule and does not add a new one.
  5. (nit) An unreadable run. The run picker now lists the recorded run under its folder's name, and the missing run is logged.
  6. (nit) A stale running. A recorded run is drawn as finished, with nothing active: the instance runs nothing.
  7. (nit) Windows ~\ paths are now read as the home folder.
  8. (nit) Workflow names are trimmed, as elsewhere.

https://claude.ai/code/session_011UYzzUKxNqKPdmLsRmJ6Xu

… it nests

A nested workflow answered by a past run (child(instance="wf-out/<run>"))
runs nothing when its parent runs: the parent's runs hand on what that run
recorded and record nothing inside the instance. Stepped into from the
parent, the view took the latest run of any workflow on the trail, the
parent's once it had run, and its edges showed no token.

- The producer's meta.workflowInstance.run is carried on the node
  (WorkflowDiagramMetadata.RECORDED_RUN), and on the crumb a drill-down
  adds (recordedRun), kept by the client's breadcrumb, the extension's
  trail rewrite and the server's trail parse.
- recorded-run.ts: the view's run is the deepest crumb's past run,
  resolved as the producer reads it (relative to the file of the crumb
  above, ~, a run folder or its record).
- A view at or below that crumb reads that run's overlay, its instance
  paths measured from the crumb; its agents come from that run; the run
  picker lists that run alone. The latest or chosen run of the parent no
  longer applies there.

Claude-Session: https://claude.ai/code/session_011UYzzUKxNqKPdmLsRmJ6Xu
- Back at the parent, the client carries the instance's run as the one
  chosen: a run asked for that is none of the view's runs is not chosen
  there (runChosenFor), so the parent draws its own latest run and its
  picker selects one of its runs.
- Open View of an instance answered by a past run (a view the node
  offers) keeps the run on its crumb: the context menu item, the
  WorkflowOpenViewAction and requestView carry recordedRun.
- The recorded run is read where it was found: its outDir is the folder
  it was found in (the queue trace and wf:viewerOverlayOutDir follow a
  moved run), and nothing runs in it (running false, nothing active).
- The run picker lists the recorded run by its folder's name when it
  cannot be read; a run not found is logged.
- `~\` is the home folder too; a record's workflow name is trimmed.

Claude-Session: https://claude.ai/code/session_011UYzzUKxNqKPdmLsRmJ6Xu
@endrix
endrix merged commit 2bf68d1 into main Nov 24, 2026
1 check passed
@endrix
endrix deleted the fix/instance-run-overlay branch November 24, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant