Skip to content

Kill ENABLE_MANAGED_AGENT_CONFIG; gate managed config on the server SAFE flag - #504

Merged
david-siqi-liu merged 1 commit into
mainfrom
david/kill-managed-config-flag
Sep 8, 2026
Merged

Kill ENABLE_MANAGED_AGENT_CONFIG; gate managed config on the server SAFE flag#504
david-siqi-liu merged 1 commit into
mainfrom
david/kill-managed-config-flag

Conversation

@david-siqi-liu

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

Copy link
Copy Markdown
Collaborator

🥞 Stack (ug configure + managed-config)


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.

@david-siqi-liu
david-siqi-liu force-pushed the david/kill-managed-config-flag branch from 377acf5 to a77db36 Compare September 8, 2026 15:47
Base automatically changed from david/ug-configure-wording to main September 8, 2026 16:16
david-siqi-liu added a commit that referenced this pull request Sep 8, 2026
## 🥞 Stack (ug configure + managed-config)

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

---

## 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:

```json
{"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.

Co-authored-by: Isaac <no-reply@databricks.com>
…AFE flag

Remove the client-side ENABLE_MANAGED_AGENT_CONFIG env var and
managed_agent_config_enabled(). Managed coding-agent config is now gated purely
by the server-side SAFE flag, which surfaces as FEATURE_DISABLED from
refresh_managed_config (authoritative: returns None and clears the cache).

- Drop the `ug configure` admin auto-routing. It was a passthrough when the flag
  was off, so configure now behaves as it always did for non-flag users:
  non-interactive, no managed-config prompts. Keeps omnigent's
  `ucode configure --profiles --agents ... --use-pat` non-interactive.
- Bare `ug` prints help when the feature is disabled server-side, instead of a
  silent no-op.
- Launch always consults the managed config (removed the cached-launch fast
  path) so an admin's config can't be bypassed by stale local state.
- Remove --skip-managed-config; it worked by unsetting the now-gone env var.
- status and the launch "no managed config" note key off the server signal.

Co-authored-by: Isaac <no-reply@databricks.com>
@david-siqi-liu
david-siqi-liu force-pushed the david/kill-managed-config-flag branch from a77db36 to 94db730 Compare September 8, 2026 16:22
@david-siqi-liu
david-siqi-liu merged commit 88d553c into main Sep 8, 2026
2 checks passed
@david-siqi-liu
david-siqi-liu deleted the david/kill-managed-config-flag branch September 8, 2026 16:29
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