Repository navigation
fix(plugin-diagnostics): read the session's --settings file as a settings layer - #16686
Conversation
…ings layer The shared reader (lib/enabled-plugin-roots.mjs) reads the file that SESSION_SETTINGS_FILE names after the project-local settings and before managed ones, so a plugin a session's --settings file turns off is not probed for prerequisites. Unset, or naming a missing or unreadable file, it adds nothing. The reader defines and documents the variable. plugin-profiles sets it in every one-session file it writes and clears an inherited one on launch; lane launches clear it too. The prerequisites table takes the settings route when it is set, since claude plugin list does not see the file, so the three readers agree. Closes #16673 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015XWwmd6tBpn6BvQsRn9MyP
|
Ownership: this pull request belongs to the control-hub session "Plugin Presets", which watches and merges it. The build session that opened it answers findings only as Plugin Presets relays them. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f7ef9bb48
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Lane run report
Failed GitHub API calls
|
|
claude-security-review reviewed claude-security-review, incremental review of I found no security issues in this change. What I checked:
Spend: none. The change adds no lane runs and no model use. critical-findings: 0 |
|
claude-review reviewed Code review: PR #16686, incremental (5f7ef9b → 7be201f)This pass covered only what changed since the last review, and only blocking findings, because this lane already reviewed an earlier head. I read the whole incremental change in both files listed for this pass:
No blocking findings. Both earlier findings are fixed
Both threads are also resolved by the owner. Their lines are unchanged since resolution, so I did not raise them again. Closing issue #16673
Other checks
Verifier dropped 0 of 0 candidates. |
… route With SESSION_SETTINGS_FILE set, check-prerequisites skips claude plugin list and reads settings files, but passed no managed files, so a plugin a managed policy forces on or off read wrongly and the table disagreed with the SessionStart hook and the session-telemetry reader. The settings route now reads the managed files, which win. The test suite unsets an inherited SESSION_SETTINGS_FILE, so running it from a plugin-profiles session no longer sends its listing cases down the settings route. Refs #16673 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015XWwmd6tBpn6BvQsRn9MyP
Post-merge mutation testingKilled 4, survived 2, timeout 0, no coverage 0, invalid 0, not run 1.
Surviving mutants
The run's summary has the full report. |
Closes #16673
Summary
A session started with a
--settingsfile that turns a plugin off still got that plugin's SessionStart prerequisite notices, because the shared reader never read that layer. Every plugin-profiles session starts that way. The reader now reads the file a variable it defines names, and plugin-profiles sets that variable in the session file it writes (owner decision on #16673, option (a), "Go with recommendations.", relayed by the hub "Plugin Presets").Fix
lib/enabled-plugin-roots.mjs(synced into plugin-diagnostics and harness-ops):rootsFromSettings(config, project, managed, env)reads the fileSESSION_SETTINGS_FILEnames after<project>/.claude/settings.local.jsonand before the managed files. With the variable unset, or naming a file that is missing or not JSON, it adds nothing. The header comment documents the variable; that is its one home.plugins/plugin-diagnostics/hooks/prerequisites-fleet.mjspasses itsenvto the reader.plugins/harness-ops/skills/prerequisites/scripts/check-prerequisites.mjs: with the variable set it takes the settings route, becauseclaude plugin list --jsondoes not see the session's--settingsfile. That route now reads the managed settings files too, which win.session-telemetry-state.mjspassesenvand its header now says a--settingssession is seen.plugins/plugin-profiles/scripts/profiles.mjs: both one-session writers (apply --for sessionandlaunch) setSESSION_SETTINGS_FILEto the file's own path, andlaunch's argv clears an inherited one (env -u SESSION_SETTINGS_FILE). A child started with no profile from a profiled shell would otherwise read the parent's file.plugins/harness-ops/skills/lanes/scripts/lane-launcher.sh: its no-profile launch lines clear the variable too, matching the two plugin-profiles variables they already clear.The variable is named for what it holds: the settings file the session was started with. It carries no plugin-profiles name, so the hook units read nothing another plugin owns (D35). Basis: the owner's rule "a hook unit never depends on a skill, an agent or a file of another plugin", and the naming rule that no status, severity or implementation word goes in a published name.
PLUGIN_PROFILES_SESSION_FILEnow carries the same path as the new variable. It stays becausestatus, lane-launcher, the fleet relay and machine-health use it as part of the launch contract, and removing it is not needed for this fix. Basis:git grep PLUGIN_PROFILES_SESSION_FILE(lane-launcher.sh, profiles.mjs, fleet eval samples, machine-health tests).Verification
Done-when, item by item:
--settingsfile turns a plugin off gets no prerequisite probe for it, shown by a test and by a live session.prerequisites-fleet.test.mjs, "a plugin the session's settings file turns off is not probed, and an unreadable session file adds nothing". User settings turn alpha on and the session file turns it off; alpha gets no notice and beta still does.claude -p -n probe-16673-session-layer --setting-sources "" --settings <throwaway file> --model claude-nonexistent-probe-0 "reply ok". The throwaway file turnsgo-format@melodic-softwareoff, setsSESSION_SETTINGS_FILEto its own path, and has a SessionStart command hook that runs this branch's reader. The hook wrote{"var":"<the file>","goFormat":false,"instructionPlacement":true}. The same script run outside the session, with the variable unset, wrotegoFormat:true. The run exited 1 on the unknown model, as expected.rootsFromSettingsagree on which plugins are enabled for that session. All three pass the session'senvto the same function.check-prerequisites.test.shcovers the one reader with a second route: "session: a plugin the session file turns off is not read" (a stub listing enables the plugin and the session file wins) "session: a missing session file adds nothing", and "session: a managed file that turns the plugin off wins over the session file". On that route the table reads the managed settings files, as the hook and the session-telemetry reader do.Suites run on this branch:
node --testonprofiles.test.mjs,prerequisites-fleet.test.mjsandsession-telemetry-state.test.mjs: 99 pass, 0 fail.check-prerequisites.test.sh: 51 cases, 0 failed, run with and without an inheritedSESSION_SETTINGS_FILE(the suite now unsets it).lane-launcher.test.sh: 575 cases pass.prerequisites-fleet.test.sh: 13 pass.scripts/sync-shared-copies.sh --check(and--check-bump origin/mainon the first head): pass.Related
PLUGIN_PROFILES_SESSION_FILE.🤖 Generated with Claude Code
https://claude.ai/code/session_015XWwmd6tBpn6BvQsRn9MyP