Skip to content

O7-adjacent: resolve-style honours managed plugin installs and the per-OS managed settings - #466

Merged
SSFSKIM merged 1 commit into
masterfrom
o7adj-resolve-style-managed
Nov 4, 2026
Merged

SSFSKIM merged 1 commit into
masterfrom
o7adj-resolve-style-managed

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Nov 4, 2026

Copy link
Copy Markdown
Owner

The defect (devcloud setup session, 2026-11-04, dc-acceptance-bd31)

On a devcloud (Linux) host, sessions the MAWS app launches (lane B) lost mcp__to-human__message. Sessions 9b632827 (06:01Z) and fd3cd79c (06:25Z) launched with no MAWS_NATIVE_TO_HUMAN and no supplement 3; 6adfd847 (05:26:36Z) still got MAWS_NATIVE_TO_HUMAN=8. Nine seconds after that launch, the engine's startup plugin update rewrote ~/.claude/plugins/installed_plugins.json. The doperpowers, to-human and sminos records came back with scope "managed", because /etc/claude-code/managed-settings.json enables those three plugins (devcloud seats them in prependPlugins). resolve-style.ts's pluginInstallPaths took only scopes user, project and local. It found no doperpowers style dir and no to-human install, so messageTool came out false and the lane was off. Every devcloud host flips the same way after its first plugin update.

Separately, MANAGED_SETTINGS_PATH was macOS's path alone, so on Linux the resolver never read /etc/claude-code/managed-settings.json. It worked only because user settings also enabled the plugins.

Read-only host evidence (dc-acceptance-bd31, engine 2.1.316): doperpowers@doperpowers, sminos@doperpowers and to-human@doperpowers were at scope managed, every other plugin at user. The managed file's keys were enabledPlugins, env, extraKnownMarketplaces and prependPlugins, and its enabledPlugins turned those three on. It set no outputStyle and no allowManagedHooksOnly. There was no managed-settings.d. User settings carry outputStyle: doperpowers:to-human.

What the engine reads (verified)

Docs

  • Deploy managed settings, "Place the file on each machine": macOS /Library/Application Support/ClaudeCode/managed-settings.json, Linux and WSL /etc/claude-code/managed-settings.json, Windows C:\Program Files\ClaudeCode\managed-settings.json.
  • Same page, "Where each mechanism stores the policy" and "Split a file-based policy across teams": an optional managed-settings.d/ beside it. The engine merges managed-settings.json first, then every *.json in the directory in alphabetical order, ignoring hidden files and files that don't end in .json. For single values the later file wins; nested blocks merge key by key.
  • Settings precedence: managed, then --settings, then local, project and user. "Nothing in your own settings files or --settings overrides a managed key." For enabledPlugins (settings reference): "Plugins force-enabled by managed settings can't be disabled this way."

Binary (strings of ~/.local/share/claude/versions/2.1.318; the same code is in 2.1.316 and 2.1.310)

  • The managed directory: switch(P()){case"macos":return"/Library/Application Support/ClaudeCode";case"windows":return"C:\\Program Files\\ClaudeCode";default:return"/etc/claude-code"}. Its override hook wMs() returns undefined in this build.
  • The drop-in walk reads managed-settings.json first, then readdirSync(join(dir,"managed-settings.d")).filter(e=>(e.isFile()||e.isSymbolicLink())&&e.name.endsWith(".json")&&!e.name.startsWith(".")).map(e=>e.name).sort(). Each file is merged over the last with the settings deep-merge (jI(merged, s, MB): objects key by key, a later scalar replacing, arrays concatenated).
  • Source order is ["userSettings","projectSettings","localSettings","flagSettings","policySettings"], documented in the same binary as "Ordered low-to-high priority — later entries override earlier ones."
  • Install applicability: function PD(e){if(e.scope==="user"||e.scope==="managed")return!0; …projectPath…}. The plugin sync records every plugin the managed settings require as {scope:"managed",…}, which is the flip seen on the host.

The resolver reads only the file-based managed tier, the one the ruling names. The engine ranks remote (server-managed) settings and the MDM plist above that tier, first-wins, and the resolver still does not read them. See "Left open".

The fix

src/services/owner/resolve-style.ts:

  • An installation at scope managed applies wherever a user one does.
  • Managed settings are now read as the engine reads them: the platform's directory, managed-settings.json, then the managed-settings.d fragments in name order. This reuses engine-host's existing walk (managedSettingsDir and managedSettings in src/engine-host/session-start-hooks.ts, written to the same engine reading for the SessionStart hold; managedSettings is now exported). The fragments are put in the precedence chain last-first, so a later file's scalar wins and enabledPlugins merges per plugin id. They stay above --settings, local, project and user settings for outputStyle and enabledPlugins. allowManagedHooksOnly is read from the managed files alone, and the last one that sets it decides.
  • MANAGED_SETTINGS_PATH is gone. The tests' seam is now platform plus systemRoot, a scratch file-system root under which the platform's directory is read. The owner launch and mods deps carry systemRoot, and their tests point it at a scratch directory.

Red, then green

src/services/owner/resolve-style.test.ts gains four cases and extends one. The new cases: per-OS managed directory plus fragments; a managed-scope install, in a project or none; the devcloud host (scope managed, enabled by <root>/etc/claude-code/managed-settings.json under platform: 'linux'); and managed enabledPlugins and fragments winning over --settings and local. The extended case covers allowManagedHooksOnly through fragments. Each injects platform and a scratch root, so no test reads a real system path. The Linux branch runs on any OS, and the unit job runs it on Linux.

  • RED, on the unchanged resolver: 5 failed, 23 passed of 28. For the hermetic red run only, the ctx also carried the old managedSettingsPath seam pointing at the scratch file, so the old code never read the machine's path. The devcloud case failed exactly as the host did: shape: "none", unresolved: "the plugin doperpowers is not installed, enabled and applicable here", messageTool: false, against message-tool, contract 6, messageTool: true.
  • GREEN, on the fix: 28 passed of 28 (pnpm exec vitest run src/services/owner/resolve-style.test.ts).

Gates (class 1a on c1df712)

scripts/ci-gate.sh <worktree> --gates static,unit,probes on c1df712, run 41792090294: ci-gate: run 41792090294 success (exit 0).

success	plan
success	probes
success	static
success	unit 1/4
success	unit 2/4
success	unit 3/4
success	unit 4/4
skipped	unit:darwin

The unit shards ran on ci-kit's pool, Linux GCE runners. src/services/owner/resolve-style.test.ts ran in unit 2/4, 28 tests passing, so the Linux branch is covered off macOS. ci-gate warned that e2e:to-human specs reach test/support/to-human-plugin.ts. That helper's new scope option defaults to user, so those specs write the same files as before. e2e:to-human was not run here.

Left open

  • allowManagedHooksOnly: the engine still loads an organization's own mod under it (plugin force-enabled by managed enabledPlugins and loaded in place from a marketplace that managed settings name as a directory; mods admin). That covers the to-human plugin's tool, a mod. The resolver does not model it and reads the tool as off, which is the old conservative reading. No devcloud host sets the key today.
  • The remote and MDM managed tiers (first-wins above the files) are not read by the resolver. Neither is WSL's inherited Windows directory.
  • The P2-C plan (docs/doperpowers/plans/2026-10-08-p2-c-to-human.md, line 124) still says "user scope, or project or local scope". It is the architect's record to amend.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)

…r-OS managed settings

On a devcloud host the engine's startup plugin update records the plugins
/etc/claude-code/managed-settings.json enables at scope `managed`, and the
resolver took only user, project and local installs, so it found neither the
doperpowers style nor the to-human plugin and lane B launched without the
message tool (dc-acceptance-bd31, sessions 9b632827 and fd3cd79c). Its managed
settings path was also macOS's alone.

The resolver now reads the machine's setup as the engine does (2.1.318):
- an installation at scope `managed` applies wherever a user one does;
- managed settings come from the platform's directory (macOS
  /Library/Application Support/ClaudeCode, Linux /etc/claude-code):
  managed-settings.json, then each managed-settings.d/*.json (no dotfiles) in
  name order, a later file winning, through engine-host's existing walk;
- those files stay highest for outputStyle, enabledPlugins and
  allowManagedHooksOnly.

The tests' seam is now the platform and a scratch file-system root.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
@SSFSKIM
SSFSKIM merged commit e007a4a into master Nov 4, 2026
SSFSKIM added a commit that referenced this pull request Nov 4, 2026
… P5 Decision Log 214), P2-C's scope rule amended, a tracker row

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
@SSFSKIM
SSFSKIM deleted the o7adj-resolve-style-managed branch November 4, 2026 07:55
SSFSKIM added a commit that referenced this pull request Nov 4, 2026
…'s resolver, O12 M4's records)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
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