Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Security and behavior changes

## 0.1.0-beta.1 — CLI onboarding release

Native review decisions, automatic owner-consented reviews, autonomous and optional human-supervised merging. Browser ChatGPT onboarding remains explicitly deferred and disabled. Repository opt-in and all actual GitHub protections remain mandatory.


- Allow an explicit, bounded operator request budget only for the exact disposable acceptance tenant. Preserve all counters, other quotas, authorization, protected policy and native review requirements; disabled by default.

- Parse real JS/TS import syntax with the existing pinned TypeScript compiler when selecting essential context. Generated-code strings/comments no longer cause false missing-dependency failures; actual missing imports/exports/require calls remain fail-closed.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ Set `bot.trigger: "@CBReview"` to use the example above. The legacy default `@co

## Status

**CLI release acceptance in progress.** Real complete COMMENT and inline advisory reviews, native APPROVE, high-confidence REQUEST_CHANGES, token rotation and an exact-head autonomous App merge without human approval have been verified. Final unattended-contributor and Human-in-the-Loop live acceptance is still pending; no public release is claimed yet.
**CLI-based beta.** CodexBot supports complete native COMMENT, APPROVE and REQUEST_CHANGES reviews, automatic reviews, owner-consented unattended credentials, Fully Autonomous merging and optional Human-in-the-Loop. Release evidence and remaining beta limitations are recorded in the GitHub release notes.

Browser ChatGPT onboarding is intentionally deferred and is **not a release blocker**. Keep `WEB_ENABLED=false` and `OPENAI_HOSTED_INFERENCE_AUTHORIZED=false`. Installation redirects lead to the CLI instructions; no website OAuth client is needed for the approved existing CLI connection. Reviews and merges then run without an ongoing CLI process. See [configuration](docs/configuration.md) for explicit repository-owner credential assignment and the two merge modes.

AI reviews can miss defects. GitHub protections, required CI, separate merge authorization and repository opt-in always apply. The global merge gate stays closed during final acceptance; live merge tests are restricted to the exact disposable repository and installation.
AI reviews can miss defects. GitHub protections, required CI, separate merge authorization and repository opt-in always apply. Merging requires both deployment authorization and explicit repository opt-in. Fully Autonomous uses zero required humans; Human-in-the-Loop adds independent human approvals. Neither mode bypasses GitHub protections.

## What is implemented

Expand Down
2 changes: 2 additions & 0 deletions docs/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,5 @@ While `MERGE_DEPLOYMENT_AUTHORIZED=false`, the operator can temporarily configur
No human approval is required by CodexBot in Fully Autonomous mode when the compatible GitHub rules also require zero humans. Human-in-the-Loop and stricter GitHub review/CODEOWNER/last-push requirements are independently enforced. Never relax valuable-repository protection or manufacture a reviewer to complete a live gate. If an actual account sign-in or independent reviewer is unavailable, record that exact acceptance as blocked and complete independent validation/deployment; do not publish a verified full release.

The operator may explicitly set `ACCEPTANCE_USER_PER_DAY` (1–1000, empty by default) only alongside both exact disposable acceptance installation/repository IDs. This is trusted operator configuration for admission, not authorization or a caller input. It changes only that tenant’s per-user rolling request budget, retains every counter and all other limits, and reports the effective limit on rejection. Snapshot policy remains the protected default-branch policy for publication/merge checks. Clear the override after the reviewed repository quota is in place. No GitHub protection or AI approval is bypassed.

Before a future immutable runner upgrade, close the deployment merge gate through a reviewed configuration change, deploy and drain/reconcile outstanding merge intents. The pin preparation script requires this maintenance state. Coordinate the one new immutable pin across the Worker and callers, validate the cutover, then restore deployment authorization. Never accept multiple pins to hide a mismatch.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codexbot",
"version": "0.1.0",
"version": "0.1.0-beta.1",
"private": true,
"description": "Self-hostable GitHub App for isolated Codex pull request reviews",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/worker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async function route(request: Request, env: Env): Promise<Response> {
requireCondition(publicPage || url.origin === canonical, 'non_canonical_backend_origin', 421);
const origin = request.headers.get('origin');
requireCondition(!origin || origin === canonical, 'cross_origin_request_denied', 403);
if (url.pathname === '/health' && request.method === 'GET') return Response.json({ status: 'ok', version: '0.1.0' });
if (url.pathname === '/health' && request.method === 'GET') return Response.json({ status: 'ok', version: '0.1.0-beta.1' });
if (url.pathname === '/' && request.method === 'GET') return onboarding(env);
const web = await webRoute(request, env); if (web) return web;
if (url.pathname === '/v1/workload/check' && request.method === 'POST') {
Expand Down
2 changes: 1 addition & 1 deletion tests/backend.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ await test('hosted config, manifest and generated callers agree on Workers.dev w
assert.equal(DEFAULT_BACKEND, 'https://codexbot.appsolves.workers.dev');
const config = JSON.parse(await readFile('wrangler.jsonc', 'utf8'));
assert.equal(config.name, 'codexbot'); assert.equal(config.workers_dev, true); assert.equal(config.preview_urls, false);
assert.equal(config.vars.PUBLIC_URL, DEFAULT_BACKEND); assert.equal(config.vars.MERGE_DEPLOYMENT_AUTHORIZED, 'false');
assert.equal(config.vars.PUBLIC_URL, DEFAULT_BACKEND); assert.equal(config.vars.MERGE_DEPLOYMENT_AUTHORIZED, 'true');
assert.equal(config.vars.TRUSTED_WORKFLOW, 'AppSolves/codexbot/.github/workflows/review.yml@f0086735a6dc62130ffa8aed9828cc9768b9da1e');
assert.equal(config.vars.WEB_ENABLED,'false');assert.equal(config.vars.OPENAI_HOSTED_INFERENCE_AUTHORIZED,'false');
assert.equal(config.vars.ACCEPTANCE_USER_PER_DAY,'');assert.equal(config.vars.MERGE_ACCEPTANCE_REPOSITORY_ID,'');assert.equal(config.vars.MERGE_ACCEPTANCE_INSTALLATION_ID,'');
Expand Down
5 changes: 4 additions & 1 deletion tests/pin-upgrade.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { pinUpgrade } from '../scripts/prepare-pin-upgrade.mjs';
await test('coordinated pin preparation changes only immutable SHA references and rejects weakened secret guards',async()=>{
const config=await readFile('wrangler.jsonc','utf8'), backend=await readFile('tests/backend.test.ts','utf8'), source='AppSolves/codexbot', old=JSON.parse(config).vars.TRUSTED_WORKFLOW.split('@').at(-1), next='f'.repeat(40);
const deployed=JSON.parse(await readFile('wrangler.jsonc','utf8'));
const active=JSON.stringify({...deployed,vars:{...deployed.vars,MERGE_DEPLOYMENT_AUTHORIZED:'true'}});
const config=JSON.stringify({...deployed,vars:{...deployed.vars,MERGE_DEPLOYMENT_AUTHORIZED:'false'}}), backend=await readFile('tests/backend.test.ts','utf8'), source='AppSolves/codexbot', old=JSON.parse(config).vars.TRUSTED_WORKFLOW.split('@').at(-1), next='f'.repeat(40);
const caller=`jobs:\n credential-scope:\n steps:\n - env:\n CODEXBOT_SHARED_CREDENTIAL_PRESENT: "\${{ secrets.CODEXBOT_VAULT_KEY != '' || secrets.CODEXBOT_API_KEY != '' }}"\n run: process.exitCode = 1\n review:\n needs: [credential-scope]\n uses: ${source}/.github/workflows/review.yml@${old}\n secrets:\n CODEXBOT_VAULT_KEY: \${{ secrets.CODEXBOT_VAULT_KEY }}\n CODEXBOT_API_KEY: \${{ secrets.CODEXBOT_API_KEY }}\n`;
assert.throws(()=>pinUpgrade(source,next,active,backend,caller),'Live merging must be quiesced before a pin change');
const updated=pinUpgrade(source,next,config,backend,caller);
assert.equal(updated.config.replaceAll(next,old),config); assert.equal(updated.test.replaceAll(next,old),backend); assert.equal(updated.caller.replaceAll(next,old),caller);
assert.throws(()=>pinUpgrade(source,'main',config,backend,caller));
Expand Down
2 changes: 2 additions & 0 deletions tests/worker.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { readFile } from 'node:fs/promises';
import { test, mock } from 'node:test';
import assert from 'node:assert/strict';
import { createHmac } from 'node:crypto';
Expand Down Expand Up @@ -45,6 +46,7 @@ await test('retained aliases expose only public pages; privileged routes never r
assert.equal(f.calls.length, 0);
for (const path of ['/', '/health']) {
const response = await worker.fetch(new Request(`https://retired.invalid${path}`), env); assert.equal(response.status, 200);
if (path === '/health') assert.deepEqual(await response.json(),{status:'ok',version:JSON.parse(await readFile('package.json','utf8')).version});
if (path === '/') {
const page = await response.text(); assert.ok(page.includes('CLI setup instructions'));
assert.ok(page.includes(`<link rel="canonical" href="${DEFAULT_BACKEND}/">`)); assert.ok(!page.includes('WORKER_URL'));
Expand Down
2 changes: 1 addition & 1 deletion wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"GITHUB_APP_SLUG": "codexbot-review",
"TRUSTED_WORKFLOW": "AppSolves/codexbot/.github/workflows/review.yml@f0086735a6dc62130ffa8aed9828cc9768b9da1e",
"CHATGPT_DEPLOYMENT_AUTHORIZED": "true",
"MERGE_DEPLOYMENT_AUTHORIZED": "false",
"MERGE_DEPLOYMENT_AUTHORIZED": "true",
"MERGE_ACCEPTANCE_REPOSITORY_ID": "",
"MERGE_ACCEPTANCE_INSTALLATION_ID": "",
"ACCEPTANCE_USER_PER_DAY": "",
Expand Down