[PR #604] fix: plugin install context canceled by detaching from HTTP request c… #609

Open
opened 2026-02-16 01:16:30 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-plugin-daemon/pull/604
Author: @IthacaDream
Created: 2/7/2026
Status: 🔄 Open

Base: mainHead: fix/context-canceled-problem


📝 Commits (1)

  • 5f0b09d fix: plugin install context canceled by detaching from HTTP request context

📊 Changes

1 file changed (+2 additions, -0 deletions)

View changed files

📝 internal/service/install_plugin.go (+2 -0)

📄 Description

Fixes #603

Description

Summary

Plugin installation/upgrade runs asynchronously after returning a task ID, but previously reused the HTTP request context (c.Request.Context()). When the handler returned, the context was canceled, causing uv sync (started via exec.CommandContext) to fail with context canceled.

Changes

  • Detach background install/upgrade goroutines from request cancellation using context.WithoutCancel(ctx).
  • Preserve tracing context via log.EnsureTrace(...) for downstream spans/logs.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Performance improvement
  • Other

Essential Checklist

Testing

  • I have tested the changes locally and confirmed they work as expected
  • I have added unit tests where necessary and they pass successfully

Bug Fix (if applicable)

  • I have used GitHub syntax to close the related issue (e.g., Fixes #123 or Closes #123)

Additional Information

Local plugin dependency installation (uv sync / uv pip install) no longer fails immediately due to premature context cancellation.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langgenius/dify-plugin-daemon/pull/604 **Author:** [@IthacaDream](https://github.com/IthacaDream) **Created:** 2/7/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/context-canceled-problem` --- ### 📝 Commits (1) - [`5f0b09d`](https://github.com/langgenius/dify-plugin-daemon/commit/5f0b09d020b9097fc0a9d1bbcfc026a3b74aff98) fix: plugin install context canceled by detaching from HTTP request context ### 📊 Changes **1 file changed** (+2 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `internal/service/install_plugin.go` (+2 -0) </details> ### 📄 Description Fixes #603 ## Description #### Summary Plugin installation/upgrade runs asynchronously after returning a task ID, but previously reused the HTTP request context (c.Request.Context()). When the handler returned, the context was canceled, causing uv sync (started via exec.CommandContext) to fail with context canceled. #### Changes - Detach background install/upgrade goroutines from request cancellation using context.WithoutCancel(ctx). - Preserve tracing context via log.EnsureTrace(...) for downstream spans/logs. ## Type of Change - [x] Bug fix - [ ] New feature - [ ] Refactor - [ ] Performance improvement - [ ] Other ## Essential Checklist ### Testing - [x] I have tested the changes locally and confirmed they work as expected - [x] I have added unit tests where necessary and they pass successfully ### Bug Fix (if applicable) - [x] I have used GitHub syntax to close the related issue (e.g., `Fixes #123` or `Closes #123`) ## Additional Information Local plugin dependency installation (uv sync / uv pip install) no longer fails immediately due to premature context cancellation. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 01:16:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugin-daemon#609