Skip to content

test(coderd/x/chatd): fold the duplicate advisor scenarios - #30993

Draft
ibetitsmike wants to merge 4 commits into
mike/chatd-remove-tool-split-e2efrom
mike/chatd-dedupe-advisor-e2e
Draft

ibetitsmike wants to merge 4 commits into
mike/chatd-remove-tool-split-e2efrom
mike/chatd-dedupe-advisor-e2e

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Two end-to-end advisor scenarios repeated other tests. This PR moves their unique checks into tests that stay and deletes them.

  • TestAdvisorGating_RootChat replayed the advisor and read_file batch of the mixed exclusive and local tools commit policy errors subtest. Its exact two-call count moves into that subtest, which already checks that read_file never runs and both stored errors; the Root row (test(coderd/x/chatd): cover advisor eligibility in the tool policy table #30990) checks the advisor tool and guidance.
  • The solo exclusive tool executes subtest is a subset of TestAdvisorHappyPath_RootChat, which now also checks the stored advisor result.

Why it is safe

Deleted assertion Remaining check
Exactly two streamed calls the mixed local subtest: >= 2 became == 2
Advisor offered, guidance in the prompt Root row
Advisor and skipped tool errors sent back the mixed local subtest (stored errors), TestExclusiveToolPolicy_MixedBatchErrors (text)
Solo: stored result is not an error and holds the reply happy path test, new checks
Solo: three streamed calls happy path test waits for the same three
Mutant Fails before Fails after
Exclusive batch check off both mixed subtests, RootChat both mixed subtests
No exclusive tool set both mixed subtests, RootChat both mixed subtests
Advisor runs, then the batch is rejected RootChat only the mixed local subtest
Advisor result marked as an error provider executed subtest, solo provider executed subtest, happy path
Advisor result replaced with {} solo, happy path happy path

Only an exact count sees the nested advisor call of the third mutant, so the count moves instead of going away.

Coverage with -coverpkg=./coderd/x/chatd/...: the tests left at the top of the stack reach every block the deleted tests reached, except an empty case <-ctx.Done(): in runnerManager.requestCleanup that only shutdown timing reaches.

Review focus

The subtest reads the count after the chat reaches waiting, and its fake model server counts only streamed requests, so title requests do not change it.

Timing

From 10 runs, the two deleted scenarios took 0.83 s summed (median per test).

Validation

  • go test ./coderd/x/chatd/ -run '^(TestActiveServer_ExclusiveToolPolicy|TestAdvisorHappyPath_RootChat)$' -count=10, and with -race -count=3: pass
  • go test ./coderd/x/chatd/...: pass
  • go test -overlay mutant runs before and after this PR: results above
  • the pre-commit hook (gen, fmt, lint, slim build) passed

Stack

The stack moves advisor eligibility and the root versus child tool split into TestBuildTurnEnvironmentToolPolicy and deletes the end-to-end tests that only checked them, finishing #30868. It is based on #30911.

  1. test(coderd/x/chatd): cover advisor eligibility in the tool policy table #30990 Advisor and general child rows in the tool policy table
  2. test(coderd/x/chatd): remove the end-to-end advisor gating tests #30991 Remove the end-to-end advisor gating tests
  3. test(coderd/x/chatd): remove end-to-end root and child tool list tests #30992 Remove the end-to-end root and child tool list tests
  4. test(coderd/x/chatd): fold the duplicate advisor scenarios #30993 Fold the duplicate advisor scenarios (this PR)

Xum, an AI agent, opened this PR for @ibetitsmike and wrote this description.

TestAdvisorGating_RootChat replayed the mixed advisor and read_file
batch of TestActiveServer_ExclusiveToolPolicy. Move its exact model
call count into that subtest and delete it; the Root table row checks
the advisor tool and guidance. Check the persisted advisor result in
TestAdvisorHappyPath_RootChat and delete the solo exclusive subtest,
which it now covers.
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum, an AI agent, posted this comment for @ibetitsmike.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 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-18T19:35:52.215373Z ecc0a3c 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 Review: Didn't find any major issues. Swish!

Reviewed commit: e94e62608c

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

TestAdvisorGating_RootChat was the only test that read the advisor
guidance in the first model request of a root chat; the Root table row
reads the prompt before generation. TestAdvisorHappyPath_RootChat now
records the parent's first request and checks that it carries
ParentGuidanceBlock, so a mutant that drops the guidance from the
request fails it.
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum, an AI agent, posted this comment for @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: ecc0a3c21b

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

This branch has not been deployed

No deployments
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.

1 participant