fix(lifecycle): forward TaskID in the Docker create-instance request - #3612
fix(lifecycle): forward TaskID in the Docker create-instance request#3612StoyKK wants to merge 1 commit into
Conversation
buildContainerCreateInstanceRequest forwarded SessionID but not TaskID, so the MCP server built inside every freshly launched Local Docker container ran with an empty task binding. Task-bound tools then failed for agents in containers: step_complete_kandev reported "requires a bound task and session" and set_task_title_kandev "requires a bound task", while the resume/reconnect path (buildReconnectCreateInstanceRequest) and the other executors already forward both identifiers. Reproduced on kandev v0.94.0 with a Local Docker executor profile: a Claude agent finished its work, called step_complete_kandev and got the error above; the task stayed on its step. With TaskID forwarded the container-side MCP server binds the task and the step completes. Adds a regression test on the container request builder. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FJBBp1qpZ772ibT6QLCwkt
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: QUIET Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe container create-instance request now forwards ChangesContainer request forwarding
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The container lifecycle request now preserves both task and session bindings, with regression coverage; the change is ready to merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. A rabbit hops where task IDs gleam Comment |
|
| Filename | Overview |
|---|---|
| apps/backend/internal/agent/runtime/lifecycle/container.go | Forwards the existing task ID through the fresh Docker create-instance request, restoring the task binding expected by container-side MCP tools. |
| apps/backend/internal/agent/runtime/lifecycle/container_create_instance_test.go | Adds a direct regression test asserting that the Docker request builder preserves both task and session identifiers. |
Reviews (1): Last reviewed commit: "fix(lifecycle): forward TaskID in the Do..." | Re-trigger Greptile
Problem
buildContainerCreateInstanceRequest(apps/backend/internal/agent/runtime/lifecycle/container.go) forwardsSessionIDbut notTaskIDto agentctl. The MCP server built inside every freshly launched Local Docker container therefore runs with an empty task binding, and task-bound tools fail for agents running in containers:step_complete_kandev→step_complete_kandev requires a bound task and sessionset_task_title_kandev→set_task_title_kandev requires a bound taskThe reconnect path (
buildReconnectCreateInstanceRequest) and the standalone/SSH/Sprites/Kubernetes builders already forward both identifiers, so only the fresh Docker launch is affected. This looks like the same defect as #2643 (closed by its author for non-technical reasons).Reproduction (kandev v0.94.0, Local Docker executor profile, Claude agent)
step_complete_kandevcall, task launched on a Local Docker profile.step_complete_kandev.requires a bound task and session; the task stays on its step. The container environment does carryKANDEV_TASK_ID/KANDEV_SESSION_ID, and the agentctl log shows the MCP server enabled with the session id only.With this change the container-side MCP server binds the task and the step completes normally.
Change
container.go: forwardconfig.TaskIDin the create-instance request (one line).container_create_instance_test.go: regression test asserting the builder forwards bothTaskIDandSessionID.Validation
gofmt -lclean on the two filesgo vet ./internal/agent/runtime/lifecycle/go test ./internal/agent/runtime/lifecycle/ -run TestBuildContainerCreateInstanceRequestForwardsTaskAndSession -count=1→ okstep_complete_kandevsucceeds from inside a fresh container.No UI change, no public docs impact.
Checklist
docs/public/**— no docs change needed (bug fix, no behavior change for users beyond the fix).🤖 Generated with Claude Code
https://claude.ai/code/session_01FJBBp1qpZ772ibT6QLCwkt