fix(workflow-executor): drop dead-branch steps from context (PRD-433)#1623
fix(workflow-executor): drop dead-branch steps from context (PRD-433)#1623hercemer42 wants to merge 3 commits into
Conversation
1 new issue
|
Revising a step forks the run history: the orchestrator stamps the pivot card revised and the downstream branch cancelled, then re-appends live clones. The executor read that history branch-blind, so re-executed steps inherited stale AI context and the record pool offered records loaded by superseded steps (e.g. revising "Load store" proposed loading from the dead branch's owner). previousSteps now mirrors the orchestrator's own live-path filter, and each step carries lineageStepIndexes so executions persisted in the RunStore under a clone's original index resolve to the freshest generation — never to a dead branch, never by stepName (LinkTo loops make names non-unique on the live path). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The base branch's load-related rework routes BelongsTo loads through getSingleRelatedData instead of getRelatedData; the revision repro test asserted the old port call. Also rewords a test comment that referenced the ticket (review feedback). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4c3cde3 to
b608f35
Compare
|
[Claude Opus 4.8] — Review resolution on #1623 1. Inline conventions comment (test comment referencing the ticket) — agreed and fixed in b608f35. 2. qlty: "Function with many returns (count = 4): getAvailableRecordRefs" — pushing back, not fixing. The four returns are two guard-style early exits inside a 3. CI failure (Linting & Testing workflow-executor) — root cause was not the review findings: the base branch moved under the PR (#1610 reworked the load-related executor; BelongsTo loads now go through |
|
Coverage Impact Unable to calculate total coverage change because base branch coverage was not found. Modified Files with Diff Coverage (3)
🛟 Help
|
…ationale Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
86af236 to
b8a0d5d
Compare

fixes PRD-433
Problem
Revising an earlier workflow step did not discard the steps that originally ran after it. The orchestrator marks them correctly (
revisedon the pivot card,cancelledon the downstream branch, live clones re-appended withoriginalStepIndex), but the executor read the run history branch-blind in two places:toPreviousStepsfiltered only ondone && stepIndex < current→ dead-branch entries polluted the AI context for every step type.getAvailableRecordRefs) was built from the raw local RunStore → records loaded by superseded steps were still offered as sources (revising "Load store" proposed loading from the dead branch's owner instead of reloading the store), while live clones (newstepIndex) couldn't be matched to their stored records at all.Fix (executor-only — design agreed with Alban & Enki)
previousStepsnow mirrors the orchestrator's own live-path filter:!revised && !cancelled.lineageStepIndexes(own index first, then earlier same-step generations, rebuilt by the mapper from the full history — the dead entries carry the intermediate generations).BaseStepExecutor.resolveLineageExecutionwalks them freshest-first; the record pool and the previous-steps AI summary both use it.originalStepIndexdeclared inServerStepHistory(already on the wire),lineageStepIndexesadded to the strictStepschema as optional (additive, legacy producers stay valid).Why lineage groups and not
stepName: LinkTo loops are a product feature — the same step name can legitimately appear twice on the live path, so instance identity (stepIndexlineage) is the only safe key. Why latest-in-group and not root-match: a double revision with a re-execution in between leaves executions at several indexes of the same root; the root one is stale.Tests
TDD — 17 new tests written red-first across mapper, base, and the four record executors:
7 legacy executor tests updated to the new pool contract (records enter the pool only when claimed by a live previousStep). Full package suite: 858/858 green; changed files ≥90% covered on all metrics.
🤖 Generated with Claude Code
Note
Drop dead-branch steps from workflow executor context to fix revision-aware execution
previousStepsto exclude revised and cancelled history entries, mirroring the server-side live-path logic inrun-to-available-step-mapper.ts.lineageStepIndexesto eachStep, built by tracing revision chains back to the original step index, so execution data lookups prefer the freshest generation of a step.BaseStepExecutor.resolveLineageExecutionwalkslineageStepIndexesnewest-first to find the best matchingStepExecutionDatafor building previous-step summaries.RecordStepExecutor.getAvailableRecordRefsnow derives its candidate record pool fromcontext.previousSteps(live path only) instead of scanning all run-store executions, excluding records produced by dead branches.Macroscope summarized 4c3cde3. (Automatic summaries will resume when PR exits draft mode or review begins).