Repository navigation
feat(forge)!: write PRs, holds, claims, and picks through a forge with a Kixel Quest backend - #769
Conversation
Quest-Claim: e138f1114a63ff58
… a Kixel Quest backend Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 19 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Maintainer decision (from the maintainer's
(Written by Claude Opus 5.5 with high effort) |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed head 3d05b4a7308ba00700f81a1430c4c515007485f1.
Hold for wrong-target writes. In forge.ts::locate and claims.ts::upstream, a configured Kixel-hosted remote loses to a rewritten GitHub URL. With a Kixel origin and an insteadOf GitHub mirror, a bare-number PR command can post to the mirror's PR with that number, although the configured origin says to write only to Kixel. Prefer the configured identity for either forge and consult the rewritten URL only if neither recognizes the configured one. Share that resolver between numeric targets and claim/review writes; test both rewrite directions with a fake that fails on any request to the wrong forge.
GitHub fork creation also needs the head repository. GitHubWrites.open() detects that head.repo differs, but serializes only owner:branch. GitHub's Create a pull request docs require head_repo for cross-repo PRs within one organization. Send it from Opening.head.repo and test two repos under the same owner.
The strict OpenPull.base change also requires a coordinated compatibility plan for existing remote pulls/ held clients. The same-version fake does not verify that rollout or the real server's atomic head check. Static review; no write tests against either service.
There was a problem hiding this comment.
ℹ️ No critical issues — two small rough edges inline.
Reviewed changes
The initial review covers the whole PR: forge writes behind a ForgeWrites interface, with a Kixel Quest backend for repositories it hosts and a GitHub backend for the rest.
ForgeWritesand its wire inquest/core: open, close, edit, comment, resolve, hold, ready, release, and pick, each sent asPOST /forge/<write>with strict parsers.Refusalmoves to core, andOpenPullgains a requiredbase, which breaks the kixel.quest wire.- Kixel Quest hosting detection:
hostedRepositoryandlocatematch a remote or PR URL againstkixelUrl(env). The token still goes only to the configured endpoint, never to a host taken from the remote. A 409 on a write becomes aRefusal(exit 3), and a 400 becomes anInputError(exit 2). GitHubWrites: REST and GraphQL for opening, editing, commenting, and threads. A thread ID is checked against the PR before any write. Hold, ready, release, and pick go to the existing label logic inhold.ts.Upstream.hosting: claims,start(the draft claim, its race check, and--release), and thequest reviewrecord now run through oneHostingfor both GitHub and Kixel Quest. Reads that check a write uselive().- New
quest prcommands and a tokenlessquest ready:create,edit,comment --thread, andresolve.quest readywithout a token only marks a draft ready, and refuses while a hold label is on the PR. The hook checksquest prposts the same way it checksgh pr.
claude-opus-5-5 | 𝕏
… name a fork's head_repo A Kixel Quest origin rewritten to a GitHub mirror (or the reverse) now writes to the forge the configured URL names, through one resolver, remoteHost, that both a bare PR number and a claim's upstream use. GitHub PRs opened from a fork send head_repo, which GitHub needs for two repositories of one owner. Records the maintainer's answer on quest/m1/kixel-pull-reads.md: quest hook denies gh pr and gh api on Kixel Quest checkouts, with a Checked line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed in b1fdba9:
(Written by Claude Opus 5.5 with low effort) |
…he unused claim writes dependency Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed head b1fdba940000ec83f9d039c700288d32177d48bc.
The wrong-forge finding is fixed by inspection. Numeric PR targets and claims now resolve the configured repository before consulting URL rewrites, and the tests cover both rewrite directions. The fork request now includes head_repo, with a same-owner fixture. I did not validate that request against live GitHub. The remaining rollout caveat is unchanged: the real server needs the atomic head check and a compatible transition for OpenPull.base, not just the same-version fake. No remaining client-side blocker from my prior review.
There was a problem hiding this comment.
✅ No new issues found. Both earlier inline findings are fixed, and the fixes for the other reviewer's wrong-forge and
head_repofindings look correct.
Reviewed changes
This review covers b1fdba9 and 3fee1ac, which landed after the prior Pullfrog review at 3d05b4a.
- Added one remote resolver,
remoteHost. It asks Kixel Quest and then GitHub about a remote's configured fetch URL before trying the URL thatinsteadOfproduces. Bothlocate()(a bare PR number) andupstream()(claims) use it now, so a rewrite to the other forge's mirror can no longer send writes there.hostedRepositoryandClaimDependencies.kixel.hostednow take a single URL. - Sent
head_repowhen opening a PR from a fork.GitHubWrites.openincludes it so GitHub can tell apart two repositories with the same owner. - Lowercased
--land's SHA before the pick. This fixes the 400 Kixel Quest returned for an uppercase SHA. GitHub'sheadAtalready compares case-insensitively. - Dropped the unused
ClaimDependencies.writesoption.upstreamnow buildsGitHubWritesdirectly. - Added tests for both rewrite directions, a claim upstream that never calls GitHub, a fork
open, and an uppercase--land.
I ran tsc --noEmit locally and it was clean. test/forge-writes.test.ts and test/start.test.ts also pass (65 tests).
claude-opus-5-5 | 𝕏

Finishes quest/m1/forge-writes.md: on a repository whose forge is Kixel Quest, quest opens, edits, readies, comments on, holds, claims, and picks PRs and resolves review threads there, with no call to GitHub.
Summary
quest/core(src/core/forge.ts):ForgeWriteswithopen,close,edit,comment,resolve,hold,ready,release, andpick, beside the reads'Forge. Each write isPOST /forge/<write>answering{value, asOf}(asOf null), with strict request and answer parsers like the reads'. A 409{error}is a refusal (exit 3), such as a PR another session holds, a second open PR on a claimed branch, or a pick of a head that moved; a 400 is a usage error. New exports:ForgeWrites,Opening,Hold,Pick,Method,FORGE_READS,FORGE_WRITES, andRefusal(moved fromsrc/cli/start.ts).src/cli/forge.ts):KixelQuestForgeimplements the writes. A repository Kixel Quest hosts is known from its URL alone: a remote<url>/<owner>/<repo>[.git]or a PR URL<url>/<owner>/<repo>/pull/<n>, where<url>ishttps://kixel.questorQUEST_KIXEL_URL. Such a repository is read and written only there (hostedForge);QUEST_FORGE=githubcannot reach it, and its failures name no override.remoteHostinsrc/cli/github.ts): a bare PR number and a claim's upstream both ask Kixel Quest and then GitHub of the remote's configured URL before the URL aninsteadOfrewrite makes, so a Kixel Quest origin rewritten to a GitHub mirror (or the reverse) is written only on the forge the configuration names.src/cli/writes.ts,GitHubWrites): REST and GraphQL for open (sendinghead_repofrom a fork, which GitHub needs for two repositories of one owner), close, edit, comment, thread replies, and resolve (refusing a thread ID from another PR before writing), and the existing label holds and landing for hold, ready, release, and pick.quest iterate,ready,release,merge,start(claim's draft PR, its earliest-PR race check, and--release's close), andquest review's## Reviewrecord. On Kixel Quest,quest merge --land <sha>records a pick of that head and refuses--squash,--rebase, and--direct, since its queue fast-forwards the base.quest pr, new:create,edit,comment(--threadreplies), andresolve, withgh pr's flags, on GitHub or Kixel Quest, so an agent has a way to do what skills ask whereghcannot reach.quest hookchecksquest prposts for the footer and em dashes as it doesgh pr.quest ready <pr>now takes the token optionally: without one it only marks a draft ready, refusing while any session holds it, the case/quest-reviewcovers today withgh pr ready.--helpof the changed commands says the same.Choices made without asking (reviewable)
<url>/<owner>/<repo>.gitand<url>/<owner>/<repo>/pull/<number>. kixel.quest'squest/m1/forge/repositories.mdandpulls.mdserve these; nothing there fixes another shape yet.--release's PR lookup, the review record's body) read the forge itself (Hosting.live()), never an index that may lag, as feat(forge)!: read PR, claim, and wait state through a forge with a Kixel Quest backend #753 kept them on GitHub.OpenPullgainsbase, so the review record finds the PR into the reviewed base amongpulls;quest reviewnow lists the upstream's open PRs instead of GitHub'shead/base-filtered query (one request either way, ETag-cached).GitHubWriteslives insrc/cli, not the Worker-safesrc/github, becausepickruns the CLI's landing check; Kixel Quest does not fall through writes to GitHub, since a hosted repository is not on GitHub.Public API and wire
quest/coreconsumers (kixel-ai/kixel.quest):OpenPullhas a new requiredbase, which itspullsandheldanswers must carry;FORGE_CALLSnow lists the writes too, withFORGE_READSfor the reads alone. Migrate by servingbaseand routing onlyFORGE_READSto the index.quest/m1/forge/pulls.md), described above and in the README.quest prcommands;quest ready's token is optional; the PR argument ofstatus,wait,iterate,ready,merge, andreleasetakes Kixel Quest PR URLs. GitHub behavior and output are unchanged.Validation
just checkandjust testpass (1448 tests).test/forge-writes.test.tsdrives the CLI against a fake Kixel Quest (test/kixel-fakes.ts) that parses every request with quest's own wire parsers, answers refusals with 409, and fails the test on any request to another host: one PR is edited, taken (a second session refused, the token kept), replied to in its thread, its thread resolved (a stray thread refused), readied with## Waitingdropped, refused a pick while held, released, and picked at its head; a moved head is refused;--squash,--rebase, and--directare usage errors that send nothing; tokenless ready; body files; a malformed body as a usage error; an outage naming no override;QUEST_FORGE=githuband a missing token failing before any request. It also covers locating PRs and remotes (credentials,.git, dotted repo names likekixel.ai, a path-prefixed Kixel URL), the write wire's strictness, andGitHubWrites' comment, reply, resolve, and edit requests, including refusing another PR's or a missing thread before writing.test/forge-writes.test.tsalso covers both rewrite directions: a Kixel Quest origin rewritten to a GitHub mirror locates a number on Kixel Quest andquest pr comment <n>posts there with GitHub failing any request, a claim'supstreamon such a remote never asks GitHub, a GitHub origin rewritten to Kixel Quest stays on GitHub, and a fork'sopensendshead_repo. All three tests fail on the previous head.test/start.test.tsclaims on a Kixel Quest remote reaching a local bare repository: draft PR opened there, second claim refused naming it,--releasedeletes the branch and closes the PR, a refused open takes the branch back, andquest pr createopens a PR from a pushed branch.test/hold.test.ts: tokenlessfinishmarks ready only, and refuses while a hold label is on the PR.dist/quest.jsagainst the fake served byBun.serveon localhost, withGH_TOKEN=invalidand a clone whose origin ishttp://localhost:8787/example/project.git(rewritten to a local bare repository):iterateprintedhold-1and a second refused (exit 3);pr comment 1 --thread,pr resolve 1,ready <url> hold-1,release, andmerge --landworked,--squashexited 2, and the fake's state showed the body without## Waiting, the reply, and the pick at the head.start quest/m1/bun-efault.mdpushed the claim and opened draft quest: plan converging MoQ onto standalone Quest #3 with bodyClaims `quest/m1/bun-efault.md`., a second start was refused naming it,unblocked --unclaimedandwaitingread through it,start --releasedeleted the branch and closed quest: plan converging MoQ onto standalone Quest #3, andpr create -dopened feat: name the branches a quest merges through #2.QUEST_FORGE=github quest status 1failed naming the hosting.quest status 769on GitHub printed as before.quest/m1/forge/pulls.md).Follow-ups
quest pr viewfor a PR's body, comments, and reviews on Kixel Quest, and steeringghcalls there toquest pr. Settled by the maintainer (comment), recorded in its Plan: ✅ keep it in m1 (rejected: drop); ✅quest hookdeniesgh prandgh apiin a checkout whose origin is on Kixel Quest, naming thequest prcommand, adding one line to the Checked rulesquest contextprints (rejected: a prose rule inquest contextonly; neither).Models
Size: L
Implementer: Claude Code, claude-opus-5-5, high effort
Implementer: Claude Code, claude-opus-5-5, low effort (iterate, XS)
Review
Rewritten by
quest reviewafter each round.Head: 3fee1ac
Base: origin/main at 4249857
Risk: high,
The change alters the forge wire protocol and exported PR shape that Kixel Code and Kixel Quest depend on, and adds remote writes and merge picks whose effects on repositories and agent work cannot all be undone by reverting.Classified: high by Codex, gpt-6.1-sol, low effort, session
01a1e8f6-0150-7c50-8122-0f9a05f92523Reviewer: Codex, gpt-6.1-sol, xhigh effort
Session:
01a1e8e4-7f42-7511-922a-54df7437c3ae, round 4Score: 10/10,
The incremental changes correctly normalize merge SHAs and remove an unused dependency without new findings; builds and tests were not run, as instructed.Rounds: 4; first round 1 (medium 1); findings 1 (medium 1): fixed 1, refuted 0, open 0
Findings: none
Reviewer: Codex, gpt-6.1-sol, high effort, shadow
Session:
01a1e8e4-7f42-70c1-8900-d8bf9db36f4aRounds: 2; first round 1 (medium 1); findings 1 (medium 1): fixed 1, refuted 0, open 0