Skip to content

add managed CodingAgentConfig read client, normalize, and local persist - #262

Open
asujithan wants to merge 4 commits into
mainfrom
asujithan/managed-config
Open

add managed CodingAgentConfig read client, normalize, and local persist#262
asujithan wants to merge 4 commits into
mainfrom
asujithan/managed-config

Conversation

@asujithan

@asujithan asujithan commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Changes

Developer-read side of [Coding Gateway Configuration Management]). Adds the data layer that lets a developer's ucode pull the org admin's CodingAgentConfig and stores it locally to ~/.ucode/managed-state.json, so later PRs can reconcile it against local state and apply it to agents.

This PR is the foundation only — no CLI wiring or agent application yet (those are follow-up PRs). Nothing here runs during a real ucode/ucode configure command; it's exercised by tests.

Changes

  • databricks.py: fetch_managed_coding_agent_configs(workspace, token) — reads the workspace's config via the non-admin List endpoint (GET /api/ai-gateway/v2/coding-agent-configs), returning raw manifest dicts or an actionable reason. Workspace is resolved server-side, so no id is needed.
  • managed_config.py (new):
    • normalize_managed_config — proto-JSON → ucode-native shape (maps CODING_AGENT_*/MCP_SERVER_TYPE_* enums to ucode tool/type names; drops agents/types this build doesn't recognize).
    • get_managed_config — fetch + normalize, with a 3-way return (config / no-config / error).
    • save/load/delete_managed_state — persist to ~/.ucode/managed-state.json (0600; load is workspace-scoped so a stale file is ignored).

Test Plan

  • Tests: 22 cases covering normalization, the fetch client's parsing/error paths, and persistence (round-trip, 0600, workspace-scoping).

Not in this PR (follow-ups )

  • Reconcile managed vs local state + apply manifest to agents/MCP/skills/tracing.
  • ucode configure gating + bare-ucode Path A wiring.
  • Sudo/root-ownership enforcement of managed-state.json (0600 is an interim best-effort; real enforcement needs a privileged path + elevation and is its own change).

Comment on lines +234 to +237
Returns ``(config, reason)``:
- ``(config, None)`` — the normalized manifest for the workspace's single config;
- ``(None, None)`` — no managed config is defined for the workspace (not an error);
- ``(None, reason)`` — the read failed; ``reason`` says why.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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