Skip to content

feat(copilot): carry over host settings into container#438

Open
abezzub-dr wants to merge 3 commits into
majorcontext:mainfrom
abezzub-dr:abezzub-dr/copilot-settings-passthrough
Open

feat(copilot): carry over host settings into container#438
abezzub-dr wants to merge 3 commits into
majorcontext:mainfrom
abezzub-dr:abezzub-dr/copilot-settings-passthrough

Conversation

@abezzub-dr

@abezzub-dr abezzub-dr commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Read ~/.copilot/settings.json and optional ~/.moat/copilot/settings.json overrides, filter through an allowlist of safe/useful settings, and write the merged result to the container staging directory.

Settings carried over

contextTier, effortLevel, footer, includeCoAuthoredBy, model, mouse, subagents, tabs, theme

Security: statusLine

statusLine.command executes arbitrary commands inside the container. It is only allowed from ~/.moat/copilot/settings.json (explicit user opt-in), not from the host's ~/.copilot/settings.json.

Precedence

CLI flag / moat.yaml > settings.json > Copilot default

Model/effortLevel/contextTier are stripped from settings.json when the corresponding CLI flag or moat.yaml field is set.

Design

  • MergeSettings(MergeOpts{}) accepts override values as parameters (no global state coupling)
  • MOAT_SKIP_HOST_COPILOT_SETTINGS=1 disables the feature for tests/CI
  • Follows the same pattern as Claude Code's settings merge (RawExtras passthrough)

@abezzub-dr abezzub-dr marked this pull request as draft July 9, 2026 16:16
@abezzub-dr abezzub-dr force-pushed the abezzub-dr/copilot-settings-passthrough branch 10 times, most recently from dc83862 to 900dfaa Compare July 9, 2026 17:31
@abezzub-dr

Copy link
Copy Markdown
Contributor Author

this has a dependency on #437, so I will rebase + update this PR once that lands

Read ~/.copilot/settings.json and optional ~/.moat/copilot/settings.json
overrides, filter through an allowlist of safe/useful settings, and write
the merged result to the container staging directory.

Carried over: statusLine, theme, model, effortLevel, contextTier, mouse,
beep, beepOnSchedule, renderMarkdown, scrollbar, compactPaste, copyOnSelect,
stream, terminalProgress, updateTerminalTitle, banner, showTipsOnStartup,
keepAlive, memory, includeCoAuthoredBy, subagents, tabs, screenReader,
stayInAutopilot, continueOnAutoMode.

Excluded (unsafe/nonfunctional in containers): proxyUrl, allowedUrls,
deniedUrls, notifications, hooks, trustedFolders, ide.*.

Precedence: CLI flag / moat.yaml > settings.json > Copilot default.
Model/effortLevel/contextTier are stripped from settings.json when the
corresponding CLI flag or moat.yaml field is set (they become --flags
which naturally override).

MergeSettings accepts MergeOpts to avoid coupling to mutable package-level
state. MOAT_SKIP_HOST_COPILOT_SETTINGS=1 disables the feature for tests/CI.
@abezzub-dr abezzub-dr force-pushed the abezzub-dr/copilot-settings-passthrough branch from 900dfaa to e779f9e Compare July 14, 2026 08:10
Strip contextTier/effortLevel from the staged settings.json when
--context/--reasoning-effort or copilot.context/copilot.reasoning_effort
(added in majorcontext#437) pin them, matching the existing model behavior.

PrepareContainer now reads the overrides from provider.PrepareOpts
instead of the copilot CLI's package globals, so 'moat run' with
agent: copilot applies moat.yaml precedence too. The copilot command's
ConfigureAgent writes flag-resolved values back into the config, which
the run manager threads through setupCopilotStaging.

Document the settings passthrough in the Copilot guide.
@abezzub-dr abezzub-dr marked this pull request as ready for review July 14, 2026 09:51
Read host Copilot settings from COPILOT_HOME when configured and normalize legacy colorMode values to the current theme key before writing container settings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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