Skip to content

wave chat: Phase 3 — cascade control #148

@nextlevelshit

Description

@nextlevelshit

Parent: #113
Depends on: Phase 2 (step manipulation)

Problem

After rewriting or reverting a step, downstream steps may consume stale artifacts. Users need visibility into what's stale and control over how to propagate changes.

Design

Stale artifact detection

Walk the pipeline DAG forward from a modified step. For each downstream step, check if its injected artifacts have been modified (mtime comparison against step completion time).

// Added to StepController interface
GetStaleDownstream(runID, stepID string) ([]StaleStep, error)
CascadeFrom(ctx context.Context, runID, stepID string, targets []string) error

type StaleStep struct {
    StepID       string
    Reasons      []string // Why it's stale (e.g., "consumes artifact X from modified step Y")
    AffectedArtifacts []string
}

Reuse existing infrastructure

  • StaleArtifactDetector from validation.go — already detects mtime-based staleness
  • ResumeManager.createResumeSubpipeline() — creates subpipeline from step forward
  • ResumeManager.executeResumedPipeline() — executes subpipeline
  • DAG topology from DAGValidator.TopologicalSort()

Cascade modes

After detecting stale steps, present the user with options:

  1. Cascade: Re-run all stale downstream steps automatically
  2. Selective: Let user pick which steps to re-run (interactive prompt)
  3. Stop: Leave stale artifacts as-is (user acknowledges staleness)

Implementation approach

  1. Generalize StaleArtifactDetector to work with any pipeline (currently prototype-only)
  2. Add GetStaleDownstream() that walks inject_artifacts references forward
  3. Add CascadeFrom() that creates a subpipeline of selected targets and executes
  4. Add stale markers to state store (tag-based: stale:<step-id>)
  5. Update wave chat workspace CLAUDE.md to include stale step warnings

Files to create/modify

File Action
internal/pipeline/cascade.go Create — Cascade detection and execution
internal/pipeline/cascade_test.go Create — Tests
internal/pipeline/validation.go Modify — Generalize StaleArtifactDetector
internal/pipeline/stepcontroller.go Modify — Add cascade methods
internal/pipeline/chatworkspace.go Modify — Stale warnings in CLAUDE.md

Acceptance criteria

  • GetStaleDownstream() correctly identifies all steps consuming artifacts from modified step
  • CascadeFrom() re-runs selected steps in topological order
  • Stale detection works for any pipeline (not just prototype)
  • Chat workspace shows stale warnings
  • All tests pass with -race

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions