← Commit history
Publish 0.1.30
5 files changed
+131−4
README.md+2@@ -112,6 +112,8 @@ See [installation, extension updates, and uninstall behavior](docs/RELOAD-INTEGR Version 0.1.28 keeps Codex working when OpenAI ships a build that does not load. Builds listed in `runtime/bad-versions.json` (26.1021.22027 and its 26.51021.22027 pre-release: the UI never loads and freezes the editor, [openai/codex#56780](https://github.com/openai/codex/issues/56780)) are swapped back to the last good build once no Codex turn is running (0.1.29: if the editor loads a listed build anyway, as a manual update does, its panel shows a short notice instead of OpenAI's UI, so it can never freeze the editor), the user sees a notice, and the hold lifts by itself when Open VSX ships a build that is not listed. The list is re-read from this page hourly, so adding or clearing a build needs no release. A Codex update that changes the backend's startup options now replaces an idle backend instead of refusing every Codex view, and the runtime installs bubblewrap (Codex's Linux sandbox) when sudo needs no password. +Version 0.1.30 brings OpenAI's newest models to the held build. The good build bundles an older Codex engine whose model picker stops at GPT-6 Astra and GPT-5.6, so while the hold lasts the runtime fetches OpenAI's newest stable engine from npm (`@openai/codex`, checked against the registry's sha512, then run once to confirm it starts and reports its version), records it in `~/.local/state/adom/codex-integration/engine.json`, and runs it for the held build from the next editor reload: GPT-6.1 Sol becomes the default, with GPT-6.1 Terra, GPT-6 Sol and GPT-6 Luna alongside. It never swaps the engine under a running turn, rechecks npm every six hours, and drops the engine (back to the build's own) when the hold lifts.+ ### Skip the repeated IDE walkthrough Version 0.1.23 opens new Codex editor tabs directly at the prompt. The default ships through Hydrogen’s existing Codex package dependency; it preserves sign-in and permission prompts. See [diagnosis and verification](docs/CODEX-WALKTHROUGH.md). Already-open walkthrough tabs should be closed and reopened.
package.json+1−1@@ -4,7 +4,7 @@ "type": "app", "title": "Codex", "brief": "Codex in Adom Hydrogen: ecosystem setup, dock dashboard and live engineering demos.",- "version": "0.1.29",+ "version": "0.1.30", "description": "Codex in Adom Hydrogen with reusable CAD routing, electrical review, copper-ablation and narrated video skills, plus verified KiCad and Fusion demo progressions.", "org": "adom", "needs_sudo": false,
page.json+3−2@@ -4,7 +4,7 @@ "type": "app", "title": "Codex", "brief": "Codex in Adom Hydrogen: ecosystem setup, dock dashboard and live engineering demos.",- "version": "0.1.29",+ "version": "0.1.30", "hero": { "type": "image", "path": "screenshots/hero.png"@@ -79,6 +79,7 @@ "runtime/*.py", "runtime/*.cjs", "runtime/*.css",+ "runtime/*.json", "runtime/vendor/*.md", "runtime/vendor/*LICENSE", "runtime/vendor/websockets/*.py",@@ -97,4 +98,4 @@ "videos/04-public-adom-solenoid-full-routing-narrated.mp4", "videos/04-public-adom-solenoid-full-routing.mp4" ]-}+}
runtime/guard.py+105@@ -6,13 +6,23 @@ bad-versions.json (bundled; refreshed hourly from the wiki page so a build can be listed or cleared without a package release), put back the last good build and hold it only while Open VSX's newest build on that channel is still listed. Then release the hold so normal updates resume. Never while a Codex turn runs.++The held build bundles an older engine that does not offer OpenAI's newest models.+While the hold lasts, fetch OpenAI's newest stable engine from npm, check it, and+record it in engine.json; the runtime runs it for the held build from the next+editor reload. Dropped when the hold lifts. """+import base64+import hashlib import json import os+import re from pathlib import Path import shutil import signal import subprocess+import tarfile+import tempfile import time import urllib.request @@ -24,6 +34,9 @@ OPEN_VSX_QUERY = 'https://open-vsx.org/api/-/query?namespaceName=openai&extensio TARGET = 'linux-arm64' if os.uname().machine == 'aarch64' else 'linux-x64' ID = 'openai.chatgpt' REFRESH_S = 3600+ENGINE_URL = 'https://registry.npmjs.org/@openai/codex/' + TARGET+TRIPLE = ('aarch64' if TARGET == 'linux-arm64' else 'x86_64') + '-unknown-linux-musl'+ENGINE_REFRESH_S = 6 * 3600 def fetch_json(url, timeout=15):@@ -36,12 +49,23 @@ def key(version): return tuple(int(p) for p in version.split('.')) +def cli_version(binary):+ """(major, minor, patch) from `codex --version`, or None."""+ try: output = subprocess.run([str(binary), '--version'], capture_output=True, text=True,+ timeout=20, stdin=subprocess.DEVNULL).stdout+ except (OSError, subprocess.SubprocessError): return None+ match = re.search(r'(\d+)\.(\d+)\.(\d+)', output)+ return tuple(map(int, match.groups())) if match else None++ class Guard: def __init__(self, integration): self.home = integration.home self.extensions = integration.extensions self.registry = self.extensions / 'extensions.json' self.path = integration.state / 'guard.json'+ self.engine_path = integration.state / 'engine.json'+ self.engines = self.home / '.local/share/adom/codex-engine' self.write = integration.write_json try: self.state = json.loads(self.path.read_text()) except (OSError, ValueError): self.state = {}@@ -119,6 +143,8 @@ class Guard: if not build: self.state['last_good'] = version if self.state.get('held') == version: self.maybe_release(listing, metadata)+ if self.state.get('held') == version: self.newer_engine(version)+ else: self.drop_engine() self.save() return good = self.state.get('last_good') or listing.get('fallback')@@ -156,3 +182,82 @@ class Guard: self.set_metadata(pinned=False) self.state.pop('held', None) self.notify(f'Codex {newest} is out with the fix; it will install with your next update.', 'info')++ def newer_engine(self, version):+ """Fetch, check and record OpenAI's newest stable engine for the held build."""+ if time.time() - self.state.get('engine_checked', 0) < ENGINE_REFRESH_S: return+ self.state['engine_checked'] = time.time()+ try:+ arch = 'linux-aarch64' if TARGET == 'linux-arm64' else 'linux-x86_64'+ location = (self.installed() or {}).get('location', {}).get('path') \+ or str(self.extensions / f'{ID}-{version}-{TARGET}')+ have = cli_version(Path(location) / 'bin' / arch / 'codex')+ release = fetch_json(ENGINE_URL)+ newest = release['version'].split('-')[0]+ current = self.recorded_engine()+ if not have or key(newest) <= have:+ return self.drop_engine()+ if current.get('version') == newest and current.get('extension') == version: return+ if shutil.disk_usage(self.home).free < 2 * 1024**3:+ raise RuntimeError('less than 2 GB free')+ binary = self.engines / newest / TRIPLE / 'bin' / 'codex'+ if not binary.is_file(): self.download(release, newest)+ if cli_version(binary) != key(newest): raise RuntimeError(f'engine {newest} did not run')+ with tempfile.TemporaryDirectory(prefix='codex-engine-schema-') as temporary:+ subprocess.run([str(binary), 'app-server', 'generate-json-schema', '--experimental',+ '--out', temporary], check=True, capture_output=True, timeout=30,+ stdin=subprocess.DEVNULL)+ self.write(self.engine_path, {'binary': str(binary), 'version': newest, 'extension': version,+ 'bundled': '.'.join(map(str, have)), 'at': time.time()})+ self.state.pop('engine_error', None)+ self.prune_engines(newest)+ self.notify(f'Codex {version} now runs OpenAI\'s newest Codex engine ({newest}), so the newest '+ 'models are in its model picker. Reload the window to use them.', 'info')+ except Exception as error:+ self.state['engine_error'] = str(error)[-300:]+ self.state['engine_checked'] = time.time() - ENGINE_REFRESH_S + REFRESH_S # retry in an hour++ def recorded_engine(self):+ try: return json.loads(self.engine_path.read_text())+ except (OSError, ValueError): return {}++ def download(self, release, version):+ """npm's platform package, checked against the registry's sha512, unpacked whole."""+ dist = release['dist']+ algorithm, expected = dist['integrity'].split('-', 1)+ if algorithm != 'sha512': raise RuntimeError('unexpected integrity ' + algorithm)+ self.engines.mkdir(parents=True, exist_ok=True)+ with tempfile.TemporaryDirectory(prefix='.fetch-', dir=self.engines) as temporary:+ archive = Path(temporary) / 'engine.tgz'+ digest = hashlib.sha512()+ request = urllib.request.Request(dist['tarball'], headers={'User-Agent': 'adom-codex-guard'})+ with urllib.request.urlopen(request, timeout=60) as response, archive.open('wb') as output:+ while chunk := response.read(1 << 20):+ digest.update(chunk)+ output.write(chunk)+ if base64.b64encode(digest.digest()).decode() != expected:+ raise RuntimeError('engine download failed its checksum')+ prefix = f'package/vendor/{TRIPLE}/'+ unpacked = Path(temporary) / 'unpacked'+ with tarfile.open(archive) as bundle:+ members = [m for m in bundle.getmembers() if m.name.startswith(prefix)]+ for member in members: member.name = member.name[len('package/vendor/'):]+ bundle.extractall(unpacked, members=members, filter='data')+ target = self.engines / version+ shutil.rmtree(target, ignore_errors=True)+ unpacked.replace(target)++ def prune_engines(self, keep):+ """Keep the recorded engine and whichever one a running backend still uses."""+ try: running = json.loads((runtime.state_dir() / 'server.json').read_text()).get('binary', '')+ except (OSError, ValueError, RuntimeError): running = ''+ for directory in self.engines.glob('*'):+ if directory.name != keep and not running.startswith(str(directory) + '/'):+ shutil.rmtree(directory, ignore_errors=True)++ def drop_engine(self):+ """No hold, no newer engine: the editor's own build runs its own engine."""+ if not self.engine_path.exists(): return+ self.engine_path.unlink(missing_ok=True)+ self.state.pop('engine_checked', None)+ self.prune_engines(None)
runtime/runtime.py+20−1@@ -20,6 +20,9 @@ from websockets.sync.client import unix_connect from websockets.exceptions import ConnectionClosed +ENGINE = Path.home() / '.local/state/adom/codex-integration/engine.json'++ def native_binary(): explicit = os.environ.get('ADOM_CODEX_NATIVE') if explicit:@@ -27,6 +30,22 @@ def native_binary(): if not path.is_file() or path == Path(__file__).resolve(): raise RuntimeError('ADOM_CODEX_NATIVE must identify the native Codex executable') return path+ return newer_engine(bundled_binary())+++def newer_engine(bundled):+ """While Adom holds an older Codex build, the guard may supply OpenAI's newer engine+ (newer models) for it. Use it only with the exact build it was verified for."""+ try: engine = json.loads(ENGINE.read_text())+ except (OSError, ValueError): return bundled+ version = extension_version(bundled)+ binary = Path(engine.get('binary', ''))+ if not version or engine.get('extension') != '.'.join(map(str, version)) or not binary.is_file():+ return bundled+ return binary+++def bundled_binary(): # The extension appends its own native bin directory to this child's PATH. # Prefer that exact version, even if a newer VSIX is already on disk. for entry in reversed(os.environ.get('PATH', '').split(os.pathsep)):@@ -116,7 +135,7 @@ def identity(binary): def extension_version(binary):- match = re.search(r'openai\.chatgpt-([\d.]+)-', str(binary))+ match = re.search(r'openai\.chatgpt-([\d.]+)(?=[-/]|$)', str(binary)) return tuple(map(int, match[1].split('.'))) if match else None