Skip to content

Commit 75f3895

Browse files
authored
merge dev into preview for v2.39.0-preview.20260901
[WRONG BRANCH] promote dev onto preview for v2.39.0-preview.20260901
2 parents 93704b4 + 230cb19 commit 75f3895

252 files changed

Lines changed: 18668 additions & 513 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.
437 KB
Loading

‎bin/ocx.mjs‎

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
* src/cli/index.ts — only the published npm `bin` routes through here.)
1010
*/
1111
import { spawn, spawnSync } from "node:child_process";
12+
import { STOP_HISTORY_INCOMPLETE_EXIT_CODE } from "../src/update/stop-contract.mjs";
13+
import { probeProxyLiveness } from "../src/update/proxy-liveness-probe.mjs";
14+
import { decidePostStopUpdate } from "../src/update/stop-decision.mjs";
1215
import { randomBytes } from "node:crypto";
1316
import { createRequire } from "node:module";
1417
import { existsSync, readFileSync, readdirSync } from "node:fs";
@@ -17,6 +20,7 @@ import { dirname, join, resolve } from "node:path";
1720
import { fileURLToPath } from "node:url";
1821
import { isRealBunBinary } from "../src/lib/bun-binary-validator.mjs";
1922
import { npmInvocation } from "../src/update/npm-invocation.mjs";
23+
import { hasPendingTeardownIn } from "../src/config/pending-teardown-names.mjs";
2024
import {
2125
npmCachePreflightFailureMessage,
2226
runNpmCachePreflight,
@@ -202,7 +206,12 @@ function runNpmSelfUpdate() {
202206
// Capture listen target before stop clears runtime-port.json (mirrors GUI/CLI update worker).
203207
// Do not treat a live runtime port of 10100 as "missing" — track whether the read succeeded.
204208
let bakePort = 10100;
209+
// The hostname travels with the port: a proxy bound to ::1 or a specific interface is
210+
// invisible to a probe that assumes 127.0.0.1, and "no answer" would then read as
211+
// "stopped" for exactly the proxy the probe exists to find.
212+
let bakeHostname = "127.0.0.1";
205213
let sawRuntimePort = false;
214+
let sawRuntimeHostname = false;
206215
try {
207216
const rt = JSON.parse(readFileSync(join(configDir(), "runtime-port.json"), "utf8"));
208217
if (Number.isFinite(rt?.port) && rt.port > 0 && rt.port <= 65535) {
@@ -219,16 +228,29 @@ function runNpmSelfUpdate() {
219228
}
220229
if (runtimeLive) {
221230
bakePort = Math.trunc(rt.port);
231+
if (typeof rt?.hostname === "string" && rt.hostname.trim() !== "") {
232+
bakeHostname = rt.hostname.trim();
233+
sawRuntimeHostname = true;
234+
}
222235
sawRuntimePort = true;
223236
}
224237
}
225238
} catch { /* fall through to config */ }
226-
if (!sawRuntimePort) {
239+
// Port and hostname resolve INDEPENDENTLY: a legacy runtime record carries a port and no
240+
// hostname, and skipping config in that case probed 127.0.0.1 for a proxy bound to ::1.
241+
if (!sawRuntimePort || bakeHostname === "127.0.0.1") {
227242
try {
228243
const cfg = JSON.parse(readFileSync(join(configDir(), "config.json"), "utf8"));
229-
if (Number.isFinite(cfg?.port) && cfg.port > 0 && cfg.port <= 65535) bakePort = Math.trunc(cfg.port);
244+
if (!sawRuntimePort && Number.isFinite(cfg?.port) && cfg.port > 0 && cfg.port <= 65535) {
245+
bakePort = Math.trunc(cfg.port);
246+
}
247+
if (!sawRuntimeHostname && typeof cfg?.hostname === "string" && cfg.hostname.trim() !== "") {
248+
bakeHostname = cfg.hostname.trim();
249+
}
230250
} catch { /* keep default */ }
231251
}
252+
// Wildcard and bracketed-IPv6 normalization lives in probeProxyLiveness, so both lanes
253+
// get it from one place.
232254

233255
const launcher = fileURLToPath(import.meta.url);
234256

@@ -343,17 +365,47 @@ function runNpmSelfUpdate() {
343365
}
344366
}
345367

346-
if (serviceWasInstalled || hasRuntimeState) {
368+
// An outstanding pending-teardown receipt is a fourth reason to run the stop. After a
369+
// parent crashed mid-deferral the service, pid and runtime records can all be absent
370+
// while the shared client config still points at a proxy that is gone; installing over
371+
// that silently skips the recovery the receipt was written to trigger (#3008). Presence
372+
// is the whole test here — the launcher cannot parse it, and `ocx stop` is what decides
373+
// whether the obligation is safe to finish.
374+
const hasPendingTeardown = hasPendingTeardownIn(readdirSync, configDir());
375+
if (serviceWasInstalled || hasRuntimeState || hasPendingTeardown) {
347376
console.log("⏹ Stopping the running proxy before updating...");
348377
const stopRes = spawnSync(process.execPath, [launcher, "stop"], { stdio: "inherit", windowsHide: true });
349378
const stillHasRuntimeState =
350379
existsSync(join(configDir(), "ocx.pid")) || existsSync(join(configDir(), "runtime-port.json"));
351-
if (stopRes.status !== 0 || stillHasRuntimeState) {
380+
// A history-only failure means teardown succeeded and a backup manifest is waiting for
381+
// review: the proxy is down and replacing package files is safe. Every other nonzero
382+
// status is a stop that did not finish, and a signal kill (status null) says nothing
383+
// about whether it did - both abort, because replacing files under a live server
384+
// leaves it running mixed old and new modules (#3008).
385+
// The same decision the Bun updater makes, from the same module (#3008). Absent PID and
386+
// runtime files are weak evidence, so the captured endpoint is asked; "unknown" aborts
387+
// because a silent listener is exactly the state where replacing files is dangerous.
388+
const decision = decidePostStopUpdate({
389+
status: stopRes.status,
390+
hasRuntimeState: stillHasRuntimeState,
391+
// Re-checked AFTER the stop: a quarantined receipt lets the stop itself succeed
392+
// (there is nothing left to stop), so a pre-stop check alone let the retry install
393+
// over a teardown that never ran.
394+
teardownOutstanding: hasPendingTeardownIn(readdirSync, configDir()),
395+
liveness: probeProxyLiveness(bakePort, bakeHostname),
396+
});
397+
const historyOnlyStop = decision.reason === "history-only";
398+
if (!decision.proceed) {
352399
if (trayBeforeUpdate.restoreOnFailure) runTrayLifecycle(launcher, "start");
353-
console.error("opencodex: could not stop the running proxy; aborting the update. Run 'ocx stop' and retry.");
400+
if (decision.reason === "teardown-outstanding") {
401+
console.error("opencodex: a shared teardown from an earlier stop is still outstanding and needs manual review; aborting the update.");
402+
console.error("opencodex: confirm no proxy is running, run 'ocx restore', then remove the pending-teardown file in the opencodex home.");
403+
} else console.error(decision.reason === "proxy-unknown"
404+
? `opencodex: could not confirm the proxy on ${bakeHostname}:${bakePort} is stopped; aborting the update. Run 'ocx stop' and retry.`
405+
: "opencodex: could not stop the running proxy; aborting the update. Run 'ocx stop' and retry.");
354406
process.exit(1);
355407
}
356-
if (historyRestoreIncomplete()) {
408+
if (historyOnlyStop || historyRestoreIncomplete()) {
357409
console.warn(
358410
"opencodex: WARNING — Codex resume-history metadata restore is incomplete (a backup manifest remains).\n" +
359411
" The DB may be busy or the manifest/target may need review; untracked routed history is intentionally unchanged.\n" +

devlog/_plan/260831_aside_client_and_integrations_ux/000_plan.md renamed to devlog/_fin/260831_aside_client_and_integrations_ux/000_plan.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ per-row borders are literally what produces that texture.
3434
| wp4 | 030 | Rollback surface redesign |
3535
| wp5 | 040 | Brand marks for the nine clients showing a monogram |
3636
| wp6 | 050 | Stacked PR chain |
37+
| wp7 | 060 | Marks for the last three monogram clients |
38+
| wp8 | 070 | Marks on every Integrations surface, not just the API rows |
39+
| wp9 | 080 | Conflict overwrite: writer, route, GUI dialog |
40+
41+
wp7 through wp9 were appended after the original six. Outcome and corrections:
42+
`090_outcome.md`.
3743

3844
Research docs: 001 (Aside contract), 002 (registration checklist),
3945
003 (Integrations UX diagnosis), 004 (brand mark provenance).

devlog/_plan/260831_aside_client_and_integrations_ux/001_aside_contract.md renamed to devlog/_fin/260831_aside_client_and_integrations_ux/001_aside_contract.md

File renamed without changes.

devlog/_plan/260831_aside_client_and_integrations_ux/002_registration_checklist.md renamed to devlog/_fin/260831_aside_client_and_integrations_ux/002_registration_checklist.md

File renamed without changes.

devlog/_plan/260831_aside_client_and_integrations_ux/003_integrations_ux_diagnosis.md renamed to devlog/_fin/260831_aside_client_and_integrations_ux/003_integrations_ux_diagnosis.md

File renamed without changes.

devlog/_plan/260831_aside_client_and_integrations_ux/004_brand_mark_provenance.md renamed to devlog/_fin/260831_aside_client_and_integrations_ux/004_brand_mark_provenance.md

File renamed without changes.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# The three clients still on a monogram
2+
3+
Continuation of `004_brand_mark_provenance.md`, which closed six clients. After
4+
that pass `CLIENT_MARKS` covers nine of twelve; `hermes`, `gajae` and `mcode`
5+
still render `label.slice(0, 1)`.
6+
7+
004 recorded `gajae` and `hermes` as monogram-only because neither publishes an
8+
SVG with path geometry. That verdict stands on its own terms and is now
9+
superseded by a wider rule: raster-to-vector conversion is authorized, so "the
10+
vendor ships no SVG" no longer ends the search. Every mark below is traced from
11+
the product's own raster asset rather than redrawn.
12+
13+
All three were located 2026-08-31 through the `aside-jun` skill driving a
14+
signed-in Aside browser, then re-fetched and verified locally.
15+
16+
## mcode — MiniMax Code
17+
18+
A genuine first-party SVG exists and 004 simply had not found it.
19+
20+
- Source: `https://raw.githubusercontent.com/MiniMax-AI/MiniMax-01/main/figures/minimax.svg`
21+
- 1255 bytes, `viewBox="0 0 490.16 411.7"`, one `<path>` filled by a three-stop
22+
linear gradient (`#e4177f` to `#e73562` to `#e94e4a`).
23+
- It is the standalone symbol — the interlocking wave glyph with no wordmark
24+
beside it. The docs-site asset (`mintcdn.com/minimax-zh/.../logo/light.svg`)
25+
is the 129x32 horizontal lockup and was rejected for that reason: a wordmark
26+
in a 20px square renders as unreadable letter mush.
27+
- Publisher mark rather than product mark. MiniMax Code ships no mark of its
28+
own and MiniMax is its publisher, so this is the closest first-party asset.
29+
- Committed unmodified apart from dropping the Chinese-language `<title>` and
30+
layer-name metadata the authoring tool left behind. The gradient id is
31+
renamed: `未命名的渐变_6` means "unnamed gradient 6", it collides across
32+
inlined documents, and a non-ASCII id in a shared namespace is a trap.
33+
- Multi-color, so it must NOT enter `MONOCHROME_CLIENT_MARKS`: masking would
34+
flatten the gradient to one ink.
35+
36+
## hermes — Hermes agent
37+
38+
No usable SVG upstream; traced from the product's own application icon.
39+
40+
- Rejected first: `website/static/img/favicon.svg` is 113 bytes and its whole
41+
body is one `<text>` element. 004 already recorded this.
42+
- Rejected second: `https://nousresearch.com/safari-pinned-tab.svg` (12746
43+
bytes, potrace output). Its first path is `M40 2560 l0 -2560 2520 0 2520 0 0
44+
2560 0 2560 -2520 0 -2520 0 0 -2560z` — the full 512-unit frame. Rendered at
45+
20px that is a black square with a hairline hole, which is worse than a
46+
monogram.
47+
- Accepted: `apps/desktop/assets/icon.png` from `NousResearch/hermes-agent`,
48+
574273 bytes, 1024x1024 RGBA, artwork bounded at (101,108)-(924,914). This is
49+
the icon the Hermes desktop application ships, so it is the product's own
50+
mark, not the publisher's.
51+
- Quantizing the opaque pixels shows two inks: a light plate (340877 px) and
52+
black art (241765 px), with ~20k px of antialiasing between them. It is a
53+
single-ink illustration on a rounded plate.
54+
- Traced with `potrace -s --flat --turdsize 8 --alphamax 1.0 --opttolerance
55+
0.2` over the mask `alpha > 128 AND mean(rgb) < 110`, which keeps the black
56+
art and discards the plate. One path, squared to `viewBox="0 0 823 823"` by
57+
centering the 823x806 trace.
58+
- `fill="currentColor"`, and it MUST join `MONOCHROME_CLIENT_MARKS`. A 20px
59+
render on `#0d1117` confirmed the untinted mark is invisible in dark mode —
60+
the same failure `prime`, `opencode` and `kimi` already have.
61+
62+
## gajae — Gajae Code
63+
64+
No SVG anywhere upstream, confirmed twice; traced from the mascot.
65+
66+
- Searched and found empty: `assets/`, `public/` (404), `docs/`, plus
67+
`assets/logo.svg`, `assets/favicon.svg`, `public/logo.svg`,
68+
`public/favicon.svg`, `docs/logo.svg` (all 404), and every published
69+
`@gajae-code/*` npm tarball at 0.15.6 (no SVG entries). `docs/brand-assets.md`
70+
lists the active marks as PNG only.
71+
- Accepted source: `assets/character.png`, 3190496 bytes, 1550x2048 RGBA,
72+
transparent background.
73+
- It is a vertical lockup: the mascot occupies y < 1650 and the `gajae-code`
74+
wordmark sits below it. Rows 1650-1682 are fully transparent, which is the
75+
seam the crop uses. Only the mascot is traced; a wordmark would not survive
76+
20px.
77+
- The artwork is upscaled pixel art, so tracing at source resolution follows
78+
every staircase and produced a 1.3 MB SVG. Downsampling to a 128px box with
79+
Lanczos plus a 0.6px Gaussian first, then tracing, gives ~31 KB. That is
80+
larger than any existing mark (`zcode.svg`, 11037 bytes) because this one is
81+
an illustration rather than a glyph.
82+
- Seven color layers, k-means++ seeded at 3 for determinism, painted
83+
largest-area first. The committed file's fills are `#1d0a04`, `#561203`,
84+
`#981001`, `#e3770c`, `#d32e02`, `#8f3a04` and `#02ac61` — read off
85+
`gajae-code.svg` rather than off an earlier tuning run, whose centers differed
86+
because it quantized at a different target size. The smallest layer is the
87+
visor green and a fixed area floor would have dropped it, so the floor is a
88+
fraction of the opaque area instead.
89+
- Multi-color, so NOT in `MONOCHROME_CLIENT_MARKS`.
90+
91+
## Rule this pass establishes
92+
93+
A mark may be traced from the product's own raster asset when no vector exists,
94+
provided the trace follows the source pixels rather than redrawing them, the
95+
conversion parameters are recorded, and the result is verified by rendering at
96+
the size it will actually be used. Tracing a wordmark into a square slot is
97+
still refused, and so is a full-frame silhouette plate.

devlog/_plan/260831_aside_client_and_integrations_ux/010_wp2_aside_backend.md renamed to devlog/_fin/260831_aside_client_and_integrations_ux/010_wp2_aside_backend.md

File renamed without changes.

devlog/_plan/260831_aside_client_and_integrations_ux/020_wp3_aside_gui.md renamed to devlog/_fin/260831_aside_client_and_integrations_ux/020_wp3_aside_gui.md

File renamed without changes.

0 commit comments

Comments
 (0)