Skip to content

assistant/codecompanion: rename strategies -> interactions#1497

Merged
NotAShelf merged 2 commits intoNotAShelf:mainfrom
SecBear:fix/codecompanion-strategies-to-interactions
Apr 7, 2026
Merged

assistant/codecompanion: rename strategies -> interactions#1497
NotAShelf merged 2 commits intoNotAShelf:mainfrom
SecBear:fix/codecompanion-strategies-to-interactions

Conversation

@SecBear
Copy link
Copy Markdown
Contributor

@SecBear SecBear commented Apr 5, 2026

Summary

codecompanion.nvim v19 renamed strategies to interactions (olimorris/codecompanion.nvim#2485). The nvf module still generates the deprecated strategies key in the Lua setup call.

Problem

codecompanion has a backwards-compat migration shim that detects strategies and converts it:

-- codecompanion config.lua:1274
if args.strategies then
  args.interactions = vim.tbl_deep_extend("force", vim.deepcopy(defaults.interactions), args.strategies)
  args.strategies = nil
end

When a user sets setupOpts.interactions (e.g. for adapter/CLI config) and the nvf module simultaneously generates setupOpts.strategies (for inline keymaps), the migration replaces the user's interactions table with defaults + strategies, silently discarding overrides like interactions.chat.adapter.

This causes the chat adapter to revert to the default (copilot), which fails with Copilot Adapter: No token found if the user does not have a GitHub Copilot token.

Fix

Rename the option tree from strategies to interactions so the generated Lua uses the current key and the migration shim is never triggered.

Sanity Checking

  • I have updated the changelog as per my changes
  • I have tested, and self-reviewed my code
  • My changes fit guidelines found in hacking nvf
  • Style and consistency
    • I ran Alejandra to format my code (nix fmt)
    • My code conforms to the editorconfig configuration of the project
    • My changes are consistent with the rest of the codebase
  • If new changes are particularly complex:
    • My code includes comments in particularly complex areas — N/A, trivial rename
    • I have added a section in the manual
    • (For breaking changes) I have included a migration guide
  • Package(s) built:
    • .#nix (default package)
    • .#maximal
    • .#docs-html — pre-existing: ndg lacks aarch64-darwin support
    • .#docs-linkcheck
  • Tested on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

🚀 Live preview deployed from 3ffc800

View it here:

Debug Information

Triggered by: SecBear

HEAD at: fix/codecompanion-strategies-to-interactions

Reruns: 2450

codecompanion.nvim v19 renamed `strategies` to `interactions`
(olimorris/codecompanion.nvim#2485). The nvf module still generated
the deprecated `strategies` key, which triggers codecompanion's
backwards-compat migration shim. That shim replaces any user-provided
`interactions` table with `defaults + strategies`, silently
discarding user overrides like `interactions.chat.adapter`.

Rename the option tree so the generated Lua uses the current
`interactions` key and the migration shim is never triggered.
@SecBear SecBear force-pushed the fix/codecompanion-strategies-to-interactions branch from 958c7f4 to 3820db9 Compare April 5, 2026 15:17
github-actions bot pushed a commit that referenced this pull request Apr 5, 2026
@NotAShelf
Copy link
Copy Markdown
Owner

I don't have the means to test, but diff lgtm.

github-actions bot pushed a commit that referenced this pull request Apr 7, 2026
@NotAShelf
Copy link
Copy Markdown
Owner

NotAShelf commented Apr 7, 2026

I thought auto-merge would get this...

@NotAShelf NotAShelf enabled auto-merge April 7, 2026 05:17
@NotAShelf NotAShelf merged commit 48b70a8 into NotAShelf:main Apr 7, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants