Skip to content

feat(forge)!: write PRs, holds, claims, and picks through a forge with a Kixel Quest backend - #769

Merged
moq-bot[bot] merged 5 commits into
mainfrom
quest/m1/forge-writes
Nov 17, 2026
Merged

moq-bot[bot] merged 5 commits into
mainfrom
quest/m1/forge-writes

Conversation

@kixelated

@kixelated kixelated commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • Interface and wire, in quest/core (src/core/forge.ts): ForgeWrites with open, close, edit, comment, resolve, hold, ready, release, and pick, beside the reads' Forge. Each write is POST /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, and Refusal (moved from src/cli/start.ts).
  • Kixel Quest backend (src/cli/forge.ts): KixelQuestForge implements 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> is https://kixel.quest or QUEST_KIXEL_URL. Such a repository is read and written only there (hostedForge); QUEST_FORGE=github cannot reach it, and its failures name no override.
  • One remote resolver (remoteHost in src/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 an insteadOf rewrite makes, so a Kixel Quest origin rewritten to a GitHub mirror (or the reverse) is written only on the forge the configuration names.
  • GitHub backend (src/cli/writes.ts, GitHubWrites): REST and GraphQL for open (sending head_repo from 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.
  • Commands on the interface: quest iterate, ready, release, merge, start (claim's draft PR, its earliest-PR race check, and --release's close), and quest review's ## Review record. 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 (--thread replies), and resolve, with gh pr's flags, on GitHub or Kixel Quest, so an agent has a way to do what skills ask where gh cannot reach. quest hook checks quest pr posts for the footer and em dashes as it does gh 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-review covers today with gh pr ready.
  • README: "Work on a repository Kixel Quest hosts"; --help of the changed commands says the same.

Choices made without asking (reviewable)

  • URL shapes that tell quest a repository lives on Kixel Quest: <url>/<owner>/<repo>.git and <url>/<owner>/<repo>/pull/<number>. kixel.quest's quest/m1/forge/repositories.md and pulls.md serve these; nothing there fixes another shape yet.
  • A claim is the draft PR row, as on GitHub: Kixel Quest refuses a second open PR on the same quest branch (409), which makes claiming atomic there. Holds are records keyed by the opaque token Kixel Quest issues, as the Plan says.
  • Reads that verify or rewrite a write (start's race check, --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.
  • OpenPull gains base, so the review record finds the PR into the reviewed base among pulls; quest review now lists the upstream's open PRs instead of GitHub's head/base-filtered query (one request either way, ETag-cached).
  • GitHubWrites lives in src/cli, not the Worker-safe src/github, because pick runs 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

  • Breaking for quest/core consumers (kixel-ai/kixel.quest): OpenPull has a new required base, which its pulls and held answers must carry; FORGE_CALLS now lists the writes too, with FORGE_READS for the reads alone. Migrate by serving base and routing only FORGE_READS to the index.
  • New wire API Kixel Quest serves for repositories it hosts (its quest/m1/forge/pulls.md), described above and in the README.
  • CLI: new quest pr commands; quest ready's token is optional; the PR argument of status, wait, iterate, ready, merge, and release takes Kixel Quest PR URLs. GitHub behavior and output are unchanged.

Validation

  • just check and just test pass (1448 tests).
  • test/forge-writes.test.ts drives 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 ## Waiting dropped, refused a pick while held, released, and picked at its head; a moved head is refused; --squash, --rebase, and --direct are usage errors that send nothing; tokenless ready; body files; a malformed body as a usage error; an outage naming no override; QUEST_FORGE=github and a missing token failing before any request. It also covers locating PRs and remotes (credentials, .git, dotted repo names like kixel.ai, a path-prefixed Kixel URL), the write wire's strictness, and GitHubWrites' comment, reply, resolve, and edit requests, including refusing another PR's or a missing thread before writing.
  • test/forge-writes.test.ts also covers both rewrite directions: a Kixel Quest origin rewritten to a GitHub mirror locates a number on Kixel Quest and quest pr comment <n> posts there with GitHub failing any request, a claim's upstream on such a remote never asks GitHub, a GitHub origin rewritten to Kixel Quest stays on GitHub, and a fork's open sends head_repo. All three tests fail on the previous head.
  • test/start.test.ts claims on a Kixel Quest remote reaching a local bare repository: draft PR opened there, second claim refused naming it, --release deletes the branch and closes the PR, a refused open takes the branch back, and quest pr create opens a PR from a pushed branch.
  • test/hold.test.ts: tokenless finish marks ready only, and refuses while a hold label is on the PR.
  • Real surface: the built dist/quest.js against the fake served by Bun.serve on localhost, with GH_TOKEN=invalid and a clone whose origin is http://localhost:8787/example/project.git (rewritten to a local bare repository): iterate printed hold-1 and a second refused (exit 3); pr comment 1 --thread, pr resolve 1, ready <url> hold-1, release, and merge --land worked, --squash exited 2, and the fake's state showed the body without ## Waiting, the reply, and the pick at the head. start quest/m1/bun-efault.md pushed the claim and opened draft quest: plan converging MoQ onto standalone Quest #3 with body Claims `quest/m1/bun-efault.md`., a second start was refused naming it, unblocked --unclaimed and waiting read through it, start --release deleted the branch and closed quest: plan converging MoQ onto standalone Quest #3, and pr create -d opened feat: name the branches a quest merges through #2. QUEST_FORGE=github quest status 1 failed naming the hosting. quest status 769 on GitHub printed as before.
  • Not exercised: a real Kixel Quest, which serves none of this yet (kixel-ai/kixel.quest's quest/m1/forge/pulls.md).

Follow-ups

  • quest/m1/kixel-pull-reads.md (M): quest pr view for a PR's body, comments, and reviews on Kixel Quest, and steering gh calls there to quest pr. Settled by the maintainer (comment), recorded in its Plan: ✅ keep it in m1 (rejected: drop); ✅ quest hook denies gh pr and gh api in a checkout whose origin is on Kixel Quest, naming the quest pr command, adding one line to the Checked rules quest context prints (rejected: a prose rule in quest context only; 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 review after 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-0f9a05f92523

  • Reviewer: Codex, gpt-6.1-sol, xhigh effort

  • Session: 01a1e8e4-7f42-7511-922a-54df7437c3ae, round 4

  • Score: 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-d8bf9db36f4a

  • Rounds: 2; first round 1 (medium 1); findings 1 (medium 1): fixed 1, refuted 0, open 0

kixelated and others added 2 commits November 17, 2026 01:21
Quest-Claim: e138f1114a63ff58
… a Kixel Quest backend

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title Forge writes for repositories on Kixel Quest feat(forge)!: write PRs, holds, claims, and picks through a forge with a Kixel Quest backend Nov 17, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 17, 2026 09:52
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1acf8908-7ca4-4c81-9383-00f5ea5a8398
Commits

Reviewing files that changed from the base of the PR and between ae12957 and 3fee1ac.

Files selected for processing: 28

  • README.md
  • quest/m1/forge-writes.md
  • quest/m1/kixel-pull-reads.md
  • src/cli/claims.ts
  • src/cli/forge.ts
  • src/cli/github.ts
  • src/cli/hold.ts
  • src/cli/land-apply.ts
  • src/cli/land-bump.ts
  • src/cli/land.ts
  • src/cli/landed.ts
  • src/cli/main.ts
  • src/cli/review-record.ts
  • src/cli/rules.ts
  • src/cli/start.ts
  • src/cli/writes.ts
  • src/core/forge.ts
  • src/core/index.ts
  • src/github/claims.ts
  • test/claims.test.ts
  • test/forge-writes.test.ts
  • test/forge.test.ts
  • test/hold.test.ts
  • test/kixel-fakes.ts
  • test/move.test.ts
  • test/review.test.ts
  • test/rules.test.ts
  • test/start.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@kixelated

Copy link
Copy Markdown
Collaborator Author

Maintainer decision (from the maintainer's /quest-run pick round, 2026-11-17):

  • Merge pick: ✅ /quest-merge once the follow-up answers below are recorded.
  • Follow-up quest/m1/kixel-pull-reads.md: ✅ keep it in m1 (rejected: drop).
  • Its decision: ✅ quest hook denies gh pr and gh api calls in a checkout whose origin is on Kixel Quest, naming the quest pr command to run, which adds one line to the Checked rules quest context prints (rejected: a prose rule in quest context only; neither).

(Written by Claude Opus 5.5 with high effort)

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

@pullfrog pullfrog Bot 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.

ℹ️ 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.

  • ForgeWrites and its wire in quest/core: open, close, edit, comment, resolve, hold, ready, release, and pick, each sent as POST /forge/<write> with strict parsers. Refusal moves to core, and OpenPull gains a required base, which breaks the kixel.quest wire.
  • Kixel Quest hosting detection: hostedRepository and locate match a remote or PR URL against kixelUrl(env). The token still goes only to the configured endpoint, never to a host taken from the remote. A 409 on a write becomes a Refusal (exit 3), and a 400 becomes an InputError (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 in hold.ts.
  • Upstream.hosting: claims, start (the draft claim, its race check, and --release), and the quest review record now run through one Hosting for both GitHub and Kixel Quest. Reads that check a write use live().
  • New quest pr commands and a tokenless quest ready: create, edit, comment --thread, and resolve. quest ready without a token only marks a draft ready, and refuses while a hold label is on the PR. The hook checks quest pr posts the same way it checks gh pr.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

Comment thread src/cli/main.ts Resolved
Comment thread src/cli/claims.ts Resolved
… 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>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Addressed in b1fdba9:

  • Review on 3d05b4a7, wrong-target writes: fixed. remoteHost (src/cli/github.ts) asks Kixel Quest and then GitHub of a remote's configured URL before the insteadOf-rewritten one, and both locate (bare PR numbers) and upstream (claims, review records) use it. Tests in test/forge-writes.test.ts cover both rewrite directions, with a fake that fails any request to GitHub.
  • Same review, head_repo: fixed. GitHubWrites.open() sends head_repo as owner/repo for a PR from another repository, tested with two repositories under one owner.
  • Same review, OpenPull.base rollout: nothing is in production yet, so per this repository's AGENTS.md the wire changes directly with no compatibility shim; the PR body's Public API section gives the migration.
  • Maintainer decision: recorded in quest/m1/kixel-pull-reads.md's Plan with its ## Waiting removed, and ## Follow-ups shows it settled.

(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 kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

@pullfrog pullfrog Bot 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.

✅ No new issues found. Both earlier inline findings are fixed, and the fixes for the other reviewer's wrong-forge and head_repo findings 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 that insteadOf produces. Both locate() (a bare PR number) and upstream() (claims) use it now, so a rewrite to the other forge's mirror can no longer send writes there. hostedRepository and ClaimDependencies.kixel.hosted now take a single URL.
  • Sent head_repo when opening a PR from a fork. GitHubWrites.open includes 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's headAt already compares case-insensitively.
  • Dropped the unused ClaimDependencies.writes option. upstream now builds GitHubWrites directly.
  • 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).

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@moq-bot
moq-bot Bot added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 1ab7d70 Nov 17, 2026
14 checks passed
@moq-bot
moq-bot Bot deleted the quest/m1/forge-writes branch November 17, 2026 10:09
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