Skip to content

fix(web): resolve inline-expanded subworkflow to newest invocation on loop-back - #364

Merged
Jason Robert (jrob5756) merged 1 commit into
mainfrom
fix/361-stale-subworkflow-iteration
Aug 3, 2026
Merged

fix(web): resolve inline-expanded subworkflow to newest invocation on loop-back#364
Jason Robert (jrob5756) merged 1 commit into
mainfrom
fix/361-stale-subworkflow-iteration

Conversation

@jrob5756

Copy link
Copy Markdown
Collaborator

Summary

Fixes #361.

The dashboard's inline-expanded subworkflow view resolved a repeated slotKey child SubworkflowContext via Array.prototype.findIndex, which returns the first (oldest) match. When a loop-back route re-invokes the same sequential subworkflow, the engine/store correctly appends a new sibling context, but the inline view kept pinning its childContextKey to the stale, already-completed first invocation instead of the live one — even though double-click navigation and the Activity tab correctly tracked the live run.

Root cause

Two call sites in graph-layout.ts used findIndex (first-match) instead of the newest-first matching convention already established elsewhere in the codebase:

Fix

  • collectExpandableContextKeys and layoutContext's inline-expand branch for type: workflow steps now match slotKey newest-first, consistent with the rest of the codebase.
  • Added regression tests simulating a subworkflow that completes once and is then re-invoked via a loop-back route, verifying both fixed call sites resolve to the newest (live) context rather than the stale completed one. Verified (via stash/rerun) that both new tests fail without the fix and pass with it.
  • Rebuilt static/ via make build-frontend so the fix ships in the bundled dashboard.

Testing

  • npx vitest run — 53/53 tests pass
  • npx tsc -b — clean typecheck

Review

Ran code-reviewer, pr-test-analyzer, and comment-analyzer sub-agents on the diff; addressed all findings (added a status assertion, tightened two comments). code-simplifier found no further simplification opportunities.

… loop-back

The dashboard's inline-expanded subworkflow view resolved a repeated
slotKey child SubworkflowContext via Array.prototype.findIndex, which
returns the first (oldest) match. When a loop-back route re-invokes the
same sequential subworkflow, the engine/store correctly appends a new
sibling context, but the inline view kept pinning its childContextKey to
the stale, already-completed first invocation instead of the live one —
even though double-click navigation and the Activity tab correctly
tracked the live run.

Fix both affected call sites in graph-layout.ts (collectExpandableContextKeys
and layoutContext's inline-expand branch for type: workflow steps) to match
newest-first, mirroring the existing convention already used elsewhere
(workflow-store.ts::findChildContext/resolveSlotPath, issue #145; and
hooks/use-deep-link.ts::resolveSubworkflowPath).

Adds regression tests simulating a subworkflow that completes once and is
then re-invoked via a loop-back route, verifying both fixed call sites
resolve to the newest (live) context rather than the stale completed one.

Fixes #361

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jrob5756
Jason Robert (jrob5756) force-pushed the fix/361-stale-subworkflow-iteration branch from 5e5e39c to 37184be Compare August 3, 2026 21:20
@jrob5756
Jason Robert (jrob5756) merged commit 5dc2002 into main Aug 3, 2026
9 checks passed
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.

Dashboard: inline-expanded subworkflow shows stale iteration after loop-back re-invocation

1 participant