Repository navigation
fix(runtime)!: resolve Dify 0.9 integration regressions - #383
Merged
Merged
Conversation
This was referenced Nov 2, 2026
WH-2099
marked this pull request as ready for review
November 11, 2026 05:40
Serialize files nested in mixed arrays, replace named tool argument snapshots, avoid callback-free result accumulation, and allow hosts to disable frame observations before copying values. BREAKING CHANGE: Named tool calls carry the current argument snapshot. Runtime adapters emitting argument fragments must omit the function name after the initial call.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the Dify integration and release-preparation changes.
No open issues 🎉
What changed in this PR
Addresses Dify integration regressions ahead of Graphon 0.9.0, supporting the release preparation tracked in #379 and #382.
Changes:
- Preserves nested File types in complete mixed-array snapshots without converting ordinary JSON into files, and supports nested models in object-array templates.
- Makes named tool-call updates replace argument snapshots while unnamed updates append fragments—a breaking adapter contract change—and skips stream accumulation without callbacks.
- Adds optional frame-event suppression while preserving execution and pause/resume behavior, with regression tests and documentation.
| File | Description |
|---|---|
uv.lock |
Updates the project version and locked dependencies. |
tests/variables/test_template_resolution.py |
Tests object-array rendering with nested Files and segments. |
tests/utils/test_variable_utils.py |
Tests snapshot fidelity, filtered exports, key validation, and schema compatibility. |
tests/nodes/test_container_effects.py |
Tests File restoration through pools and container resume tasks. |
tests/model_runtime/test_model_dispatch.py |
Tests tool-call replacement and callback-free content release. |
tests/engine/test_frame_observations.py |
Tests disabling frame events without changing results or copying unused context. |
tests/engine/test_frame_failures.py |
Tests failure propagation across pause/restore with frame events disabled. |
src/graphon/variables/utils.py |
Adds nested File serialization to plain-value JSON exports. |
src/graphon/variables/segments.py |
Records explicit File paths in snapshots and serializes nested models for templates. |
src/graphon/model_runtime/README.md |
Documents tool-call merging and callback-dependent accumulation. |
src/graphon/model_runtime/model_providers/base/large_language_model.py |
Implements snapshot replacement and optional stream accumulation. |
src/graphon/model_runtime/entities/llm_entities.py |
Documents the tool-call update contract. |
src/graphon/engine/frame.py |
Avoids observation-only error tracking when frame events are disabled. |
src/graphon/engine/engine.py |
Adds the default-enabled emit_frame_events option. |
pyproject.toml |
Sets the package version to 0.9.0. |
ARCHITECTURE.md |
Documents snapshot semantics, template rendering, and optional frame observations. |
.github/workflows/test.yml |
Updates the pinned setup-uv action. |
.github/workflows/release.yml |
Updates setup-uv pins for release jobs. |
.github/workflows/pr.yml |
Updates the pinned setup-uv action. |
Review effort: Balanced
WH-2099
force-pushed
the
fix/dify-0.9-integration
branch
from
November 11, 2026 05:46
454cd1c to
b5407fa
Compare
41tair
approved these changes
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
!Related Issue
Refs #379 and langgenius/dify#45355.
This PR is based on
main, including the release preparation merged in #382.Summary
The 0.9.0 candidate interpreted ordinary JSON resembling files inside mixed arrays as File objects and could not serialize nested File values for Dify draft persistence.
Keep ordinary JSON intact and record actual File locations in complete typed snapshots, preserving file identity through variable pools, container tasks, and repeated pause/resume.
Derive file paths from Pydantic's serialized nested values, including models, dataclasses, root models, and collections, while honoring aliases, exclusions, caller context, and declared field visibility.
Keep snapshot encoding and restoration in one module; scoped file markers are cleared on both success and serialization errors.
Validate declared file paths and payloads, require string keys in dictionaries containing files, and preserve the discriminated union's JSON Schema.
Filtered exports and
dumps_with_segmentsproduce ordinary JSON without file restoration metadata.Historical
array[any]snapshots without that metadata retain dictionaries as data.Render templates over object arrays containing nested File/Segment models as JSON, preserving Unicode and empty arrays.
Replace named tool argument snapshots by call ID, append unnamed fragments, and skip complete stream accumulation when no callback consumes it.
Breaking change: runtime adapters that emit argument fragments must omit the function name after the initial call; a named update carries the current argument snapshot.
Add
Engine(..., emit_frame_events=False)so hosts can avoid constructing and copying unused frame observations while retaining execution, variable commits, and pause/resume.Frame observations remain enabled by default.
Validation:
just test: 1,195 passed on Python 3.12.13, with two existing pandas warnings.just check, wheel/source distribution builds, and 29 documentation checks passed.just checkand 105 focused serialization, file, segment, and container tests passed.Live provider calls, database integration tests, and production concurrency were not run.
Checklist
!