Skip to content

Conversation

Copy link

Copilot AI commented Nov 8, 2025

Adds backpropagation to allow nodes to send data upstream, enabling state updates, memory persistence across executions, and UI feedback loops.

Changes

Core Types

  • IComputeResult: Added optional backpropagate?: any field for return values
  • NodeInfo: Added optional backpropagate(data, fromNode, fromConnection) handler

Flow Engine

  • Detects backpropagate field in compute/computeAsync results
  • Automatically invokes source node's backpropagate handler if defined
  • Works symmetrically for both sync and async execution paths

Example Usage

// Source node receives feedback
nodeInfo: {
  compute: (input) => ({ result: input, output: input }),
  backpropagate: (data) => {
    localState.weights.update(data.gradient);  // Update for next execution
    updateUI(`Gradient: ${data.gradient}`);     // Reflect in UI
  }
}

// Downstream node sends feedback
nodeInfo: {
  compute: (input) => ({
    result: processed,
    output: processed,
    backpropagate: { gradient: 0.5, loss: 0.02 }
  })
}

Testing & Documentation

  • 8 unit tests covering type safety, sync/async flows, and usage patterns
  • Example node implementation (backpropagation-example.ts)
  • API documentation (BACKPROPAGATION.md)

Design Notes

  • Fully opt-in: zero impact on existing nodes
  • Connection-aware: backpropagation follows specific connection paths
  • One-hop only: receiving node must explicitly propagate further if needed

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • download.cypress.io
    • Triggering command: node index.js --exec install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

I want to implement "backpropagation" in web-flow-executor for node-types beside "compute" and "computeAsync" so that nodes can send information back to nodes so that it can change the local node state which can be used in the UI of the node or just it's memory which will be used in a next triggering of that node's compute(Async) function


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add backpropagation to web-flow-executor node types Implement backpropagation mechanism for bidirectional node communication Nov 8, 2025
Copilot AI requested a review from devhelpr November 8, 2025 19:25
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.

2 participants