[PR #2036] [MERGED] feat: add explicit Claude session_id resume to avoid heartbeat thread… #2040

Closed
opened 2026-02-22 18:15:09 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-plugins/pull/2036
Author: @LogicOber
Created: 2/7/2026
Status: Merged
Merged: 2/13/2026
Merged by: @crazywoola

Base: mainHead: bump/better-e2b-sandbox-session-id


📝 Commits (1)

  • 28730f0 feat: add explicit Claude session_id resume to avoid heartbeat thread hijack

📊 Changes

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

View changed files

📝 LogicOber/better-e2b-sandbox/Better-E2B-Sandbox.difypkg (+0 -0)

📄 Description

Plugin Submission Form

1. Metadata

  • Plugin Author: lysonober
  • Plugin Name: Better E2B Sandbox
  • Repository URL: https://github.com/LogicOber/dify-plugins/tree/bump/better-e2b-sandbox-session-id/LogicOber/better-e2b-sandbox

2. Submission Type

  • New plugin submission
  • Version update for existing plugin

3. Description

This update fixes an important Claude Code conversation continuity issue when using Setup Sandbox Heartbeat alongside multi-turn Send Sandbox Input conversations.

Problem
Users often run multi-turn Claude Code chats via Send Sandbox Input with claude --continue. When a Heartbeat task is created in the middle, Heartbeat runs in a separate session (claude -p), but Claude Code still records it as the “most recent” session. On the next user interaction, claude --continue may resume the Heartbeat session instead of the user’s main conversation thread, causing context loss / thread hijack.

Solution: explicit Session ID mechanism
Send Sandbox Input now supports:

  • capture_session_id (bool, default false): when enabled, the tool captures the current Claude Code session_id after execution and returns it in JSON output.
  • session_id (string, optional): when provided, the tool uses claude --resume <id> -p to resume the exact intended conversation thread.

Command priority:

  1. if session_id is provided → use --resume <id>
  2. else if resume_session=true → use --continue
  3. else → start a fresh session (-p)

This lets Dify workflows store and reuse the correct session_id for the main conversation, while Heartbeat can remain isolated without interfering.

Additional changes in this update

  • Send Sandbox Input now supports multiple file uploads via attachments (type: files). The tool writes each file to /home/user/uploads/ and appends all uploaded paths to the end of input_text. Output is updated from uploaded_path to uploaded_paths.
  • Write Sandbox File now supports batch upload via upload_files (type: files). When upload_files is provided, files are written to the target directory using their original filenames and content is ignored. content is now optional (either content or upload_files must be provided).

4. Checklist

  • I have read and followed the Publish to Dify Marketplace guidelines
  • I have read and comply with the Plugin Developer Agreement
  • I confirm my plugin works properly on both Dify Community Edition and Cloud Version
  • I confirm my plugin has been thoroughly tested for completeness and functionality
  • My plugin brings new value to Dify

5. Documentation Checklist

  • Step-by-step setup instructions
  • Detailed usage instructions
  • All required APIs and credentials are clearly listed
  • Connection requirements and configuration details
  • Link to the repository for the plugin source code

6. Privacy Protection Information

Data Collection

No new user personal data collection is introduced in this update. This change only adds optional workflow parameters to control Claude Code session resuming behavior.

Privacy Policy

  • I confirm that I have prepared and included a privacy policy in the plugin package based on the Plugin Privacy Protection Guidelines

🔄 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-plugins/pull/2036 **Author:** [@LogicOber](https://github.com/LogicOber) **Created:** 2/7/2026 **Status:** ✅ Merged **Merged:** 2/13/2026 **Merged by:** [@crazywoola](https://github.com/crazywoola) **Base:** `main` ← **Head:** `bump/better-e2b-sandbox-session-id` --- ### 📝 Commits (1) - [`28730f0`](https://github.com/langgenius/dify-plugins/commit/28730f0ba09cef8f79f77a6bb3d9941c12224eb4) feat: add explicit Claude session_id resume to avoid heartbeat thread hijack ### 📊 Changes **1 file changed** (+0 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `LogicOber/better-e2b-sandbox/Better-E2B-Sandbox.difypkg` (+0 -0) </details> ### 📄 Description # Plugin Submission Form ## 1. Metadata - **Plugin Author**: lysonober - **Plugin Name**: Better E2B Sandbox - **Repository URL**: `https://github.com/LogicOber/dify-plugins/tree/bump/better-e2b-sandbox-session-id/LogicOber/better-e2b-sandbox` ## 2. Submission Type - [ ] New plugin submission - [x] Version update for existing plugin ## 3. Description This update fixes an important Claude Code conversation continuity issue when using `Setup Sandbox Heartbeat` alongside multi-turn `Send Sandbox Input` conversations. **Problem** Users often run multi-turn Claude Code chats via `Send Sandbox Input` with `claude --continue`. When a Heartbeat task is created in the middle, Heartbeat runs in a separate session (`claude -p`), but Claude Code still records it as the “most recent” session. On the next user interaction, `claude --continue` may resume the Heartbeat session instead of the user’s main conversation thread, causing context loss / thread hijack. **Solution: explicit Session ID mechanism** `Send Sandbox Input` now supports: - `capture_session_id` (bool, default `false`): when enabled, the tool captures the current Claude Code `session_id` after execution and returns it in JSON output. - `session_id` (string, optional): when provided, the tool uses `claude --resume <id> -p` to resume the exact intended conversation thread. Command priority: 1) if `session_id` is provided → use `--resume <id>` 2) else if `resume_session=true` → use `--continue` 3) else → start a fresh session (`-p`) This lets Dify workflows store and reuse the correct `session_id` for the main conversation, while Heartbeat can remain isolated without interfering. Additional changes in this update - Send Sandbox Input now supports multiple file uploads via attachments (type: files). The tool writes each file to /home/user/uploads/<filename> and appends all uploaded paths to the end of input_text. Output is updated from uploaded_path to uploaded_paths. - Write Sandbox File now supports batch upload via upload_files (type: files). When upload_files is provided, files are written to the target directory using their original filenames and content is ignored. content is now optional (either content or upload_files must be provided). ## 4. Checklist - [x] I have read and followed the Publish to Dify Marketplace guidelines - [x] I have read and comply with the Plugin Developer Agreement - [x] I confirm my plugin works properly on both Dify Community Edition and Cloud Version - [x] I confirm my plugin has been thoroughly tested for completeness and functionality - [x] My plugin brings new value to Dify ## 5. Documentation Checklist - [x] Step-by-step setup instructions - [x] Detailed usage instructions - [x] All required APIs and credentials are clearly listed - [x] Connection requirements and configuration details - [x] Link to the repository for the plugin source code ## 6. Privacy Protection Information ### Data Collection No new user personal data collection is introduced in this update. This change only adds optional workflow parameters to control Claude Code session resuming behavior. ### Privacy Policy - [x] I confirm that I have prepared and included a privacy policy in the plugin package based on the Plugin Privacy Protection Guidelines --- <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-22 18:15:09 -05:00
yindo closed this issue 2026-02-22 18:15:10 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugins#2040