Skip to content

feat: in-process Lua core handler for copilot (#47, phase 3)#66

Merged
Cannon07 merged 2 commits into
mainfrom
feat/copilot-in-process-handler
May 21, 2026
Merged

feat: in-process Lua core handler for copilot (#47, phase 3)#66
Cannon07 merged 2 commits into
mainfrom
feat/copilot-in-process-handler

Conversation

@Cannon07
Copy link
Copy Markdown
Owner

Summary

  • Flips the Copilot backend to the in-process Lua orchestrator that claudecode (feat: in-process Lua core handler for claudecode (#47, phase 3) #63) and opencode (feat: in-process Lua core handler for opencode (#47, phase 3) #65) already use. backends/copilot/code-{preview,close}-diff.sh become thin RPC wrappers; the {toolName, cwd, toolArgs} → canonical translation now lives in a new copilot entry of pre_tool.normalisers.
  • Copilot has no permission-decision analogue, so its emitter is none (default). When Neovim is unreachable, the shims abstain silently (exit 0) and Copilot falls back to its native flow.
  • Preserves the bash-side noise-tool short-circuit (view/glob/grep/ls/report_intent) as a perf filter — Copilot has no per-tool hook matcher (unlike Claude Code) and no TS-side allowlist (unlike opencode), so without this every chatty tool firing would pay for socket discovery + an RPC round-trip just to get a nil tool_name back. The Lua map remains the source of truth; the bash case is purely a fast-path.
  • Defensive empty-path/command branch in the normaliser drops tool_name to nil for Edit/Write/Bash/ApplyPatch with blank critical fields, matching the old shim's explicit if [[ -z "$FP" ]]; then exit 0 guard.

Closes the Copilot half of #47 phase 3 (collapsed with phase 4 per the pattern set by #63 and #65).

Test plan

  • ./tests/run_lua.sh — all green, including 15 new copilot normaliser rows
  • ./tests/run.sh — all 68 E2E tests pass (claudecode + opencode + copilot)
  • Manual: real Copilot CLI session — apply_patch (multi-file), bash rm/create, edit. Diffs open, neo-tree markers appear, accept/reject closes cleanly.
  • Manual: nvim-not-running abstain path verified

🤖 Generated with Claude Code

Cannon07 and others added 2 commits May 22, 2026 01:44
Flips Copilot to the in-process orchestrator that claudecode (#63) and
opencode (#65) already use. The shims become thin RPC wrappers into
code-preview.pre_tool / code-preview.post_tool; the Copilot-specific
{toolName, cwd, toolArgs} translation now lives in the new `copilot`
entry of pre_tool.normalisers.

Copilot has no permission-decision analogue, so its emitter is `none`.
When Neovim is unreachable the shims abstain silently (exit 0).

Preserved the bash-side noise-tool short-circuit (view/glob/grep/ls/
report_intent) as a perf filter — Copilot has no per-tool hook matcher
and no TS-side allowlist, so without this every chatty tool firing
would pay for socket discovery plus an RPC round-trip. The Lua map
remains the source of truth; the bash case is purely a fast-path.

Defensive empty-path/command branch in the normaliser drops tool_name
to nil for Edit/Write/Bash/ApplyPatch with blank critical fields,
matching the old shim's explicit skip-on-empty guard.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Updates the E2E test headers in tests/backends/copilot/* to point at the
in-process Lua flow (pre_tool.handle / post_tool.handle / apply/patch.lua)
instead of the retired bin/core-{pre,post}-tool.sh path. Also reframes the
"regression fixed in core-post-tool.sh" comment around the patch-paths loop
in post_tool.lua that the test actually guards now.

Adds a note in normalisers.lua (copilot block) explaining that paths are
collapsed through vim.fs.normalize — the old bash copilot shim preserved
paths verbatim, so this is a deliberate behavioural change to match the
canonical-key invariant opencode already follows.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Cannon07 Cannon07 merged commit c597387 into main May 21, 2026
2 checks passed
@Cannon07 Cannon07 deleted the feat/copilot-in-process-handler branch May 21, 2026 20:31
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