Repository navigation
Description
Problem
When a Feishu (飞书) session is aborted by the user (e.g., via cancel in the Feishu UI), the session is marked as orphan=true but its processing loop is not terminated. The opencode process continues to re-enter the loop (step=0 → step=1 → ...), making repeated LLM inference requests indefinitely.
If the parent terminal/process exits, the opencode main process becomes an orphan (PPID=1) and keeps consuming high CPU (observed 370-420% CPU, ~8.5GB RSS) with no way to stop it except manually killing the process.
Root Cause
The Feishu plugin's session.error handler logs orphan=true but does not properly clean up the session's pending tasks or prevent the session from re-entering the processing loop. This is distinct from the existing orphan session issues (#19023, #30683, #31787) which deal with DB records or project ID drift — this is specifically about the Feishu WebSocket channel triggering repeated loop restarts for aborted sessions.
Additionally, when the Feishu WebSocket connection drops (e.g., certificate verification errors), the reconnect logic may trigger re-processing of orphaned sessions.
Reproduction
- Start opencode with Feishu plugin configured
- Send a message from Feishu to trigger a session
- Cancel/abort the session from the Feishu UI
- Observe that the session is marked
orphan=truebut continues looping - Close the terminal running opencode
- The opencode process becomes orphaned (PPID=1) and continues consuming high CPU
Observed Logs
level=ERROR message=process session.id=ses_xxx error=Aborted stack=undefined
level=WARN message="[feishu] 收到 session.error 事件" sessionId=ses_xxx errMsg=Aborted orphan=true
level=INFO message=loop session.id=ses_xxx step=0 // <-- loop restarts despite orphan=true
level=INFO message=stream providerID=omlx modelID=Qwen3___5-122B-A10B-4bit session.id=ses_xxx
Expected Behavior
When a session is aborted and marked as orphan, the Feishu plugin should:
- Remove the session from the active processing queue
- Not allow the session to re-enter the loop on subsequent iterations
- Clean up any pending message handlers for that session
Environment
- Opencode version: 1.17.8
- Platform: macOS ARM64 (Darwin)
- Model: oMLX local (Qwen3.5-122B-A10B-4bit)
- Feishu plugin: WebSocket mode (persistent connection)
Related Issues
- Sessions permanently stuck after server restart or stream interruption — no startup recovery for orphaned messages/tool parts #19023 — Sessions permanently stuck after server restart or stream interruption
- [BUG] task.ts: Effect.orDie orphans subagent sessions after tool error → double processing #31787 — Effect.orDie orphans subagent sessions after tool error
- [FEATURE]: Runtime watchdog for stuck tool/session recovery (complements #19023 startup recovery) #20099 — Runtime watchdog for stuck tool/session recovery
- [Feishu] Bug: "media type: application/octet-stream" error when receiving text messages #22542 — Feishu media type error
- docs: zht locale community link routes to Feishu, which excludes most Traditional Chinese readers #27642 — Feishu locale routing issue
Activity
Necmttn commentedon Jun 21, 2026
Abort needs to be a terminal session state with cancellation propagated into the loop. When Feishu marks
orphan=true, also cancel pending tasks, clear queued prompt work, and writesession.abortedwith source, channel id, final step, and cleanup result.The loop should check that terminal flag before re-entering step 0. Parent process death and WebSocket reconnect should not revive an aborted session unless a new user action explicitly resumes it. Add a max-loop guard as a final failsafe.
Generated with ax.
github-actions commentedon Aug 21, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.