Skip to content

Commit 5fe8afb

Browse files
committed
merge(dev): sync #751 onto tip; keep DeepInfra + Hyperbolic
Resolve registry/docs conflicts by retaining both presets and bumping published totals to 62 (51 key).
2 parents dbf4bd1 + 89cb08f commit 5fe8afb

1,975 files changed

Lines changed: 220091 additions & 3125 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/scripts/enforce-pr-target.test.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ describe("enforce-pr-target workflow", () => {
6565
assert.match(workflow, /stackedBase/);
6666
assert.match(workflow, /github\.rest\.pulls\.list/);
6767
assert.match(workflow, /treating as stacked/);
68+
assert.match(workflow, /other\.base\?\.repo\?\.owner/);
6869
const qualityCall = workflow.match(
6970
/collectPrQualityFailures\(\{([\s\S]*?)\}\);/,
7071
);

.github/workflows/enforce-pr-target.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ jobs:
299299
other =>
300300
other.number !== pull_number &&
301301
other.head?.ref === pr.base.ref &&
302-
(other.head?.repo?.owner?.login ?? owner) === baseOwner &&
303-
(other.head?.repo?.name ?? repo) === baseName
302+
(other.base?.repo?.owner?.login ?? owner) === baseOwner &&
303+
(other.base?.repo?.name ?? repo) === baseName
304304
);
305305
if (stackedBase) {
306306
core.info(

.gitignore

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,19 @@ dist/
44
*.log
55
.DS_Store
66

7-
# Maintainer-only planning notes. `devlog` is a private submodule
8-
# (lidge-jun/opencodex-internal) pinned by gitlink; its contents are never
9-
# tracked here. Commit inside the submodule, then bump the pointer separately.
10-
devlog/
7+
# Maintainer planning notes are TRACKED in this repository (`devlog/`). Security
8+
# material is not: see the "Security working notes" section of AGENTS.md.
9+
#
10+
# These exclusions were previously enforced by devlog's own .gitignore, which stops
11+
# applying now that devlog is not a separate repository. Reference clones are
12+
# third-party source with their own licenses and must never enter this history.
13+
devlog/_chase/_cca/
14+
devlog/_chase/_litellm/
15+
devlog/_fin/opencode-cursor/
16+
devlog/_plan/*/_ref_*/
17+
devlog/**/*-security-redaction/
18+
devlog/**/*_security_findings/
19+
devlog/**/security-advisory-draft*
1120

1221
# Scratch space. Security working notes — unreleased findings, draft advisories,
1322
# exploit reasoning, pre-disclosure patch plans — belong here or in a

.gitmodules

Lines changed: 0 additions & 6 deletions
This file was deleted.

AGENTS.md

Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,42 +22,39 @@ Bun-native TypeScript with no separate server compile step.
2222
changing shared subsystems.
2323
- `scripts/` — release and maintenance tooling; `scripts/release.ts` is the
2424
release authority.
25-
- `devlog/` — maintainer-only planning and investigation notes. This is a
26-
**private submodule** (`lidge-jun/opencodex-internal`), not a directory of
27-
this repository. See "The `devlog` submodule" below.
25+
- `devlog/` — planning and investigation notes, tracked in this repository. See
26+
"The `devlog` directory" below for what may and may not go there.
2827

2928
Read the nearest nested `AGENTS.md` before changing files in a scoped
3029
directory (`src/`, `gui/`, `docs-site/`, `scripts/`, `.github/`).
3130

32-
## The `devlog` submodule
33-
34-
Planning notes, triage matrices, and investigation artifacts live in the private
35-
`lidge-jun/opencodex-internal` repository, wired in as the `devlog` submodule.
36-
They quote live infrastructure state, provider behaviour, unfixed defects, and
37-
internal triage reasoning, so a public clone should carry the runtime and its
38-
docs and nothing else.
39-
40-
The pointer is deliberately **loose**, so a missing or stale `devlog` can never
41-
fail a check:
42-
43-
- `.gitmodules` declares `ignore = dirty`, `update = none`, and `shallow = true`.
44-
A dirty or moved submodule working tree does not show up in `git status` on
45-
the parent, and `git submodule update` will not touch it unless asked
46-
explicitly.
47-
- No workflow checks it out. `actions/checkout` runs without `submodules:`, so
48-
CI clones the public tree only and the private URL is never resolved.
49-
- Nothing in the build, test, typecheck, or privacy-scan path reads from
50-
`devlog/`. Contributors without access see an empty directory and every gate
51-
still passes.
52-
- `devlog/` stays listed in `.gitignore` for the working tree; the submodule
53-
gitlink is tracked, its contents are not.
54-
55-
Two rules keep it that way. Never commit anything under `devlog/` to *this*
56-
repository — commit inside the submodule, then update the pointer here as a
57-
separate commit. And never nest a git repository inside the submodule: a
58-
`160000` gitlink in a tree that CI does not initialize breaks
59-
`actions/checkout` for every contributor, which is exactly what happened before
60-
this split.
31+
## The `devlog` directory
32+
33+
Planning notes, triage matrices, and investigation artifacts live in `devlog/`,
34+
tracked like any other documentation. There is no submodule and no private
35+
mirror. It was a private submodule until the pointer churn outgrew its value:
36+
1723 commits touched the gitlink, and `dev`, `preview`, and `main` each carried a
37+
different pointer, so every branch move and promotion dragged a diff.
38+
39+
- `devlog/_plan/` — units still open, one directory per unit, decade-numbered
40+
docs.
41+
- `devlog/_fin/` — closed units, moved here once a terminal outcome is recorded.
42+
A `_fin` unit is a record of work already visible in public git history.
43+
- `devlog/_chase/` — external reference material for parity comparisons.
44+
Reference *clones* are gitignored: they are third-party source carrying their
45+
own licenses and have no business in this repository's history.
46+
47+
Nothing in the build, typecheck, or test path reads from `devlog/`, so a
48+
contributor who ignores it entirely still passes every gate. `privacy:scan` does
49+
read it — that is deliberate, and it is what makes a public devlog safe rather
50+
than merely visible.
51+
52+
Two mechanical guards in `tests/repo-hygiene.test.ts` back this up: no `160000`
53+
gitlink may be tracked anywhere, and neither the vendored reference clones nor
54+
the security triage excised before publication may reappear in the index. Both
55+
were driven red once to prove they are not vacuous. The gitlink assertion exists
56+
because a gitlink in a tree CI does not initialize breaks `actions/checkout` for
57+
every contributor, which happened twice.
6158

6259
## Security working notes
6360

@@ -67,9 +64,23 @@ or bypass reasoning, reproduction steps for an unfixed defect, and
6764
pre-disclosure patch plans.
6865

6966
Use `.tmp/` in the working tree (already gitignored) or a `mktemp -d` path.
70-
`devlog/` is **not** an acceptable location, and neither is a private
71-
repository: both get cloned across machines and CI, both outlive the embargo,
72-
and neither history is practical to purge afterwards.
67+
`devlog/` is **not** an acceptable location — it is a public directory in a
68+
public repository, so anything committed there is disclosed the moment it is
69+
pushed, and the history is not practical to purge afterwards. A private
70+
repository is not acceptable either: it gets cloned across machines and CI and
71+
outlives the embargo.
72+
73+
**This binds maintainers exactly as it binds contributors and agents.** The rule
74+
has been violated by maintainer-authored triage before: two units of open
75+
security review accumulated under `devlog/_plan/` and had to be excised before
76+
this directory could be published. Seniority is not an exemption, and "it is
77+
only in the private half" is no longer a thing that exists.
78+
79+
The test to apply before writing a security note into `devlog/`: **is there
80+
already a public diff that reveals this weakness?** If the fix has shipped, the
81+
writeup discloses nothing new and belongs in `_fin/`. If it has not, the note is
82+
pre-disclosure material and goes to scratch. That distinction is why closed
83+
hardening records stay in the tree while open triage does not.
7384

7485
Only the published outcome reaches a repository — the fix itself, its
7586
regression test, the release note, the advisory once it is public. Draft the

bin/ocx.mjs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
*/
1111
import { spawn, spawnSync } from "node:child_process";
1212
import { createRequire } from "node:module";
13-
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
13+
import { existsSync, readFileSync, readdirSync } from "node:fs";
1414
import { homedir } from "node:os";
1515
import { dirname, join, resolve } from "node:path";
1616
import { fileURLToPath } from "node:url";
17+
import { isRealBunBinary } from "../src/lib/bun-binary-validator.mjs";
1718
import { npmInvocation } from "../src/update/npm-invocation.mjs";
1819
import { handoffWindowsTrayForUpdate, planWindowsTrayUpdate } from "../src/update/tray-update-plan.mjs";
1920

@@ -287,18 +288,14 @@ function bunBinDir() {
287288
return dirname(require.resolve("bun/package.json"));
288289
}
289290

290-
// The `bun` package ships a tiny ASCII placeholder at bin/bun.exe until its
291-
// postinstall downloads the real ~60MB binary. --ignore-scripts / pnpm leave
292-
// the ~450-byte stub in place, which is NOT executable (ENOEXEC). A size gate
293-
// cleanly distinguishes the stub from a real binary on every platform.
294-
const REAL_BUN_MIN_BYTES = 1_000_000;
291+
const BUN_OVERRIDE_ENV = "OPENCODEX_BUN_PATH";
295292

296293
function findBunBinary(bunDir) {
297294
// The npm `bun` package ships the binary as bin/bun.exe on every platform;
298295
// probe bin/bun too for forward compatibility.
299296
for (const name of ["bun.exe", "bun"]) {
300297
const p = join(bunDir, "bin", name);
301-
if (existsSync(p) && statSync(p).size >= REAL_BUN_MIN_BYTES) return p;
298+
if (isRealBunBinary(p)) return p;
302299
}
303300
return null;
304301
}
@@ -317,6 +314,17 @@ function fail(msg) {
317314
}
318315

319316
function resolveBun() {
317+
// Keep direct npm-launcher starts aligned with durable service/shim installs:
318+
// a valid explicit runtime must win even when the bundled dependency exists.
319+
const override = process.env[BUN_OVERRIDE_ENV]?.trim();
320+
if (override) {
321+
const overridePath = resolve(override);
322+
if (isRealBunBinary(overridePath)) return overridePath;
323+
console.error(
324+
`opencodex: ${BUN_OVERRIDE_ENV} is missing, unreadable, or not a complete Bun binary; falling back to the bundled runtime.`,
325+
);
326+
}
327+
320328
let bunDir;
321329
try {
322330
bunDir = bunBinDir();

bunfig.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@
88
# The npm script already uses `bun test ./tests/`; this makes a bare `bun test` behave the same.
99
[test]
1010
root = "tests"
11+
# Sandboxes HOME/OPENCODEX_HOME/CODEX_HOME and arms the real-home write guard for EVERY
12+
# invocation, including a bare `bun test <file>` that skips `scripts/test.ts`. A test
13+
# once overwrote a real user config through that unwrapped path; see
14+
# devlog/_plan/260730_codex_rs_upstream_v2_live_handoff/070.
15+
preload = ["./tests/preload.ts"]

devlog

Lines changed: 0 additions & 1 deletion
This file was deleted.

devlog/.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Reference repos are cloned for analysis, never tracked. A nested .git becomes a
2+
# 160000 gitlink in the parent index and breaks actions/checkout downstream.
3+
_chase/_cca/
4+
_chase/_litellm/
5+
_fin/opencode-cursor/
6+
_plan/*/_ref_*/
7+
8+
# Security working notes never belong in a repository, not even a private one.
9+
# Use .tmp/ in the public tree or a mktemp -d path instead. See README.md.
10+
*-security-redaction/
11+
*_security_findings/
12+
**/security-advisory-draft*
13+
14+
.DS_Store

devlog/.patchprobe

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
probe

0 commit comments

Comments
 (0)