Skip to content

Comments

fix(graph): preserve RunnableConfig context in compiled subgraph#4275

Open
OiPunk wants to merge 1 commit intoalibaba:mainfrom
OiPunk:codex/saa-4191-subgraph-context
Open

fix(graph): preserve RunnableConfig context in compiled subgraph#4275
OiPunk wants to merge 1 commit intoalibaba:mainfrom
OiPunk:codex/saa-4191-subgraph-context

Conversation

@OiPunk
Copy link

@OiPunk OiPunk commented Feb 9, 2026

Describe what this PR does / why we need it

This PR fixes context propagation for compiled subgraphs. RunnableConfig.context is meant to carry per-run mutable data across nodes, but SubCompiledGraphNodeAction cleared context before invoking the compiled subgraph, causing data loss.

Does this pull request fix one issue?

Fixes #4191

Describe how you did it

  • Removed subGraphRunnableConfig.clearContext() in SubCompiledGraphNodeAction so subgraph execution keeps parent run context.
  • Added regression test testCompiledSubGraphShouldInheritRunnableContext in CompiledSubGraphTest.
    • Parent node writes trace_id into RunnableConfig.context.
    • Subgraph node reads the same key and emits it in output.
    • Test verifies expected output includes [SUB:ctx-123].

Describe how to verify it

Run:

  • JAVA_HOME=/usr/local/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home ./mvnw -pl spring-ai-alibaba-graph-core -am test

Result:

  • Tests run: 277, Failures: 0, Errors: 0, Skipped: 52

Special notes for reviews

  • Change scope is limited to compiled-subgraph runnable config handling and one focused regression test.
  • No API changes.

@github-actions github-actions bot added the area/graph SAA Grpah module label Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/graph SAA Grpah module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] RunnableConfig context data can't passes between nodes

1 participant