Bug: RemoteGraph strips config properties like recursionLimit #272

Closed
opened 2026-02-15 18:15:22 -05:00 by yindo · 0 comments
Owner

Originally created by @xavierroma on GitHub (May 29, 2025).

Behavior

When calling remoteGraph.invoke(input, { recursionLimit: 30 }), the recursion limit should be set to 30 and any recursion error should reference this limit.
Currently the recursionLimit is ignored and the default (25) is being used instead.

Reproduction

import { RemoteGraph } from "@langchain/langgraph/remote";
import { Client } from "@langchain/langgraph-sdk";

const client = new Client({ apiUrl: "http://localhost:8123" });
const graph = new RemoteGraph({
  graphId: "infinite-graph", 
  client: client,
});

// This should use recursionLimit: 30, but uses default instead
await graph.invoke({}, { recursionLimit: 30 });

Root Cause

The RemoteGraph._sanitizeConfig method only returns a subset of config properties:

export class RemoteGraph {
   // ...

  override async *_streamIterator(
      input: PregelInputType,
      options?: Partial<PregelOptions<Nn, Cc, ConfigurableFieldType>>
    ): AsyncGenerator<PregelOutputType> {
    const mergedConfig = mergeConfigs(this.config, options);
    // config is stripped here:
    const sanitizedConfig = this._sanitizeConfig(mergedConfig);
    // ...
    for await (const chunk of this.client.runs.stream(
      sanitizedConfig.configurable.thread_id as string,
      this.graphId,
      {
        config: sanitizedConfig,
        // ...
      }
    )) 
    // ...
  }

  protected _sanitizeConfig(config: RunnableConfig) {
    // ... sanitization logic ...
    
    return {
      tags: sanitizedConfig.tags ?? [],
      metadata: sanitizedConfig.metadata ?? {},
      configurable: newConfigurable,
  
      /* 
      missing:
        recursion_limit: sanitizedConfig.recursionLimit,
      */
    };
  }
}

I will submit a pull request with the fix to include the missing config properties in the _sanitizeConfig method return value.

Originally created by @xavierroma on GitHub (May 29, 2025). ## Behavior When calling `remoteGraph.invoke(input, { recursionLimit: 30 })`, the recursion limit should be set to 30 and any recursion error should reference this limit. Currently the `recursionLimit` is ignored and the default (25) is being used instead. ## Reproduction ```typescript import { RemoteGraph } from "@langchain/langgraph/remote"; import { Client } from "@langchain/langgraph-sdk"; const client = new Client({ apiUrl: "http://localhost:8123" }); const graph = new RemoteGraph({ graphId: "infinite-graph", client: client, }); // This should use recursionLimit: 30, but uses default instead await graph.invoke({}, { recursionLimit: 30 }); ``` ## Root Cause The `RemoteGraph._sanitizeConfig` method only returns a subset of config properties: ```typescript export class RemoteGraph { // ... override async *_streamIterator( input: PregelInputType, options?: Partial<PregelOptions<Nn, Cc, ConfigurableFieldType>> ): AsyncGenerator<PregelOutputType> { const mergedConfig = mergeConfigs(this.config, options); // config is stripped here: const sanitizedConfig = this._sanitizeConfig(mergedConfig); // ... for await (const chunk of this.client.runs.stream( sanitizedConfig.configurable.thread_id as string, this.graphId, { config: sanitizedConfig, // ... } )) // ... } protected _sanitizeConfig(config: RunnableConfig) { // ... sanitization logic ... return { tags: sanitizedConfig.tags ?? [], metadata: sanitizedConfig.metadata ?? {}, configurable: newConfigurable, /* missing: recursion_limit: sanitizedConfig.recursionLimit, */ }; } } ``` --- I will submit a pull request with the fix to include the missing config properties in the `_sanitizeConfig` method return value.
yindo closed this issue 2026-02-15 18:15:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#272