diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ad3573..e73e2bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/README.md b/README.md index 465e22f..ed0cf5c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs/operations.md b/docs/operations.md index 2689354..b44170b 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -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. diff --git a/package-lock.json b/package-lock.json index d53086a..793a938 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "codexbot", - "version": "0.1.0", + "version": "0.1.0-beta.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "codexbot", - "version": "0.1.0", + "version": "0.1.0-beta.1", "license": "Apache-2.0", "dependencies": { "@octokit/rest": "22.0.1", diff --git a/package.json b/package.json index 0c26bb1..27ca7a1 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/worker/index.ts b/src/worker/index.ts index f4449eb..545cc1b 100644 --- a/src/worker/index.ts +++ b/src/worker/index.ts @@ -70,7 +70,7 @@ async function route(request: Request, env: Env): Promise { 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') { diff --git a/tests/backend.test.ts b/tests/backend.test.ts index 32c29f6..39197b0 100644 --- a/tests/backend.test.ts +++ b/tests/backend.test.ts @@ -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,''); diff --git a/tests/pin-upgrade.test.mjs b/tests/pin-upgrade.test.mjs index 411b2ca..16d970d 100644 --- a/tests/pin-upgrade.test.mjs +++ b/tests/pin-upgrade.test.mjs @@ -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)); diff --git a/tests/worker.test.ts b/tests/worker.test.ts index 0afe073..527faa3 100644 --- a/tests/worker.test.ts +++ b/tests/worker.test.ts @@ -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'; @@ -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(``)); assert.ok(!page.includes('WORKER_URL')); diff --git a/wrangler.jsonc b/wrangler.jsonc index 9a21b4e..46e546e 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -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": "",