ruvnet/ruflo · error · GasTownError

DEPENDENCY_CYCLE

DEPENDENCY_CYCLE

Error message

Cannot compute execution order: dependency cycle detected

What it means

getExecutionOrder() performed a topological sort of the convoy's beads (WASM or JS) and the result reported a dependency cycle, so no valid execution order exists. The cycle must be broken (fix blockedBy/blocks references) before ordering can be computed.

Source

Thrown at v3/plugins/gastown-bridge/src/convoy/observer.ts:520

   */
  async getExecutionOrder(convoyId: string): Promise<string[]> {
    ConvoyIdSchema.parse(convoyId);

    const convoy = this.tracker.getConvoy(convoyId);
    if (!convoy) {
      throw ConvoyError.notFound(convoyId);
    }

    const beads = await this.fetchBeads(convoy.trackedIssues);

    if (this.config.useWasm && this.wasmModule) {
      try {
        const wasmNodes = this.beadsToWasmNodes(beads);
        const resultJson = this.wasmModule.topo_sort(JSON.stringify(wasmNodes));
        const result: TopoSortResult = JSON.parse(resultJson);

        if (result.hasCycle) {
          throw new GasTownError(
            'Cannot compute execution order: dependency cycle detected',
            GasTownErrorCode.DEPENDENCY_CYCLE,
            { cycleNodes: result.cycleNodes }
          );
        }

        return result.sorted;
      } catch (error) {
        if (error instanceof GasTownError) throw error;
        this.logger.warn('WASM topo sort failed, falling back to JS', {
          error: error instanceof Error ? error.message : String(error),
        });
      }
    }

    // JavaScript fallback using Kahn's algorithm
    return this.topoSortJS(beads);
  }

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Remove the circular dependency: inspect the reported nodes and break the cycle by reordering or dropping an edge.
  2. Validate the dependency graph with a topological sort before execution and reject cyclic definitions early.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at v3/plugins/gastown-bridge/src/convoy/observer.ts:520 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/7816eace476de4ce. Report an issue: GitHub.