Skip to content

Make TestConfigureSubset e2e hermetic against a live managed config - #777

Open
tt-le wants to merge 1 commit into
mainfrom
tien/fix-e2e-configure-subset-codex
Open

tt-le wants to merge 1 commit into
mainfrom
tien/fix-e2e-configure-subset-codex

Conversation

@tt-le

@tt-le tt-le commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

Problem

tests/test_e2e.py::TestConfigureSubset (3 tests) started failing in the "Agent launch tests · Claude" shard with:

! Could not configure Codex: Could not build the managed Codex model catalog locally. Upgrade the active Codex installation… Continuing.

Root cause (not a code regression)

These tests exercise the interactive tool-selection branch of configure_workspace_command() — they monkeypatch prompt_for_tools, install_tool_binary, and the per-agent config paths ("testing selection plumbing, not the binaries").

But the shared UCODE_TEST_WORKSPACE now has a managed CodingAgentConfig published on it. So refresh_managed_config() returns non-None and configure takes the managed auto-apply branch instead, which:

  • ignores the mocked prompt_for_tools and configures every managed tool (why test_empty_pick saw install_calls == ['claude','codex']), and
  • for codex calls prepare_codex_catalog → real codex debug models --bundled, which fails because the Claude shard installs no codex binary.

The failing job's captured output confirms the managed branch ran (the "Managed MCP Servers" / "Coding Agents: Claude Code / Failed to configure: Codex" summary panel). This is a workspace-config/environment trigger, unrelated to any app code.

Fix

Make the tests hermetic: force "no managed config" via the sanctioned UCODE_MANAGED_CONFIG_STUB hook (an explicit JSON null) in the shared _redirect_config_paths helper, so all 3 tests deterministically run the interactive branch they were written for — independent of what the live workspace publishes. With no managed config, codex_static_models is never set, so prepare_codex_catalog is never reached (no real codex binary needed). No assertions were weakened.

Verified: ruff check/format clean, the 3 tests collect. Live run needs UCODE_TEST_WORKSPACE + DATABRICKS_BEARER (runs in CI).

Note (infra, separate)

tests/README.md says managed-config coverage is meant to live on a separate workspace; the shared e2e workspace apparently now has a managed config. Worth checking whether that's intended or whether managed coverage should move off the shared workspace. This test fix makes CI robust either way.

This pull request and its description were written by Isaac.

TestConfigureSubset exercises the interactive tool-selection branch of
`configure_workspace_command()` (it monkeypatches `prompt_for_tools`,
`install_tool_binary`, and the config paths). But when the live
`UCODE_TEST_WORKSPACE` has a managed CodingAgentConfig published, `configure`
takes the managed auto-apply branch instead — which ignores `prompt_for_tools`,
installs every managed tool, and (for codex) shells out to `codex debug models
--bundled`, failing in the codex-less Claude CI shard.

Force "no managed config" for these tests via the sanctioned
`UCODE_MANAGED_CONFIG_STUB` hook (an explicit JSON `null`) in the shared
`_redirect_config_paths` helper, so they deterministically run the interactive
branch regardless of what the workspace publishes. No assertions weakened.

Co-authored-by: Isaac <no-reply@databricks.com>
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