Skip to content

feat: pod repository link, onboard, runs and sessions - #29

Open
jeroenrinzema wants to merge 4 commits into
jeroenrinzema/cli-onboardingfrom
jeroenrinzema/pod-onboarding-commands
Open

jeroenrinzema wants to merge 4 commits into
jeroenrinzema/cli-onboardingfrom
jeroenrinzema/pod-onboarding-commands

Conversation

@jeroenrinzema

Copy link
Copy Markdown
Collaborator

Why

Repository onboarding is an agent run on a Pod (brainpodnl/brainpod#792). The CLI needs to link a repository to a Pod, start the onboarding run, and follow, answer, retry and reply to its runs and sessions, including the continuous-deploys pull request.

How

New Pod-scoped commands (all require --pod):

  • repo link OWNER/NAME: resolves the repository through GET /v1/github/repositories, then sends PUT /v1/pods/{pod}/repository. repo get shows the current link.
  • onboard [--ref]: POST /v1/pods/{pod}/agent-runs {agentKey: "repo-onboarding"}. It explains the brainpod/onboarding-<pod> branch, the GitHub Actions build, and the pull request whose merge turns on deploy-on-push.
  • runs list|get|cancel|retry|reply|answer: generic agent runs. answer validates against the run's open questions before resuming.
  • sessions list|get: the session's runs per step, open questions, and the continuous-deploys pull request with a hint for each state.

describe metadata and a README walkthrough (pod create → github repos → repo link → onboard → sessions get → merge the PR) are included.

Stacked on #28. Depends on brainpodnl/brainpod#793 and #796.

- `brainpod --pod X repo link OWNER/NAME` resolves the repository by exact case-insensitive fullName
  through /v1/github/repositories and links it with PUT /v1/pods/{pod}/repository; an inaccessible
  repository fails with the grant-access hints of `github repos`. `repo get` reads the link.
- `brainpod --pod X onboard [--ref]` starts the repo-onboarding agent run and points to `sessions get`.
- `brainpod --pod X runs list|get|cancel|retry|reply|answer`: reply generates its requestId;
  answer takes one --answer QUESTION_ID=ANSWER per open question and checks them against the run.
- `brainpod --pod X sessions list|get`: runs per step, open questions, continuous-deploys PR status.
- describe metadata and tests for every new command path.
@jeroenrinzema
jeroenrinzema marked this pull request as ready for review November 26, 2026 18:40
@jeroenrinzema
jeroenrinzema requested a balanced review from Copilot November 26, 2026 18:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The paginated repository lookup lacks regression tests for a page-2 exact match and an exhausted listing, leaving page advancement and no-PUT behavior without coverage.

1 open issue
What changed in this PR

Extends the GitHub discovery commands from #28 with Pod-scoped repository onboarding and run/session management, taking users from linking a repository to enabling deploy-on-push.

Changes:

  • Adds repository linking, onboarding, run actions, and session inspection commands.
  • Adds readable output for run states, open questions, and continuous-deploys pull requests.
  • Updates command metadata and documentation, with tests for parsing, answer validation, and rendering.
File Description
src/​output.rs Adds repository, onboarding, run, and session views with rendering tests.
src/​describe.rs Documents command requirements, effects, examples, and next steps.
src/​cmd/​mod.rs Implements commands, repository lookup, answer validation, and unit tests.
README.md Adds command reference entries and an onboarding walkthrough.

Review effort: Balanced

Comment thread src/cmd/mod.rs Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

On an unlinked Pod, replacing the underlying ApiError with anyhow! causes repo get --json to lose the API code, request ID, details, and HTTP status required by the JSON error contract.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Preserve API error metadata when adding the linking hint

src/​cmd/​mod.rs:1088

On an unlinked Pod, replacing the API error with anyhow! makes repo get --json emit CLI_ERROR instead of preserving the API's code, request ID, details, and HTTP status. src/main.rs:258–270 retrieves these from the underlying ApiError, as required by the JSON error contract in README.md:166. Attach the linking hint with error.context(...) so that cause remains available.

1 resolved since last review

Review effort: Balanced

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