server: preserve task-augmented execution after request teardown - #889
server: preserve task-augmented execution after request teardown#889juravlaleks-ctrl wants to merge 2 commits into
Conversation
|
Connected to Huly®: MCP_G-454 |
WalkthroughThis PR isolates task execution context from request cancellation by introducing a task-specific context key. ChangesTask-augmented tool context isolation for background execution
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@server/streamable_http_test.go`:
- Around line 2328-2408: Create a test cleanup to always close the release
channel: immediately after the release := make(chan struct{}) line call
t.Cleanup(func(){ close(release) }) so the channel is closed even if a require.*
fails; then remove the explicit close(release) at the end of the test (or
replace it with a safe sync.Once.close if you prefer) to avoid double-close.
This touches the release channel and the existing close(release) call in the
test.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 442196c1-05de-4216-85bb-9725d40fabab
⛔ Files ignored due to path filters (1)
server/internal/gen/request_handler.go.tmplis excluded by!**/gen/**
📒 Files selected for processing (4)
server/ctx.goserver/request_handler.goserver/server.goserver/streamable_http_test.go
Description
Task-augmented tool calls created through the request handler currently inherit the request-scoped cancellation path. Once the HTTP request completes, the task goroutine can observe
context canceledimmediately, sotasks/getreturnscancelledbefore the task has a chance to run.This keeps the detached execution context limited to request-handler initiated task calls. Direct callers that invoke
handleToolCallwith their own cancellable parent context still preserve that cancellation behavior.Type of Change
Checklist
Additional Information
tasks/get.go test ./serverandcd otel && go test ./....Summary by CodeRabbit