Agent strategy run cut by PLUGIN_MAX_EXECUTION_TIMEOUT is reported only as "Internal Server Error"

Aperta
#863 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
backend

Direzione di ricerca

Start at the <-timer.C branch in internal/service/base_sse.go, where the timeout currently calls exception.InternalServerError, then read internal/types/exception/factory.go to see how error types and messages are built. Reproduce by setting a short PLUGIN_MAX_EXECUTION_TIMEOUT and running a long agent strategy dispatch. Done means a timeout returns its own error type and message naming the configured limit, while client disconnects and real internal errors keep their existing types.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Self Checks

To make sure we get to you in time, please check the following :)

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • "Please do not modify this template :) and fill in all the required fields."

Versions

  1. dify-plugin-daemon Version: 0.6.14-local
  2. dify-api Version: 1.19.0 (self-hosted docker-compose). The same defaults and code path are present in 1.20.0 and in current main of this repo.

Agent strategy plugin: langgenius/agent 0.0.51 (Function Calling). Model plugin: langgenius/openai_api_compatible 0.0.84.

Describe the bug

PLUGIN_MAX_EXECUTION_TIMEOUT (default 600) caps the whole dispatch/agent_strategy/invoke stream, so it is effectively the maximum total runtime of an Agent node in a workflow, not just a single model or tool call. That limit by itself is reasonable and configurable. The problem is how it is reported.

When the timer fires, baseSSEService writes exception.InternalServerError(errors.New("killed by timeout")) (internal/service/base_sse.go, the <-timer.C branch). InternalServerError logs the real reason and returns the fixed message "Internal Server Error" (internal/types/exception/factory.go). The workflow therefore fails with only:

req_id: <id> PluginDaemonInternalServerError: Internal Server Error

Nothing in the run tells the user that a time limit was reached, or which setting controls it. The reason is visible only in the daemon's own log:

ERROR dify-plugin-daemon factory.go:28 PluginDaemonInternalServerError error="killed by timeout"

Many people hit this generic message and it gets mixed up with other causes, for example #760 (a stream that never closes) and #371 / #290. A run that really is long and a run that hangs look identical from the Dify side.

To Reproduce

  1. Self-hosted docker-compose with default plugin daemon settings (PLUGIN_MAX_EXECUTION_TIMEOUT=600).
  2. Create a workflow Start → Agent (Function Calling, Maximum Iterations 30) → End. Give the Agent one API tool that takes 50 s per call, and a model that keeps calling the tool, about 22 calls (~18 minutes in total). Every individual model and tool call is well under its own per-call timeout.
  3. Run the workflow through the API in streaming mode.
  4. The Agent node fails at 600.2 s with PluginDaemonInternalServerError: Internal Server Error. The daemon log shows killed by timeout.
  5. Set PLUGIN_MAX_EXECUTION_TIMEOUT=2400 on the plugin daemon, restart it and run the same workflow again: it succeeds in 1101 s.

Expected behavior

  • When the execution timer fires, return a timeout-specific error type and message that the API can pass on to the user. For example: plugin execution exceeded PLUGIN_MAX_EXECUTION_TIMEOUT (600s). A client disconnect or a real internal error would keep its own type.
  • Document, next to PLUGIN_MAX_EXECUTION_TIMEOUT in the env examples, that it also limits the total runtime of an Agent node (the whole agent strategy run), so long-running agents need it raised.

Screenshots

N/A

Additional context

The test used a mock OpenAI-compatible model endpoint and a mock HTTP tool, so model latency was not a factor. Raising only this one setting moved the cut-off, which confirms it is the limit that applies.

Lingua principale
Go
Stelle
462
Fork
326
Merge medio
22h 15m
PR unite (30g)
8

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di langgenius/dify-plugin-daemon

Tutte le issue di langgenius/dify-plugin-daemon

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.