Skip to content

Stop ug configure erroring on feature-disabled workspaces - #500

Merged
david-siqi-liu merged 1 commit into
mainfrom
david/ug-configure-wording
Sep 8, 2026
Merged

Stop ug configure erroring on feature-disabled workspaces#500
david-siqi-liu merged 1 commit into
mainfrom
david/ug-configure-wording

Conversation

@david-siqi-liu

@david-siqi-liu david-siqi-liu commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

🥞 Stack (ug configure + managed-config)


What did you change, and why?

Customers running ug configure on a workspace where server-managed coding-agent config is disabled (FEATURE_DISABLED) hit an alarming, circular error and then dead-ended:

ERROR Workspace-managed coding agent configuration is not available on this workspace. Use `ug configure` to set up agents for individual users instead.

Root cause: refresh_managed_config treated FEATURE_DISABLED like a transient read failure and fell back to a stale cached config, returning it with the feature-disabled flag unset. That masked the disabled state, so an admin got routed into the managed setup flow, which re-read the workspace, got FEATURE_DISABLED again, and raised the message.

The fix is in managed_config.py: FEATURE_DISABLED is now authoritative. It returns no config with the feature-disabled flag set and clears the persisted cache, so ug configure stays on the normal per-user flow, a launch never re-applies a policy the workspace turned off, and a later transient read or token failure cannot resurrect the disabled policy through the fallback. Also initializes the feature-disabled flag on the --dry-run path (a pre-existing UnboundLocalError on an empty local cache, surfaced by review).

Hiding ug setup/ug publish from help and pruning the README, previously bundled here, moved to standalone #510 since it has no dependency on this fix.

How do you know it works?

Unit suites (managed_config, cli) green, including new coverage for the feature-disabled cache clear and the dry-run no-crash path. ruff check and format clean. PR CI green (test + e2e).

Live-verified end to end against a real feature-disabled staging workspace (eng-ml-agent-platform, with the codingAgentConfigCrudEnabled SAFE flag turned off), where the gateway returns:

{"error_code":"FEATURE_DISABLED","message":"Coding agent config APIs are not enabled for this workspace."}

Invoking ug configure against that workspace as an admin, with a non-empty stale managed config cached (the exact condition that triggered the report):

Old build (0.1.0+81.g95999aa) exits 1 with the circular dead-end error:

ERROR Workspace-managed coding agent configuration is not available on this workspace. Use `ug configure` to set up agents for individual users instead.

This branch exits 0 with no error and drops into the normal per-user configure flow. Under the hood refresh_managed_config now returns (None, True) and clears the stale cache to {}, so the admin is never routed into the managed-setup dead end.

This pull request and its description were written by Isaac.

@david-siqi-liu
david-siqi-liu marked this pull request as ready for review September 4, 2026 19:52
Comment thread src/ucode/managed_config.py Outdated
Comment thread src/ucode/cli.py Outdated
Comment thread src/ucode/cli.py Outdated
@david-siqi-liu
david-siqi-liu force-pushed the david/ug-configure-wording branch 2 times, most recently from 2ef3099 to 87045b6 Compare September 6, 2026 15:06
@david-siqi-liu david-siqi-liu changed the title Stop ug configure erroring on feature-disabled workspaces; hide unramped managed commands Stop ug configure erroring on feature-disabled workspaces Sep 6, 2026
@david-siqi-liu
david-siqi-liu force-pushed the david/ug-configure-wording branch from 87045b6 to 75f90cb Compare September 6, 2026 20:03
Comment thread src/ucode/cli.py Outdated
Comment thread src/ucode/managed_config.py Outdated
@david-siqi-liu
david-siqi-liu force-pushed the david/ug-configure-wording branch 2 times, most recently from b2ab7c0 to 7f4e48d Compare September 8, 2026 15:57
`refresh_managed_config` treated FEATURE_DISABLED like a transient read failure
and fell back to a stale cached config with the feature-disabled flag unset,
masking the disabled state. An admin was then routed into the managed setup
flow, which re-read the workspace, got FEATURE_DISABLED, and raised the alarming
circular error.

Treat FEATURE_DISABLED as authoritative: return no config with the flag set and
clear the persisted cache, so `ug configure` stays on the normal per-user flow,
a launch does not re-apply a policy the workspace has turned off, and a later
transient read or token failure cannot resurrect the disabled policy through the
fallback. Also initialize the feature-disabled flag on the `--dry-run` path (a
pre-existing UnboundLocalError when the local cache is empty).

Co-authored-by: Isaac <no-reply@databricks.com>
@david-siqi-liu
david-siqi-liu force-pushed the david/ug-configure-wording branch from 7f4e48d to 91df916 Compare September 8, 2026 16:04
@david-siqi-liu
david-siqi-liu merged commit e4cf203 into main Sep 8, 2026
2 checks passed
@david-siqi-liu
david-siqi-liu deleted the david/ug-configure-wording branch September 8, 2026 16:16
david-siqi-liu added a commit that referenced this pull request Sep 8, 2026
…AFE flag (#504)

## 🥞 Stack (ug configure + managed-config)

- #500
  - **#504** ⬅ this PR
    - #510

---

## What did you change, and why?

Removes the client-side `ENABLE_MANAGED_AGENT_CONFIG` opt-in (a bug-bash
flag) and `managed_agent_config_enabled()`. Per team decision,
workspace-managed coding-agent config is now gated purely by the
server-side SAFE flag, which surfaces as a `FEATURE_DISABLED` reason
from `refresh_managed_config` (made authoritative in #500).

Two constraints had to keep holding, and do:
- Feature disabled server-side means admins and users see nothing about
managed config.
- omnigent's `ucode configure --profiles DEFAULT --agents
claude,codex,pi --use-pat --skip-validate --skip-upgrade` stays fully
non-interactive.

Where to look:
- `cli.py` is the bulk of the diff: deletes the env-var gates, drops the
`ug configure` admin auto-routing (it was a passthrough when the flag
was unset, so `ug configure` now behaves for everyone as it did for
non-flag users), and removes `--skip-managed-config` (it worked by
unsetting the now-gone env var). `status` and the launch "no managed
config" note now key off the server signal.
- Bare `ug` on a feature-disabled workspace prints one managed-free
guidance line (run `ug configure`, then `ug <agent>`) instead of a
silent no-op.
- Launch always fetches and applies the managed config: the
cached-launch fast path is gone, so stale local state cannot bypass an
admin's config. Correctness over the small per-launch latency.

## How do you know it works?

Unit suites (test_cli, test_managed_config, test_managed_wizard,
test_lint) green; ruff check and format clean. PR CI green (test + e2e).
A prior gpt-6-astra review verified both hard constraints; its one
finding (feature-disabled help still surfaced managed-config wording) is
addressed by the managed-free guidance line.

## Follow-up (not in this PR)

`ug status` reads the managed-config cache directly
(`load_managed_state`), with no server-state check, so in a server-side
enabled to disabled transition it can surface a stale managed summary
until the next `ug configure` or launch clears the cache. Dormant today
(the feature is unramped, so the cache is empty everywhere) and
self-healing on the next refresh. Deferred: closing it means making
`status` refresh from the server, which trades its offline-cheap
local-diagnostic nature. Will address before the feature ramps.

This pull request and its description were written by Isaac.

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.

2 participants