Skip to content

CoderMCPServer: trust only Coder's own 404 before clearing the config ID (gate before M9) #337

Closed

Description

@ThomasK33

Summary

The CoderMCPServer controller treats any 404 as "the config is gone". That includes a proxy HTML 404 and Coder's Route not found. for a wrong base URL. This is the MCP version of #327 (CoderAIProvider).

Impact

After a spec edit (generation 2 or later), when an earlier apply has already replaced the nonce display name:

  1. A false 404 on the GET makes the controller clear status.configID (internal/controller/codermcpserver_apply.go, the GET at the top of the apply).
  2. The controller goes back to the create path, which finds the slug.
  3. The display name is no longer the nonce, so the record step reports SlugConflict and clears the create marker.
  4. The object then has no ID and no marker. A later delete removes the finalizer, and the config stays in Coder unmanaged, possibly enabled and holding credentials.

Before #328, the controller stalled on any 404 and kept the ID. #328 adds this path, and the stacked #329 and #330 keep it.

Fix

Use isCoderResourceNotFound (added in #325) for the MCP GET in the apply, the kill-switch read (#329), and the disable read (#330). A non-Coder 404 waits with CoderUnavailable and changes nothing. Add tests for an HTML 404 and for Route not found. on each path.

Gate

This must land before M9 (CoderMCPServer activation). The kind is dormant today, so no install is affected.

Found by the final assessment of #328. Refs #155


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: medium

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