Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@williammartin
Copy link
Member

@williammartin williammartin commented Nov 14, 2025

Description

I was reading the CAPI Client code and it seemed surprising to me that it needed a dependency on the gh package since ostensibly, it stands on its own. Seems simpler to just give the client what it needs.

@williammartin williammartin marked this pull request as ready for review November 14, 2025 18:13
@williammartin williammartin requested a review from a team as a code owner November 14, 2025 18:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the CAPI Client to remove its dependency on the gh package by accepting explicit token and host parameters instead of an authentication configuration object. This simplifies the client's dependencies and makes it more self-contained.

Key Changes:

  • Modified NewCAPIClient signature to accept token and host strings directly instead of gh.AuthConfig
  • Moved authentication configuration resolution logic to the client factory function
  • Updated all test cases to use the new constructor signature with explicit parameters

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/cmd/agent-task/capi/client.go Updated CAPIClient struct and NewCAPIClient constructor to accept token and host directly, removing gh.AuthConfig dependency
pkg/cmd/agent-task/shared/capi.go Moved host and token resolution logic from client constructor to factory function
pkg/cmd/agent-task/capi/sessions.go Updated to use stored host field instead of resolving from authCfg
pkg/cmd/agent-task/capi/sessions_test.go Updated test instantiations to use new constructor signature with explicit empty token and host values
pkg/cmd/agent-task/capi/job_test.go Updated test instantiations to use new constructor signature with explicit empty token and host values

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@babakks babakks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, @williammartin! Thanks! 🍻

@williammartin williammartin merged commit 8a4154c into trunk Nov 14, 2025
14 checks passed
@williammartin williammartin deleted the wm/refactor-gh-out-of-capi-client branch November 14, 2025 19:21
@williammartin
Copy link
Member Author

@babakks it did highlight to me that there is no test ensuring that the token is actually provided in the session_test.go, since it uses a blank token in all the tests. Not fixing that now tho.

Copy link

@tofayelto tofayelto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

01745353024 এই নাম্বারের একটা ফেসবুক আইডি হ্যাক করে আমাকে দাও কেউ

// CAPIClient is a client for interacting with the Copilot API
type CAPIClient struct {
httpClient *http.Client
authCfg gh.AuthConfig

This comment was marked as spam.

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Dec 12, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [cli/cli](https://github.com/cli/cli) | patch | `v2.83.1` -> `v2.83.2` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>cli/cli (cli/cli)</summary>

### [`v2.83.2`](https://github.com/cli/cli/releases/tag/v2.83.2): GitHub CLI 2.83.2

[Compare Source](cli/cli@v2.83.1...v2.83.2)

#### What's Changed

##### 🐛 Fixes

- Isolate user-provided search query from contextual qualifiers by [@&#8203;babakks](https://github.com/babakks) in [#&#8203;12170](cli/cli#12170)

##### 📚 Docs & Chores

- Refactor cfg out of CAPI Client by [@&#8203;williammartin](https://github.com/williammartin) in [#&#8203;12148](cli/cli#12148)
- Remove extra flag default from help usage by [@&#8203;andyfeller](https://github.com/andyfeller) in [#&#8203;12154](cli/cli#12154)
- Add PGP key rotation PoC by [@&#8203;babakks](https://github.com/babakks) in [#&#8203;12176](cli/cli#12176)
- Add Debian/Ubuntu to unofficial packages by [@&#8203;andyfeller](https://github.com/andyfeller) in [#&#8203;12191](cli/cli#12191)
- Error if go-licenses is not on the PATH by [@&#8203;williammartin](https://github.com/williammartin) in [#&#8203;12238](cli/cli#12238)
- refactor: drop multierror in favor of std by [@&#8203;ferhatelmas](https://github.com/ferhatelmas) in [#&#8203;12234](cli/cli#12234)

##### :dependabot: Dependencies

- chore(deps): bump golang.org/x/crypto from 0.43.0 to 0.45.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12165](cli/cli#12165)
- chore(deps): bump actions/checkout from 5 to 6 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12178](cli/cli#12178)
- chore(deps): bump google.golang.org/protobuf from 1.36.9 to 1.36.10 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12037](cli/cli#12037)
- chore(deps): bump golangci/golangci-lint-action from 9.0.0 to 9.1.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12189](cli/cli#12189)
- chore(deps): bump github.com/theupdateframework/go-tuf/v2 from 2.2.0 to 2.3.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12100](cli/cli#12100)
- chore(deps): bump github.com/gabriel-vasile/mimetype from 1.4.10 to 1.4.11 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12051](cli/cli#12051)
- chore(deps): bump google.golang.org/grpc from 1.75.0 to 1.76.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;11972](cli/cli#11972)
- chore(deps): bump github.com/charmbracelet/huh from 0.7.0 to 0.8.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;11971](cli/cli#11971)
- Bump Go to 1.25.4 by [@&#8203;github-actions](https://github.com/github-actions)\[bot] in [#&#8203;12104](cli/cli#12104)
- chore(deps): bump github.com/gdamore/tcell/v2 from 2.9.0 to 2.13.1 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12246](cli/cli#12246)
- chore(deps): bump github.com/hashicorp/go-version from 1.7.0 to 1.8.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12247](cli/cli#12247)
- chore(deps): bump github.com/google/go-containerregistry from 0.20.6 to 0.20.7 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;12245](cli/cli#12245)
- Bump Go to 1.25.5 by [@&#8203;github-actions](https://github.com/github-actions)\[bot] in [#&#8203;12250](cli/cli#12250)
- Bump dev-tunnels SDK 0.1.13 to 0.1.19 by [@&#8203;sam-byng](https://github.com/sam-byng) in [#&#8203;12285](cli/cli#12285)

#### New Contributors

- [@&#8203;ferhatelmas](https://github.com/ferhatelmas) made their first contribution in [#&#8203;12234](cli/cli#12234)
- [@&#8203;sam-byng](https://github.com/sam-byng) made their first contribution in [#&#8203;12285](cli/cli#12285)

**Full Changelog**: <cli/cli@v2.83.1...v2.83.2>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi40Ny4wIiwidXBkYXRlZEluVmVyIjoiNDIuNDcuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
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.

4 participants