← Commit history
0.1.29: a listed Codex build shows a notice instead of loading its UI, so it can never freeze the editor
2 files changed
+50−2
page.json+1−2@@ -79,7 +79,6 @@ "runtime/*.py", "runtime/*.cjs", "runtime/*.css",- "runtime/*.json", "runtime/vendor/*.md", "runtime/vendor/*LICENSE", "runtime/vendor/websockets/*.py",@@ -98,4 +97,4 @@ "videos/04-public-adom-solenoid-full-routing-narrated.mp4", "videos/04-public-adom-solenoid-full-routing.mp4" ]-}+}
tests/test_webview_bad_build.cjsadded+49@@ -0,0 +1,49 @@+'use strict';+// A listed Codex build must never load its own UI: the patched extension.js of that+// build calls watchRenderer, which swaps in a short notice instead.+const assert = require('node:assert/strict');+const fs = require('fs');+const os = require('os');+const path = require('path');++const home = fs.mkdtempSync(path.join(os.tmpdir(), 'cx-home-'));+process.env.HOME = home; // no guard state: the bundled list applies+const webview = path.resolve(__dirname, '../runtime/webview.cjs');++// Stand-in for a patched out/extension.js inside an installed Codex build.+function extensionFor(version) {+ const dir = path.join(home, `.local/share/code-server/extensions/openai.chatgpt-${version}-linux-x64/out`);+ fs.mkdirSync(dir, { recursive: true });+ const file = path.join(dir, 'extension.js');+ fs.writeFileSync(file, `module.exports = (...a) => require(${JSON.stringify(webview)}).watchRenderer(...a);`);+ return require(file);+}++function run(version) {+ const view = { html: '<original codex ui>' };+ let started = 0, disposedGuard = 0, onDispose;+ const guard = { start() { started++; }, dispose() { disposedGuard++; } };+ extensionFor(version)(view, 'sidebar', {}, guard, (fn) => { onDispose = fn; return { dispose() {} }; });+ return { view, started, guard: () => disposedGuard, dispose: () => onDispose && onDispose() };+}++try {+ for (const version of ['26.1021.22027', '26.51021.22027']) {+ const r = run(version);+ assert.match(r.view.html, /This Codex build is turned off/);+ assert.match(r.view.html, new RegExp(version.replace(/\./g, '\\.')));+ assert.equal(r.started, 0, 'no startup timer for a blocked build');+ r.dispose(); assert.equal(r.guard(), 1);+ }+ const good = run('26.908.40401');+ assert.equal(good.view.html, '<original codex ui>');+ assert.equal(good.started, 1);++ // The wiki copy in the guard's state wins over the bundled list.+ const state = path.join(home, '.local/state/adom/codex-integration');+ fs.mkdirSync(state, { recursive: true });+ fs.writeFileSync(path.join(state, 'guard.json'), JSON.stringify({ list: { builds: [{ versions: ['26.908.40401'], reason: 'test' }] } }));+ assert.match(run('26.908.40401').view.html, /turned off/);+ assert.equal(run('26.1021.22027').view.html, '<original codex ui>');+ console.log('Passed: listed builds show the notice, good builds load, live list wins.');+} finally { fs.rmSync(home, { recursive: true, force: true }); }