Repository navigation
O7-adjacent: resolve-style honours managed plugin installs and the per-OS managed settings - #466
Merged
Merged
Conversation
…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
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
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 noMAWS_NATIVE_TO_HUMANand no supplement 3; 6adfd847 (05:26:36Z) still gotMAWS_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.jsonenables those three plugins (devcloud seats them inprependPlugins).resolve-style.ts'spluginInstallPathstook only scopes user, project and local. It found no doperpowers style dir and no to-human install, somessageToolcame out false and the lane was off. Every devcloud host flips the same way after its first plugin update.Separately,
MANAGED_SETTINGS_PATHwas 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@doperpowersandto-human@doperpowerswere at scopemanaged, every other plugin atuser. The managed file's keys wereenabledPlugins,env,extraKnownMarketplacesandprependPlugins, and itsenabledPluginsturned those three on. It set nooutputStyleand noallowManagedHooksOnly. There was nomanaged-settings.d. User settings carryoutputStyle: doperpowers:to-human.What the engine reads (verified)
Docs
/Library/Application Support/ClaudeCode/managed-settings.json, Linux and WSL/etc/claude-code/managed-settings.json, WindowsC:\Program Files\ClaudeCode\managed-settings.json.managed-settings.d/beside it. The engine mergesmanaged-settings.jsonfirst, then every*.jsonin 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, then local, project and user. "Nothing in your own settings files or--settingsoverrides a managed key." ForenabledPlugins(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)switch(P()){case"macos":return"/Library/Application Support/ClaudeCode";case"windows":return"C:\\Program Files\\ClaudeCode";default:return"/etc/claude-code"}. Its override hookwMs()returnsundefinedin this build.managed-settings.jsonfirst, thenreaddirSync(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).["userSettings","projectSettings","localSettings","flagSettings","policySettings"], documented in the same binary as "Ordered low-to-high priority — later entries override earlier ones."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:managedapplies wherever auserone does.managed-settings.json, then themanaged-settings.dfragments in name order. This reuses engine-host's existing walk (managedSettingsDirandmanagedSettingsinsrc/engine-host/session-start-hooks.ts, written to the same engine reading for the SessionStart hold;managedSettingsis now exported). The fragments are put in the precedence chain last-first, so a later file's scalar wins andenabledPluginsmerges per plugin id. They stay above--settings, local, project and user settings foroutputStyleandenabledPlugins.allowManagedHooksOnlyis read from the managed files alone, and the last one that sets it decides.MANAGED_SETTINGS_PATHis gone. The tests' seam is nowplatformplussystemRoot, a scratch file-system root under which the platform's directory is read. The owner launch and mods deps carrysystemRoot, and their tests point it at a scratch directory.Red, then green
src/services/owner/resolve-style.test.tsgains 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 (scopemanaged, enabled by<root>/etc/claude-code/managed-settings.jsonunderplatform: 'linux'); and managedenabledPluginsand fragments winning over--settingsand local. The extended case coversallowManagedHooksOnlythrough fragments. Each injectsplatformand a scratch root, so no test reads a real system path. The Linux branch runs on any OS, and theunitjob runs it on Linux.managedSettingsPathseam 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, againstmessage-tool, contract 6,messageTool: true.pnpm exec vitest run src/services/owner/resolve-style.test.ts).Gates (class 1a on c1df712)
scripts/ci-gate.sh <worktree> --gates static,unit,probeson c1df712, run 41792090294:ci-gate: run 41792090294 success(exit 0).The
unitshards ran on ci-kit's pool, Linux GCE runners.src/services/owner/resolve-style.test.tsran in unit 2/4, 28 tests passing, so the Linux branch is covered off macOS. ci-gate warned thate2e:to-humanspecs reachtest/support/to-human-plugin.ts. That helper's newscopeoption defaults touser, so those specs write the same files as before.e2e:to-humanwas not run here.Left open
allowManagedHooksOnly: the engine still loads an organization's own mod under it (plugin force-enabled by managedenabledPluginsand 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.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)