Conversation
This was referenced Sep 23, 2026
Open
Draft
This branch has not been deployed
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.
Description
Fixes #827.
Backwards LLM calls currently reject object-valued
opaque_bodybefore reaching Dify, while other JSON values can be corrupted ([49]becomes1) and large integers are rounded.Keep request values as
json.RawMessageuntil typed dispatch, then use the JSON decoder withUseNumberand the existing validator.This applies to all 17 backwards invocation types.
Preserve trusted tenant/user/type injection even when the incoming JSON uses case-folded aliases.
Accept null or omitted message content permitted by the SDK, including tool-only responses, while retaining validation of invalid content types.
The serverless missing-session error path now reads only the request ID, so unrelated large numbers cannot break error correlation.
Type of Change
Essential Checklist
Testing
Bug Fix (if applicable)
Fixes #123orCloses #123)Additional Information
Validation passed:
go test -race ./internal/core/io_tunnel/backwards_invocation/... ./pkg/entities/model_entities go vet ./internal/core/io_tunnel/backwards_invocation/... ./pkg/entities/model_entitiesTests start at
InvokeDifywith wire JSON and cover opaque objects/arrays/scalars, both stream flags, integers above2^53, null/omitted content, all registered dispatch types, authorization, spoofed identity aliases, validation failures and end frames.The serverless test exercises actual event parsing, typed LLM dispatch and its response writer with a controlled host implementation.
The regressions also fail against the original
c798168implementation through a Go source overlay.Whole-repository checks were attempted with the CI test keys and a temporary Redis instance:
go test -timeout 1m ./cmd/... ./internal/... ./pkg/...: onlyinternal/core/debugging_runtimefailed because PostgreSQL was unavailable; the sandbox could not initialize a separate PostgreSQL data directory under its non-root service account.go vet ./cmd/... ./internal/... ./pkg/...: reports the existingstopRenewcontext leak in unchangedinternal/core/control_panel/launcher_local.go:92,127.Temporary services were stopped, generated private keys removed and the original public key restored.
No paid model API was called.
Related context: #640 and langgenius/dify-official-plugins#3916.