Skip to content

🤖 test: make Kind E2E reruns idempotent, read previous and Coder logs, add MCP failure rows - #403

Merged
ThomasK33 merged 3 commits into
mainfrom
e2e-mcp-followups
Oct 30, 2026
Merged

ThomasK33 merged 3 commits into
mainfrom
e2e-mcp-followups

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

Summary

The Kind E2E driver now survives a local rerun in a namespace that a failed run kept, reads the operator log across a container restart, and checks the Coder pod log for the MCP server key. The offline suite gains failure rows for three MCP checks that no test could make fail, and the CI failure dump now shows the CoderMCPServer objects and the MCP stub log.

Fixes #390
Refs #156 (the two E2E follow-ups in the advisor comment of #370)

Background

#390 lists four follow-ups from the final assessment of #389. The last comment of #156 adds two from the advisor check of #370:

  1. The 43-character shape check in gw-leak-check almost always passes on unlicensed Kind.
  2. The leak checks and the e2e-ns-keep ControlPlaneGone check read kubectl logs deploy/coder-k8s, which covers only the current container. An operator restart loses the earlier lines.

Implementation

hack/e2e-workspace-lifecycle.sh:

Item Change
#390.2 rerun New coder_ensure: it lists the collection first and reuses an object with the same name or slug, else it POSTs. It is used for e2e-taken, e2e-mcp-llm and e2e-mcp-taken. A reused e2e-mcp-llm must be enabled with base URL http://mcp-stub.<ns>.svc:8080/v1, or the driver fails. key_secret create replaces a Secret that already exists (AlreadyExists). Without that, a rerun fails at cannot create Secret e2e-ai-key (AI P1) before it reaches the first 409.
#156.2 previous log New pod_logs <ns> <selector> <file>: for each container of each non-terminating pod it reads the current log, and also --previous when restartCount > 0. All four operator log reads (AI rotation, AI Gateway leak check, MCP P1 leak check, namespace ControlPlaneGone checks) use it.
#390.4 Coder log The MCP P1 leak check also reads the Coder pods (app.kubernetes.io/name=coder-control-plane,app.kubernetes.io/instance=coder).
#156.1 shape check Documented as a regression guard only: Kind runs Coder unlicensed, so no key exists, and the exact-value check is the real test. A meaningful shape check needs a licensed E2E, which does not exist yet.

.github/workflows/ci.yaml (#390.3): the failure dump adds kubectl -n coder get codermcpservers -o yaml and kubectl -n coder logs deploy/mcp-stub --tail=200. The objects hold no key values (the driver checks that), and the stub logs only request methods and tool counts.

hack/e2e-workspace-lifecycle_test.sh (#390.1 and coverage for the rest):

  • The fake operator pod now has a container manager with restartCount: 1, and the ControlPlaneGone release lines and the gw-log-leak line appear only in its previous log. So the pass scenario fails if the driver does not read --previous. The fake Coder pod (restartCount: 0) refuses --previous, so the driver must not ask for a previous log when there is none.
  • The fake Coder now answers 409 for a taken MCP slug, and the fake API server answers AlreadyExists for an existing Secret, as the real ones do.
New row The break The driver fails with
mcp-unlisted-writes The fake controller writes a config for the unlisted organization a CoderMCPServer of an unlisted organization wrote to Coder
mcp-conflict-writes A SlugConflict refusal bumps updated_at in Coder a refused CoderMCPServer wrote to Coder
mcp-ns-no-release The fake controller omits the MCP ControlPlaneGone log line the operator log has no ControlPlaneGone release of MCP server e2e-mcp-keep
mcp-coder-log-leak The Coder pod logs the MCP server key CoderMCPServer e2e-mcp, the operator log or the Coder log holds the MCP server key (1 lines)
rerun-kept-namespace (passes) Seeds e2e-taken, e2e-mcp-llm, e2e-mcp-taken in the fake Coder and the five driver Secrets Exits 0, logs the three reuses and five Secret replacements, and sends no POST for them

Validation

  • Red with the old driver and the new tests: pass fails with no ControlPlaneGone release of AI provider e2e-ns-keep, rerun-kept-namespace fails with cannot create Secret e2e-ai-key, and mcp-coder-log-leak, mcp-ns-no-release and gw-log-leak fail with a different message than the row expects. mcp-unlisted-writes and mcp-conflict-writes already fail correctly: they add coverage for existing checks.
  • Green: make test-scripts (which runs bash ./hack/e2e-workspace-lifecycle_test.sh): ALL OFFLINE TESTS PASSED, 103 scenarios, 137 checks, 12 min on this host.
  • shellcheck on both scripts: clean. go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.10: clean.
  • make verify-vendor, make test, make build, make lint: pass (with GOROOT pinned to Go 1.26.10 on this host).
  • The full Kind E2E runs in CI because the PR changes hack/e2e-workspace-lifecycle*.sh. I did not run Kind locally.

Risks

  • I did not run a real kept-namespace rerun on Kind. The rerun path is proven only against the offline fakes. CI always starts from a fresh cluster, so the rerun path never runs there.
  • pod_logs fails the step if kubectl logs --previous fails after a restart (for example, the kubelet removed the dead container). That is a false failure, never a false pass.
  • An operator pod that was deleted and replaced (the restart phase does this) still loses its log. --previous covers container restarts inside one pod only.

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

…CP failure rows (#390)

Change-Id: I238039e70250ec6c8023a1928d747b92c86510ba
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 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-30T17:36:44.925970Z 5cbf1be Manual request
🔒 Security Review ✅ Completed 2026-10-30T17:32:24.675166Z 5cbf1be 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.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

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

Reviewed commit: 866ba558b0

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.

…lete (#390)

The CoderAIProvider and CoderMCPServer row groups forced a 2 s namespace
delete timeout on every row. Rows that need the delete to finish
(ai-ns-no-release, mcp-ns-no-release) could time out on a loaded host
before they reached the ControlPlaneGone release check. Only the
*-ns-stuck rows keep 2 s. agent-start-error's wall-clock bound becomes
120 s: still far below the 300 s agent timeout it guards against.

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

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 10e5d3957e

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread hack/e2e-workspace-lifecycle.sh Resolved
@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

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

Reviewed commit: 10e5d3957e

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.

A rerun that reused e2e-mcp-llm still POSTed a new stub-model chat model,
so each rerun added another default model. The driver now lists the
organization's chat models and reuses stub-model of the provider when it
is enabled and the default.

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

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

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

Reviewed commit: 5cbf1beaf5

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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 5cbf1beaf5

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit e903840 Oct 30, 2026
9 of 10 checks passed
@ThomasK33
ThomasK33 deleted the e2e-mcp-followups branch October 30, 2026 21:16
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 Kind E2E follow-ups

1 participant