Skip to content
Back to skills

Codex Upstream Alignment

ASecurity

Force-sync the local openai/codex reference checkout from its authoritative remote, analyze upstream changes, and determine or implement what aisub2api must follow across endpoints, wire protocols, models, tools, auth, and streaming behavior. Use when updating `/home/wayne/source/open/codex`, comparing Codex revisions, or planning aisub2api alignment from a Codex delta; do not use for generic API compatibility work without an upstream Codex change.

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 5, 2026
ai-agentsgobashgitapibackenddocumentation

Works with

  • terminal
  • cli
  • api

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned November 5, 2026

npx -y skills add MorseWayne/aisub2api --skill codex-upstream-alignment --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Codex Upstream Alignment?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Codex Upstream Alignment
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/morsewayne-codex-upstream-alignment/badge)](https://www.skillsdirectory.com/skills/morsewayne-codex-upstream-alignment)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: codex-upstream-alignment
description: Force-sync the local openai/codex reference checkout from its authoritative remote, analyze upstream changes, and determine or implement what aisub2api must follow across endpoints, wire protocols, models, tools, auth, and streaming behavior. Use when updating `/home/wayne/source/open/codex`, comparing Codex revisions, or planning aisub2api alignment from a Codex delta; do not use for generic API compatibility work without an upstream Codex change.
---

# Codex Upstream Alignment

Synchronize openai/codex with the remote as the source of truth, reduce its changes to the subset relevant to aisub2api, and produce an evidence-backed follow-up plan or implementation.

## Repositories and Baseline

- Upstream checkout: `/home/wayne/source/open/codex`.
- Target repository: `/home/wayne/source/open/aisub2api`.
- Read [references/upstream-baseline.md](references/upstream-baseline.md) before computing the upstream range.
- If the requested paths differ or do not exist, discover the actual checkouts before proceeding.

The baseline means “last Codex revision whose relevant behavior was reviewed,” not merely “last fetched revision.” Update it only after the analysis is complete and any requested alignment has been verified.

## 1. Force-Synchronize Codex from the Remote

Treat the Codex checkout as an upstream reference copy. A request to synchronize it authorizes replacing local tracked changes and local-only commits on the synchronized branch with the selected remote revision, including changes to `AGENTS.md`. Do not stop or ask again because paths overlap, the checkout is dirty, or the branch has diverged. Do not stash or merge local changes back afterward.

When the user asks to update or sync Codex, or invokes this skill to start the alignment workflow:

1. Read the upstream repository's `AGENTS.md` and relevant nested instructions.
2. Record the current branch, `HEAD`, tracking branch, remotes, and `git status --short`.
3. Use the explicitly requested remote branch, otherwise the configured tracking branch (default `origin/main`). Fetch that remote and resolve the fetched branch to an exact commit. If fetching fails or the target cannot be resolved, stop synchronization rather than resetting to a stale or guessed ref.
4. Confirm the command targets the Codex checkout, then run `git reset --hard <fetched_sha>` to replace the index, tracked files, and current branch tip with that revision.
5. Remove untracked files and directories in this reference checkout with `git clean -fd`. Leave ignored build caches alone; removing ignored files requires an explicit request.
6. Verify `HEAD` equals the fetched commit and `git status --short` is clean. Read any changed upstream instructions before continuing the review.

This replacement policy applies only to the identified Codex reference checkout. Preserve local work in aisub2api and other repositories. Analysis-only requests that explicitly exclude synchronization must not reset or clean the checkout. Tool or filesystem permission requirements still apply; this policy removes the skill's extra confirmation gate.

Record `before_sha`, `after_sha`, the fetched target, and the local changes replaced. Keep the synchronization revision separate from the reviewed baseline and record the exact analyzed range. Do not treat a successful fetch as a completed working-tree update.

## 2. Analyze the Upstream Delta

Start from the recorded baseline, not from an arbitrary release date. Use commit history and file-level diff statistics to narrow the range before reading individual implementations.

Prioritize changes that can alter aisub2api's observable contract:

- Responses, compact, models, Realtime/WebSocket, and other endpoint request builders.
- Request fields, headers, query parameters, content encoding, authentication, and routing metadata.
- Input/output item variants, tools, Structured Outputs, compaction, continuation, and state handling.
- SSE/WebSocket lifecycle events, response headers, usage accounting, terminal states, and error mapping.
- Model catalog fields, feature flags, context limits, reasoning levels, service tiers, and capability gates.
- Retry, timeout, fallback, caching, and connection reuse semantics.

Relevant upstream entry points commonly include `codex-rs/codex-api`, `codex-rs/core`, `codex-rs/protocol`, `codex-rs/models-manager`, and transport/client crates. Search the actual changed tree rather than assuming these paths remain stable.

Do not propose proxy work for UI-only, sandbox-only, local persistence, or app-server changes unless they modify the wire behavior aisub2api consumes or exposes.

## 3. Map Each Change to aisub2api

Use CodeGraph first when available for unfamiliar request and response flows. Trace from the downstream handler through model resolution and provider selection to the upstream request, then back through event decoding and downstream encoding.

Classify each relevant upstream change as:

- **Already aligned**: show the proxy symbols or tests that cover it.
- **Gap**: identify the exact request, response, capability, or operational mismatch.
- **Not applicable**: explain why Codex behavior does not belong in this proxy.
- **Needs live verification**: static code does not establish a private backend contract.

Keep three contracts distinct: public OpenAI behavior, aisub2api's intentionally exposed subset, and provider-specific behavior such as the ChatGPT/Codex backend. A model appearing in `/v1/models` proves visibility, not full endpoint compatibility.

Present the result as a compact matrix containing upstream commit/file evidence, wire-level change, current proxy behavior, status, recommended action, compatibility impact, and verification needed. Mark inference separately from observed behavior.

## 4. Design and Implement the Follow-up

When implementation is requested:

- Put proxy-wide validation in the downstream handler and provider-only adaptation in the provider adapter.
- Preserve unknown native fields and events unless there is a concrete safety or contract reason to reject them.
- Keep capability declarations synchronized with effective downstream behavior; do not advertise an internal provider path as a native public endpoint.
- Prefer the smallest coherent change that covers request shaping, response/event handling, capabilities, tests, and documentation together.
- If the user explicitly allows breaking changes, prefer one clear endpoint contract over layered legacy fallbacks. Otherwise state compatibility risks before changing public behavior.

If the delta touches Responses, Structured Outputs, ChatGPT request normalization, or `/v1/models` capability declarations, read [references/responses-v4.0.1.md](references/responses-v4.0.1.md) before editing. Treat it as prior evidence to revalidate, not a permanent upstream specification.

## 5. Verify Proportionally

Test the smallest changed layer first, then the full affected flow. For aisub2api release-quality verification, normally run:

```bash
cargo fmt --all -- --check
cargo test --workspace --all-targets
cargo clippy --workspace --all-targets -- -D warnings
git diff --check
```

Use a real end-to-end provider check only when requested or when private upstream behavior cannot be established statically. Obtain authorization for network calls, use an isolated temporary configuration and port, never print credentials, and clean up copied credentials and response artifacts.

Update `references/upstream-baseline.md` with the reviewed Codex commit, date, proxy version or commit, reviewed scope, and remaining known gaps after verification succeeds. Do not advance the baseline over unreviewed relevant changes.

## Mutation and Release Boundaries

Syncing Codex authorizes the local replacement described in section 1, not authoring upstream changes or pushing to its remote. Analysis does not authorize editing aisub2api runtime code unless the user asks for implementation; maintain the review report and baseline as part of the alignment workflow.

Do not commit, push, tag, publish, restart services, or monitor CI unless requested. When release work is requested, preserve unrelated files, stage only the scoped changes, verify commit and tag identity after pushing, and stop without checking CI when the user says not to track it.

Files in this skill

  • SKILL.md8.2 KB
  • agents/openai.yaml234 B
  • references/responses-v4.0.1.md3 KB
  • references/upstream-baseline.md4.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.