Skip to content

🤖 fix: keep MCP and sends closed for an unsanitized task checkout whose reclaim failed #4674

Description

@ThomasK33

Summary

A reserved task launch whose sanitize fails, and whose reclaim then also fails, can still start MCP in the unsanitized checkout. Discovery and sends for that checkout should stay closed until it is sanitized or physically removed.

Background

This was deferred from #4673, Codex round 1 (threads PRRT_kwDOPxxmWM6mQTPL and PRRT_kwDOPxxmWM6mQTPM). #4673 moved init completion after reclaimUnsanitizedTaskCheckout. The two cases below existed before #4673; before it, init completed before any reclaim was attempted.

  1. The unpublish fails or can't be verified. The row and the unsanitized checkout both stay. Init completes so that waiters don't hang. listWorkspaceMcpPrompts then re-reads the still-published metadata and can start the configured MCP server from that checkout, and any later request can do the same.
  2. The row is unpublished but checkout deletion fails. rollbackFailedTaskCreate only logs the runtime.deleteWorkspace failure, so the reclaim reports success. A concurrent send or request that cached its metadata/runtime before waitForInit can continue once init state is cleared, and start MCP in the leftover checkout.

Proposed direction (needs design)

Record "unsanitized" per checkout, bound to the task attempt. MCP start and discovery (getToolsForWorkspace, getPromptsForWorkspace, listServers, getPrompt) and sends refuse that checkout until sanitize succeeds or the checkout is removed. Waiters should fail fast with a typed error instead of either hanging or proceeding. Make reclaimUnsanitizedTaskCheckout report failed physical deletion as not reclaimed.

Acceptance

  • Failed unpublish, then a prompts.list or send: no MCP process starts with its working directory in the unsanitized checkout, and the caller gets a typed refusal.
  • Failed deletion after unpublish: a request that was already parked in waitForInit does not start MCP in the leftover checkout.
  • Reuse the recording MCP fixture from 🤖 fix: keep MCP out of an unsanitized replacement checkout when sanitize fails #4673 (tests/fixtures/mcp/recording-server.ts).

Refs #4673, #4576


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $253.94

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions