-
Notifications
You must be signed in to change notification settings - Fork 0
feat(core): add copilot-cli provider #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Cancelling this openspec proposal. Reason: GitHub Copilot CLI lacks structured JSON output (no This means copilot-cli targets would:
The existing agent providers (Codex, Pi, Claude Code) are sufficient for our needs and all provide full observability. |
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
The -p flag takes the next argument as the prompt value. Other flags must come before -p to avoid "too many arguments" error. Co-Authored-By: Claude Opus 4.5 <[email protected]>
…enance Only keep copilot-cli as the canonical provider name. This follows the principle of keeping maintenance burden low since most other providers only have 0-1 aliases. Co-Authored-By: Claude Opus 4.5 <[email protected]>
03b29f5 to
06674cc
Compare
Deploying agentv with
|
| Latest commit: |
45a0396
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0d4bde77.agentv.pages.dev |
| Branch Preview URL: | https://feat-add-copilot-cli-provide.agentv.pages.dev |
Code Review: PR #127 — Add
|
| Check | Result |
|---|---|
bun run build |
PASS |
bun run typecheck |
PASS |
bun run lint |
PASS (212 files, no issues) |
bun run test |
PASS (385 tests across 28 files) |
What Was Done Well
- Pattern consistency — closely mirrors the
codexprovider structure, making the codebase predictable and maintainable - Testability — constructor accepts a
CopilotCliRunnerfunction for dependency injection, enabling clean unit tests without spawning real processes - Test coverage — 9 unit tests covering happy path, ANSI stripping, non-zero exit, timeout, empty output, model flag, custom args, input files/preread, and log streaming
- Clean integration — CLI log subscription and progress display follow the exact same pattern as codex/pi providers
- Alias removal — final commit removing
copilot/github-copilotaliases is a justified deviation from the proposal, keeping a single canonicalcopilot-cliname
Issues — Should Fix
1. Security: Unescaped shell argument in locateExecutable (copilot-cli.ts:454)
const { stdout } = await execAsync(`${locator} ${candidate}`);The candidate string from user YAML config is interpolated into a shell command without escaping. This is a pre-existing pattern from the codex provider, but propagating it further isn't ideal. Recommendation: use execFile instead of exec, or sanitize/quote the candidate. Could be addressed as a follow-up across all providers.
2. Prompt passed as CLI argument may hit OS ARG_MAX limits (copilot-cli.ts:90,170)
The full prompt (system prompt + base prompt with file contents) is passed via -p as a command-line argument. Linux ARG_MAX is typically ~2MB. Large evaluations could fail with E2BIG. The codex provider avoids this by piping via stdin (child.stdin.end(options.prompt)), while copilot-cli closes stdin immediately. Recommendation: investigate if Copilot CLI supports --prompt-file or stdin input; otherwise add a size check with a clear error.
3. Missing AGENTV_COPILOT_LOG_FORMAT env var fallback (targets.ts:950-952)
The codex resolver falls back to env.AGENTV_CODEX_LOG_FORMAT, but the copilot resolver has no equivalent env var fallback. Users setting log format via environment variables (common in CI) would expect parity. Recommendation: add env.AGENTV_COPILOT_LOG_FORMAT as a fallback in resolveCopilotConfig.
Suggestions — Nice to Have
4. Significant code duplication with codex provider — CopilotCliStreamLogger and several utility functions (buildLogFilename, sanitizeForFilename, formatElapsed, pickDetail, etc.) are duplicated near-verbatim. Consider extracting shared utilities if more CLI providers are planned.
5. ANSI stripping covers CSI and OSC sequences, which is sufficient for --no-color output, but doesn't cover 8-bit CSI (\x9B). Minor concern.
6. hasPrintedLogHeader flag in progress-display.ts — first provider to emit logs claims the header label; copilot logs appearing after codex logs won't get their own header. Pre-existing issue.
7. Tests should verify -p is the last argument pair — the code comments say this is required (copilot-cli.ts:169) but tests don't assert argument ordering. An assertion like expect(invocation.args.indexOf('-p')).toBe(invocation.args.length - 2) would catch regressions.
8. Pre-existing: system_prompt/systemPrompt missing from CODEX_SETTINGS validator — the copilot provider correctly includes these, but the codex validator set is missing them (causes spurious warnings). Not introduced by this PR.
Final Assessment
This is a well-executed PR that follows established codebase patterns. Issues #1-#3 should be discussed before merge, with #2 (argument length limits) being the most impactful for real-world usage. The remaining suggestions can be addressed as follow-ups.
🤖 Generated with Claude Code
Instead of referencing input files via file:// URIs pointing to absolute paths, copy them into the temp workspace and reference by relative path in the prompt. This allows Copilot CLI to read the files from its cwd. - Add copyInputFilesToWorkspace() with basename collision handling - Add buildCopilotFilePrereadBlock() for relative-path prompt sections - Replace buildPromptDocument with collectGuidelineFiles in invoke() - Include copiedFiles mappings in raw response for debugging - Update tests to assert no file:// URIs and add collision test Co-Authored-By: Claude Opus 4.5 <[email protected]>
Summary
copilot-clibuilt-in provider kind that invokes GitHub Copilot CLI via-s --allow-all-tools --no-color -p <prompt>Closes #127
Test plan
bun run build && bun run typecheck && bun run lint && bun testall pass (385 tests, 0 failures).agentv/logs/copilot-cli/with proper headers and timestamps🤖 Generated with Claude Code