fix(slack): stop sending thread_id to decopilot — it rejects unknown ids#437
Merged
Conversation
…eate threads After #435 retried with a temp thread_id on 500 Thread-not-found, real traffic still failed: the decopilot endpoint rejects ANY unknown thread_id, including the temp <name>-<timestamp> fallback. The retry just postponed the same error by one round-trip. Drop thread_id from the request entirely. Without it the decopilot allocates a fresh thread per call. The slack-mcp already rebuilds conversation context from Slack history on every webhook (buildContextMessages -> 1 system message), so the agent stays coherent within a thread/DM without depending on decopilot-side memory. The userName -> threadId plumbing is left in place upstream so we can plug a real thread-create call (cached id per user) in later if per-person decopilot memory is needed. Removes the retry helper and access-failure heuristic since we no longer pass a thread_id that could fail. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
3 tasks
JonasJesus42
added a commit
that referenced
this pull request
May 13, 2026
…skId (#438) After #436 switched to the runtime endpoint /api/<org>/decopilot/runtime/stream (the path the AgentOf binding uses internally) and #437 dropped thread_id, real traffic hits `streamCore: taskId is required`. The runtime stream is the resume-a-task path: it expects a pre-existing taskId minted by another call. For our chat-like webhook flow there is no upstream task. Go back to /decopilot/stream — the user-facing chat endpoint studio's own chat UI uses — and parse its custom SSE locally instead of through the runtime's `streamAgent`. We still omit thread_id (decopilot rejects ids it did not mint). The handler/event plumbing for userName -> threadId stays in place so we can wire a real thread-create call later if needed. Build, types, lint all clean. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
Follow-up to #435/#436. The temp-thread_id retry from #435 still fails in production with
Thread not found: <name>-<timestamp>— the decopilot endpoint rejects any unknown thread_id, including the temp fallback. The retry just postponed the same error.Drop
thread_idfrom the request entirely. Without it, the decopilot allocates a fresh thread per call. The slack-mcp already rebuilds conversation context from Slack history on every webhook (buildContextMessages→ 1 system message), so the agent stays coherent within a Slack thread/DM without depending on decopilot-side memory.The
userName→threadIdplumbing is kept upstream inllm-handler.ts/eventHandler.tsso we can plug a real thread-create call (cached id per user) later if per-person decopilot memory becomes important.Test plan
[LLM] streamAgent <url> (no thread_id).buildContextMessages, not decopilot memory).Summary by cubic
Stop sending
thread_idto decopilot to eliminate “Thread not found” errors; each call now creates a fresh decopilot thread while Slack-side context continues to be rebuilt per webhook.thread_idbefore callingstreamAgent; log now shows “(no thread_id)”.thread_idretry and access-failure heuristics to avoid repeated 500s.userName→threadIdplumbing intact for a future thread-create flow.Written for commit 160b632. Summary will update on new commits.