Migration 0003 adds leased progress-comment recovery and sanitized failure/run metadata without changing existing sessions. See the review upgrade/recovery guide. A separate two-minute trigger guarantees one due progress reconciliation without sharing publication subrequest limits; idle minute recovery can also handle progress. Administrative --retry-progress only restarts bounded reconciliation; it never resets an ambiguous creation or recreates a deleted comment. Workflow failures before broker admission are finalized from independently verified App-run metadata.
- Pause webhook dispatch. Cancel/drain old Actions runs and inspect/cancel any existing App-owned native auto-merge in GitHub. Preserve a private D1 backup; it contains ciphertext and private review/prompt metadata.
- Apply migrations in filename order with pinned Wrangler:
node node_modules/wrangler/bin/wrangler.js d1 migrations apply codexbot --remote. D1 applies each migration transactionally and records it once. Never re-execute individual ALTER statements manually. Fresh local/runtime tests apply all production migrations. - Migration 0002 adds receipt/outbox and publication state, quotas and a session table keyed by installation/repository/actor. It invalidates legacy in-flight requests. The old encrypted session table is quarantined and purged at the first cleanup. Every ChatGPT user must reconnect; the Worker cannot safely re-encrypt old AAD without their key. Reuse the local issued client/host profile, not a shared token. Revoke superseded sessions in ChatGPT settings if needed. Existing API-key secrets remain in their old GitHub Environments but are never reused automatically. All users, including API-key users, must explicitly provision the new installation-scoped Environment; then remove/revoke obsolete secrets.
- Deploy the reviewed new Worker and select a real immutable source commit. Update each caller workflow through a reviewed PR: add required string inputs
dispatch_attemptandinstallation_id, pass installation_id to the reusable workflow, and run-nameCodexBot ${{ inputs.request_id }} ${{ inputs.dispatch_attempt }}. Keep the new reusable workflow pinned and match backend TRUSTED_WORKFLOW. Old dispatch inputs/workflow names intentionally cannot acquire credentials under the new attempt-binding protocol. - Keep CHATGPT_DEPLOYMENT_AUTHORIZED and MERGE_DEPLOYMENT_AUTHORIZED false until their separate external gates pass. Reconnect using the CLI's capability/installation preflight. Private Free repositories cannot store credentials through this topology. Protect the default branch first; preserve Environment reviewers and set a default-branch-only custom deployment policy.
- Complete advisory acceptance in a disposable repository before re-enabling normal approvals. Automated merge requires a protected branch and the selected merge mode: zero independent humans in compatible autonomous repositories, or the configured/GitHub-required human approvals. For pending CI, configure the App-bound required guard and explicitly consent to Checks write/Administration read. Do not grant bypass rights.
Receipts: pending → processing (lease) → done, retryable or failed. D1 receipt identity and signed-body digest are independent unique constraints. Acknowledging a duplicate does not declare dispatch complete; cron continues outstanding work. The signed payload is bounded to 80 KB and deleted on successful processing. A larger webhook is rejected before receipt insertion. Requests and receipts are retained seven days; active review requests expire at their accepted timestamp plus the selected review timeout and one hour for queue/setup/publication. Session leases and concurrency accounting use that same deadline. Merge intents retain a separate one-hour deadline; a longer review does not extend merge authority.
Dispatch persists an attempt UUID before its POST. A lost response is reconciled from the exact App-authored run name, SHA, repository and event, not ordering. Retry delay is bounded exponential backoff plus cryptographic jitter (under 305 seconds). At most five automatic attempts occur. Negative run listings are allowed to converge for two minutes before a bounded resend of the same attempt. If two workflows were accepted, the request's run-ID CAS authorizes only one; the other cannot get a read token or encrypted session. There is no claim of exactly-once workflow creation.
Publishing: reviewed → publishing (two-minute lease) → published, retryable or terminal failed. Pending GitHub reviews provide a stable reconciliation resource, including lost creation/submission responses. Review submission and merge disposition have separate checkpoints. The cron resumes abandoned publication after its lease/backoff. Five failed attempts exhaust automatic recovery. Identical result resubmission is safe; replacement output is denied. Same-run prepare has one bounded retry for a lost response; other runs/Actions review reruns cannot borrow it.
Queued merge intent is reconciled until its one-hour deadline. The App's required guard remains pending until live CI, head/base, identity, connection, policy and human approvals are checked again. Native intent is disabled before guard release; the final expected-head merge repeats checks. Known failed checks, revoked credentials/authorization, stale commits, blocking findings and expiry invalidate owned intent. Expired queued records are preserved until cancellation is reconciled. A revoked installation can prevent API cleanup; the pending guard still prevents merge and the operator must clear the stale intent in GitHub. Merge queues are manual-only.
Cron runs every minute and handles at most one dispatch or publication/merge recovery operation plus indexed cleanup. This is deliberately modest shared-backend throughput; measure real CPU/subrequest/D1 use before claiming a Free-plan production workload. Configure Paid or reduce tenant quotas when required. Session ciphertext remains until disconnect/uninstall; backups have independent retention.
Build first and authenticate gh with narrowly scoped repository-admin access. The API checks live admin status, active installation and repository identity; it accepts no browser cookies/CORS. It returns IDs/phases/counts, never ciphertext, results, prompts or tokens.
npm run build
npm run ops -- --repository OWNER/REPO --backend https://YOUR-WORKER
npm run ops -- --repository OWNER/REPO --backend https://YOUR-WORKER --retry DELIVERY_OR_REQUEST_ID
npm run ops -- --repository OWNER/REPO --backend https://YOUR-WORKER --cancel REQUEST_IDAn explicit operator retry is permitted twice per item and logged with numeric actor/repository/installation IDs. It does not bypass authorization, SHA validation, publication markers, age or workload identity. Old/expired requests require a new comment; --rerun is bounded separately. Never manually reset a run binding, rotate a session version backwards, force-push a setup branch or delete a published review to hide an ambiguous effect.
Inspect GitHub's actual App-owned pending/submitted review and commit, workflow run and auto-merge owner when diagnosing failures. Do not dump raw provider errors, source, envelopes, token bodies or Authorization headers. OAuth refresh with uncertain provider/persistence outcome requires reconnect; reusing an old refresh token is unsafe. Disconnect/revoke in ChatGPT settings if remote revocation cannot be confirmed.
Pause dispatch and disable merge configuration/backend gate, cancel GitHub-owned auto-merge and hold the required guard, revoke affected credentials, rotate App/webhook secrets if compromised, and preserve privacy-safe metadata privately. Merely disabling the Worker does not cancel an already-enabled native auto-merge; clear it in GitHub. Remove sensitive logs/artifacts and investigate prior exposure without assuming deletion revokes credentials.
Cancellation atomically blocks new publication claims before remote cleanup. It refuses an active publication lease, is installation/repository scoped, discards only the matching App-owned PENDING review, cancels owned merge intent and releases the session. Submitted reviews remain audit evidence. A cancelled/cancelling request cannot be revived through retry; correct cleanup failures by repeating cancellation, then use a new authorized comment if needed.
A newer authorized same-PR rereview supersedes an older queued merge at the last durable write authorization. Expired-intent cleanup uses its own bounded lease/backoff; an unavailable old installation cannot monopolize recovery forever. After five failed cancellation attempts, the guard stays held and an administrator must clear the intent in GitHub or repeat explicit cancellation with restored access.
Migration 0004 and the browser runbook add encrypted web transactions, sessions, hosted connection journals and repository operation leases. Apply the additive migration before deploying the new Worker; old backend code remains compatible with the extra tables. Never delete or overwrite existing CLI sessions as a migration shortcut. Inspect only fixed state/IDs, never encrypted-payload dumps in public logs.
A connection stuck in pending after an ambiguous GitHub secret write is resumed through the owning administrator's repository dashboard. It uses the same journal and vault key. A refreshing/reconnect-required state is not a successful rotation; reconnect through a fresh validated OAuth flow. Leases use atomic owner-checked acquisition/heartbeat and ownership-aware release; do not manually reset a lease while its holder may still run. A lost owner cannot publish a new encrypted session or release a successor. Quiesce browser operations and keep master-key backups before any planned key rotation; production secret changes and provider revocation remain explicit operator actions.
Migration 0005_review_admission_feedback.sql must precede the Worker deployment. It adds a tenant-scoped outbox; existing sessions, quotas, requests and progress comments are unchanged. Do not manually apply its SQL or reset quota records. Wrangler applies only pending official migrations.
Admission and its precise rejection outcome are persisted in one D1 batch transaction. Outcomes distinguish rerun/user/repository/installation sliding quotas, duplicate context, cooldown and active concurrency. The existing guarded admission predicates are unchanged. Retry timestamps use the actual persisted timestamps: the quota-th newest request expires after 24 hours (including a subsequently lowered limit), cooldown uses the latest matching request, and unknown completion/duplicate-context times have no ETA. The message describes when that particular limit frees a slot; other admission checks still apply.
Only fresh recognized manual commands on verified PRs from authenticated, authorized human senders create public feedback. Sender IDs are checked against live GitHub permission responses. Messages contain fixed prose and validated counts/times, never the command text, hidden instructions, provider text or raw exception codes. Automatic events produce no rejection comments. Feedback never dispatches a workflow. Delivery/command identities, leases and App-owned markers prevent redelivery/parallel/cron comment spam; no user mention is inserted into feedback.
Deterministic denials complete the delivery; the separate outbox retries temporary GitHub failures with jitter/backoff, up to five attempts. The two-minute recovery invocation handles at most one due rejection and one progress update, so neither queue starves the other. Deleted/revoked installation state is checked live, and current actor authorization is required before publishing.
GitHub issue-comment POST has no idempotency key. Before POST, the outbox durably enters creating. A lost response or 5xx is reconciled by exact marker, numeric App ID, bot identity and PR issue URL, scanning at most three 100-comment pages since acceptance. It never blindly repeats an ambiguous POST. A definitive no-write 429 can retry. If a crash occurred before POST, a comment was deleted, or an accepted comment cannot be found within the bounded scan, the record becomes failed for operator inspection instead of risking duplicate notifications. This is an explicit API limitation, not a guarantee of exactly-once delivery under every failure.
Inspect safe state with SELECT id,outcome,phase,attempts,comment_id,retry_at FROM review_rejections; do not select identity/payload/session data into logs. After an ambiguous terminal failure, inspect App-owned comments before any manual response; do not reset creating to pending. Recovery of an already-recorded denial never re-enters admission. Old deliveries without a durable outcome still obey the original freshness checks and must not be revived to start inference.
After normal protected source merge, run scripts/prepare-pin-upgrade.mjs first with --check-only, then without it, using the actual source PR number. Merge both reviewed pin PRs, apply migration 0005, and deploy the new Worker with existing gates preserved. Verify version details, pins, /health, a fresh authorized exhausted-quota comment and the terminal delivery/outbox state. No paid inference or quota reset is needed for this test.
Apply additive migration 0006 before deploying the owner-consent code. CLI session encryption/AAD and existing owner connections remain unchanged. New unattended assignment requires a fresh explicit --allow-automatic-reviews consent for the owning repository and trusted credentials.automatic_reviewer; no copied credentials or secret export is supported. A reconnect clears prior consent, refresh preserves it, and each new consent generation invalidates old automatic intents.
While MERGE_DEPLOYMENT_AUTHORIZED=false, the operator can temporarily configure both MERGE_ACCEPTANCE_REPOSITORY_ID and MERGE_ACCEPTANCE_INSTALLATION_ID for the one disposable acceptance repository. Empty/missing or mismatched scope remains closed. The caller cannot supply this scope. All normal review, native approval, owner consent, merge authorization, OIDC, GitHub rules, exact-head and CI checks still apply. This permits a real happy-path test before globally authorizing merging. Clear the temporary scope after acceptance; enable the global gate only after the required live evidence passes. Keep browser and hosted website inference flags false for the CLI release.
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.