Skip to content

🤖 tests: cover the CoderMCPServer disable window between the marker write and the PATCH - #367

Merged
ThomasK33 merged 1 commit into
mainfrom
mcp-disable-window
Oct 14, 2026
Merged

ThomasK33 merged 1 commit into
mainfrom
mcp-disable-window

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

Summary

Two regression tests for the disable marker that #360 writes before the fail-closed disable PATCH, and the documented limit of that window. Only tests and one comment change, and the kind is not registered, so users see no change.

Fixes #365

Background

#360 writes status.appliedGeneration before the disable PATCH, so a lost answer cannot let a pending generation enable the config. Its round-4 review (comment 4271304269) found a window that the maintainer accepted as a known limit: the process stops after that status write and before the PATCH, and consent or the opt-in comes back before the next reconcile. #365 asks for a regression test of the stop, the limit sentence, and, from the final assessment of #363, an answer to one more case.

The two cases

  1. Stop between the marker and the PATCH, opt-in still withdrawn. The next reconcile still sends exactly one {"enabled":false} PATCH. Whether the config is disabled comes from Coder's answer, not from appliedGeneration.
  2. The PATCH fails without a commit, and the opt-in comes back while the config is still enabled. The pending generation then counts as applied, but the edit is not lost: the sync compares Coder with the spec on every reconcile, so it sends the pending edit as drift ({"description":"pending"} in the test) and reports Applied.

The comment next to sendMCPServerDisable now states the limit and the result of case 2. The plan's M9 row requires the how-to to repeat the limit. The how-to does not exist yet.

Validation

  • TestCoderMCPServerOptInDisableAfterStopBeforePatch (case 1): an interceptor lets the status write succeed and then cancels the reconcile context, so the PATCH never goes out. The marker is in status, Coder is still enabled, and the next reconcile sends one {"enabled":false} PATCH.
  • TestCoderMCPServerOptInFailedDisableKeepsPendingEdit (case 2): the disable PATCH answers 502 without a commit. The marker is in status and Coder is still enabled. After the opt-in comes back, the next reconcile sends exactly one write, {"description":"pending"}, and reports Applied.
  • Mutation check: a disable path that treats a disable started by a stopped reconcile as done makes only the case 1 test fail.
  • Local gates on this head: make verify-vendor, make build, make lint, GOFLAGS=-mod=vendor go tool govulncheck ./..., make test, make test-integration, go test -race ./internal/controller/, and make docs-check pass. make codegen, make manifests, make build-installer and make docs-reference leave no diff.

Size

96 lines added and 1 removed: 15 changed lines of comment and 82 lines of tests.

Refs #155


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

…rite and the PATCH

Two regression tests for the opt-in disable marker that #360 writes
before the disable PATCH:

- The reconcile writes the marker and stops before the PATCH. While the
  opt-in stays withdrawn, the next reconcile still sends the enabled:
  false PATCH, because the decision comes from Coder's answer, not from
  appliedGeneration.
- The PATCH fails without a commit, and the opt-in comes back while the
  config is still enabled. The generation counts as applied, but the
  drift sync still sends the spec edit made before the disable.

The known limit of that window (review comment 4271304269 on #360) is
documented next to sendMCPServerDisable.

Fixes #365
Refs #155

Change-Id: I3f259f54aef05ffaf55024edc563504fbc473e0a
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T14:43:40.872035Z d531121 PR opened
🔒 Security Review ✅ Completed 2026-10-14T14:44:23.242457Z d531121 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: d5311219f7

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 14, 2026
Merged via the queue into main with commit 75fadff Oct 14, 2026
10 checks passed
@ThomasK33
ThomasK33 deleted the mcp-disable-window branch October 14, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CoderMCPServer: test the opt-in disable after a crash between marker write and PATCH, and document the window (before M9)

1 participant