Skip to content

Commit 2f5a20b

Browse files
committed
Merge latest dev for PR #854
2 parents 553660e + 802f9b4 commit 2f5a20b

28 files changed

Lines changed: 1547 additions & 91 deletions

‎devlog/_plan/260802_bugfix_280/010_fix_858_pinned_cleanup.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,16 @@ deletion is insufficient: the rollout file is staged/purged regardless.
3535
- Older schema without is_pinned -> existing tests stay green.
3636
- Policy coverage in tests/storage-policy.test.ts for percentage and
3737
reduceToBytes targets.
38+
39+
## Results (2026-08-02, wp2 executed on branch codex/bugfix-280)
40+
41+
- b6bc2fec red regression (4 tests, all red pre-fix).
42+
- b27cfd83 fix: is_pinned via columnExists; selection filter applied BEFORE
43+
percent/exact/policy selection (backfills); preflight + write-locked
44+
reconcile refuse with new pinned_thread error (409 mapped in
45+
logs-usage-routes); pin-after-preview fails closed as stale_preview.
46+
- 19075301 reviewer repair round: beforeReconcileLock hook + locked-gate
47+
test; policy percent/reduceTo pinned tests.
48+
- Independent review: FAIL (2 coverage findings) -> repair -> PASS.
49+
- Verification: storage-cleanup + storage-policy 92 pass 0 fail; typecheck
50+
green.

‎devlog/_plan/260802_bugfix_280/020_fix_855_ghost_models.md‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,23 @@ Ownership signature: generated rows carry
3131
removed, cursor preserved, fresh present. (Red before fix.)
3232
- Empty-gather variant: configured-provider marked rows survive transient
3333
failure; deleted-provider marked rows do not.
34+
35+
## Results (2026-08-02, wp3 executed on branch codex/bugfix-280)
36+
37+
- 6a3dd690 red regression (2 tests, red pre-fix; 8 existing tests green
38+
throughout — they use unmarked foreign rows).
39+
- b60d7297 fix: isOcxAuthoredRoutedEntry ownership signature; ghost drop in
40+
both partial-gather and empty-gather branches; foreign rows preserved.
41+
- Verification: codex-catalog + sync-hardening suites 127 pass 0 fail;
42+
typecheck green. Full tests/ run was attempted but exceeded ~57 CPU-min
43+
locally and was stopped; full-suite proof defers to CI after push.
44+
- Reviewer repair rounds (Plato):
45+
- R1 FAIL: legacy June–July rows used provider-name signature → bc7feadb
46+
recognizes it + empty-gather transient-protection assertion.
47+
- R2 FAIL: legacy combo aliases ("→ combo (combo)." under vendor/* slug)
48+
missed → 8dffecca switches to the stable prefix alone as the ownership
49+
signal.
50+
- R3 FAIL: combo-alias regression was false-green (generic combo cleanup
51+
removed the row) → 6d5f5c99 configures a physical combo provider so the
52+
test depends on the matcher; red/green proven by reverting.
53+
- Final: PASS. Suites 129 pass 0 fail, typecheck green.

‎devlog/_plan/260802_bugfix_280/030_fix_859_desktop_alias.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,15 @@ the generated date alias. Red: mock DeepSeek receives
3131
`deepseek/deepseek-v4-flash` and the adapter sends `deepseek-v4-flash`.
3232
(Existing 42 focused tests pass but only cover same-process generation or
3333
explicit discovery first — the coverage gap that hid this.)
34+
35+
## Results (2026-08-02, wp4 executed on branch codex/bugfix-280)
36+
37+
- ce249422 red regression (delegation contract, red at import pre-fix).
38+
- d05ec663 fix: applyProfile delegates to the live daemon through the
39+
authenticated management API; route gains optional validated mode.
40+
- 71b7ac6e repair round 1 (Mencius FAIL): stale-daemon profile — the
41+
delegated request now carries the profile, validated server-side with
42+
parseDesktopProfile; CLI reports saved-but-not-applied explicitly.
43+
- 8a364c1d repair round 2 (FAIL): seam now passes (mode, profile) so
44+
dropping the profile is red; registry guard uses a test-unique provider.
45+
- Final review: PASS. Suites 30 pass 0 fail; typecheck green.

‎devlog/_plan/260802_bugfix_280/040_fix_864_ws_terminal.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,20 @@ restoration:
3737
- Note: full runtime red/green proof needs real Windows Bun 1.3.14
3838
(macOS cannot reproduce Bun#32111); CI Windows leg carries that proof
3939
after push.
40+
41+
## Results (2026-08-02, wp5 executed on branch codex/bugfix-280)
42+
43+
- f5e66fba red regression (rewrite framing + transport invariant, red with
44+
fix stashed).
45+
- 9d271d09 fix: relaySseEagerBounded gains rewritePayload (complete-block
46+
framing, budgeted buffer, EOF tail); core routes win32 && needsClientRewrite
47+
through it, never the tee()+JS-pull chain.
48+
- 8b6f1613 repair round 1 (Chandrasekhar FAIL): unchanged blocks pass
49+
byte-identical (multi-data CRLF), decoder flush ordered after buffer,
50+
rewrite applied to EOF tail, budget released on all teardown paths,
51+
isWin32EagerRewrite extracted with policy tests.
52+
- bf2afc0e repair round 2: decoder-tail regression exercises the real flush.
53+
- Final review: PASS. relay-eager + caps + passthrough-abort + image-gen +
54+
sse-rewrite + ws + server-auth suites green; typecheck green.
55+
- Honest caveat: the Windows runtime proof (Bun#32111 stall itself) defers
56+
to the CI Windows leg after push — recorded per plan.

‎devlog/_plan/260802_bugfix_280/050_fix_857_stale_roster.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,21 @@ during sync (src/cli/index.ts:826); process snapshots lack start times
3232
fresh and no-app-server keep current output.
3333
- Management API test: /api/subagent-models carries the state.
3434
- Preserve existing sync-warns-without-restart tests.
35+
36+
## Results (2026-08-02, wp6 executed on branch codex/bugfix-280)
37+
38+
- 26dc5aa2 fix: collectCodexAppServerCatalogState (catalog mtime vs process
39+
start, 5s TTL, platform readers), v2 guidance suppression on
40+
stale/unknown, /api/subagent-models state, ocx doctor check; env override
41+
keeps host process state out of hermetic tests.
42+
- 2ad395a3 repair round 1 (Faraday FAIL): enumeration failure → unknown
43+
(listers propagate; restart flow keeps its own no-target contract);
44+
timestamp ties conservatively stale; batched start-time reads; TTL cache
45+
only for fully-default calls.
46+
- 856b37cf repair round 2 (FAIL): missing /proc throws (unknown, not
47+
not_running); Windows GetOwner gaps emit an incompleteness sentinel;
48+
timeouts tightened with documented bounds.
49+
- 942bb613 repair round 3 (FAIL): sentinel on ALL owner-verification
50+
failure branches; batch timeouts match the documented bounds.
51+
- Final review: PASS. GUI banner deferred per plan. Synchronous cold-call
52+
bound documented on the collector; fully-async refresh out of scope.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# 070 — Integration: land codex/bugfix-280 on origin/dev + close issues
2+
3+
Date: 2026-08-02. Landing plan for the five fixes (010-050) developed on
4+
branch `codex/bugfix-280` in worktree `/Users/jun/Developer/opencodex-bugfix280`.
5+
6+
## Constraints
7+
8+
- The MAIN worktree (/Users/jun/Developer/opencodex) hosts another active
9+
session with unpushed local commits and an uncommitted file. Do not touch
10+
it: all integration happens in the bugfix worktree.
11+
- Push is pre-approved by the owner for this scope: fast-forward only, no
12+
force, target origin/dev.
13+
14+
## Steps
15+
16+
1. `git fetch origin`; `git merge origin/dev` into codex/bugfix-280.
17+
Audit note: from merge base 55ce981d only src/codex/catalog/sync.ts
18+
changed on both sides and `git merge-tree` shows zero conflict markers;
19+
registry.ts changed only on origin/dev, devlog only on our branch.
20+
2. Post-merge verification: `bun run prepush` (typecheck + GUI lint + FULL
21+
test suite + privacy scan — the required pre-push gate; focused suites
22+
alone are insufficient per AGENTS.md). Preflight: never stage the
23+
untracked node_modules symlink.
24+
3. Immediately before push, `git fetch origin` again and require
25+
`git merge-base --is-ancestor origin/dev HEAD` (the FF guarantee is only
26+
as fresh as the last fetch). Then `git push origin codex/bugfix-280:dev`.
27+
No force.
28+
4. Watch the dev-branch CI run; require EVERY job green for the exact pushed
29+
SHA (Linux/macOS/Windows, GUI gates, privacy scan, npm-global smoke —
30+
MAINTAINERS.md holds direct pushes to the same bar). The Windows leg is
31+
the runtime proof for #864 (Bun#32111 stall).
32+
5. Comment + close issues 858, 855, 859, 864, 857 with the merge SHA and CI
33+
outcome. #848 stays open (its fix rides PR #861; rebase instruction
34+
already posted).
35+
36+
## Failure handling
37+
38+
- Non-fast-forward push → stop, report (NEEDS_HUMAN).
39+
- Any CI job red for the pushed SHA → do NOT close the issues; report and
40+
investigate as a new work-phase.
41+
42+
## Results (2026-08-02, executed)
43+
44+
- Merge: 808b885c (zero conflicts; 74 files from origin/dev merged in).
45+
- prepush: typecheck, GUI lint, full suite 6911 pass 0 fail (480 files),
46+
privacy scan, react-doctor — all green.
47+
- Push: 253455bc..808b885c → origin/dev (FF verified immediately before
48+
push).
49+
- CI run 30733116558: all 7 jobs success for the exact pushed SHA, incl.
50+
the Windows leg (#864 runtime proof).
51+
- Issues closed with fix-reference comments:
52+
- 858 (comment 5155571704)
53+
- 855 (comment 5155571918)
54+
- 859 (comment 5155574271)
55+
- 864 (comment 5155574529)
56+
- 857 (comment 5155574750)
57+
- 848 stays open: fix rides PR #861 (rebase instruction posted earlier).

‎src/cli/claude-desktop.ts‎

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { writeDesktop3pConfig, type Desktop3pConfigMode, parseDesktop3pModeArgs
1313
import { filterCatalogVisibleModels, desktopVisibleNativeSlugs } from "../codex/catalog";
1414
import { buildClaudeDesktopState, fetchAllModels } from "../server/management-api";
1515
import { findLiveProxy } from "../server/proxy-liveness";
16+
import { runtimeRequest } from "./runtime-api";
1617

1718
function isFamily(value: string | undefined): value is DesktopFamily {
1819
return !!value && (DESKTOP_FAMILIES as readonly string[]).includes(value);
@@ -28,20 +29,51 @@ function printDesktopHelp(): void {
2829
ocx claude desktop import <path> [--apply]`);
2930
}
3031

31-
async function applyProfile(profile: DesktopProfile, mode: Desktop3pConfigMode): Promise<{ ok: boolean; path: string; reason?: string }> {
32+
export interface ApplyProfileDeps {
33+
findLiveProxyImpl?: typeof findLiveProxy;
34+
postApplyImpl?: (
35+
mode: Desktop3pConfigMode,
36+
profile: DesktopProfile,
37+
) => Promise<{ ok?: boolean; path?: string; error?: string }>;
38+
}
39+
40+
export async function applyProfile(
41+
profile: DesktopProfile,
42+
mode: Desktop3pConfigMode,
43+
deps: ApplyProfileDeps = {},
44+
): Promise<{ ok: boolean; path: string; reason?: string }> {
3245
const config = loadConfig();
3346
const state = await buildClaudeDesktopState(config, profile);
3447
config.claudeCode = { ...(config.claudeCode ?? {}), desktopProfile: state.profile };
3548
saveConfigPreservingClaudeCode(config);
36-
const live = await findLiveProxy();
49+
const live = await (deps.findLiveProxyImpl ?? findLiveProxy)();
50+
if (live) {
51+
// #859: the Desktop alias reverse-map is process-local. Applying through the
52+
// serving process installs the map there; a local-only write leaves the
53+
// daemon unable to decode aliases, and the provider rejects them (400).
54+
const post = deps.postApplyImpl ?? (async (m: Desktop3pConfigMode, p: DesktopProfile) =>
55+
runtimeRequest<{ ok?: boolean; path?: string; error?: string }>(
56+
"/api/claude-desktop/apply",
57+
// The daemon's config may be older than what we just saved, so the
58+
// profile travels with the request instead of being re-read there.
59+
{ method: "POST", body: JSON.stringify({ mode: m, profile: p }) },
60+
));
61+
try {
62+
const applied = await post(mode, state.profile);
63+
if (applied.ok === false) return { ok: false, path: applied.path ?? "", reason: applied.error ?? "daemon apply failed" };
64+
return { ok: true, path: applied.path ?? "" };
65+
} catch (error) {
66+
return { ok: false, path: "", reason: error instanceof Error ? error.message : String(error) };
67+
}
68+
}
3769
const allModels = await fetchAllModels(config);
3870
const routed = filterCatalogVisibleModels(allModels, config).map(model => ({
3971
provider: model.provider,
4072
id: model.id,
4173
contextWindow: model.contextWindow,
4274
}));
4375
const result = writeDesktop3pConfig(
44-
live?.port ?? config.port ?? 10100,
76+
config.port ?? 10100,
4577
[...desktopVisibleNativeSlugs(config)],
4678
routed,
4779
config.apiKeys?.[0]?.key,
@@ -51,7 +83,7 @@ async function applyProfile(profile: DesktopProfile, mode: Desktop3pConfigMode):
5183
return { ok: result.written, path: result.path, reason: result.reason };
5284
}
5385

54-
export async function handleClaudeDesktopCommand(argv: string[]): Promise<number> {
86+
export async function handleClaudeDesktopCommand(argv: string[], deps: ApplyProfileDeps = {}): Promise<number> {
5587
const command = argv[0];
5688
if (command === "help" || command === "--help" || command === "-h") {
5789
printDesktopHelp();
@@ -72,8 +104,12 @@ export async function handleClaudeDesktopCommand(argv: string[]): Promise<number
72104
try {
73105
const config = loadConfig();
74106
const state = await buildClaudeDesktopState(config);
75-
const result = await applyProfile(state.profile, parsedMode.mode);
76-
if (!result.ok) { console.error(`설정 적용 실패: ${result.reason ?? "unknown error"}`); return 1; }
107+
const result = await applyProfile(state.profile, parsedMode.mode, deps);
108+
if (!result.ok) {
109+
console.error(`설정 적용 실패: ${result.reason ?? "unknown error"}`);
110+
console.error("프로필은 저장되었지만 Claude Desktop 설정 파일에는 반영되지 않았습니다. 프록시 상태를 확인한 뒤 다시 적용해 주세요.");
111+
return 1;
112+
}
77113
console.log(`Claude Desktop 설정을 적용했습니다: ${result.path}`);
78114
console.log("Claude Desktop을 완전히 종료한 뒤 다시 열어 주세요.");
79115
return 0;
@@ -137,7 +173,7 @@ export async function handleClaudeDesktopCommand(argv: string[]): Promise<number
137173
config.claudeCode = { ...(config.claudeCode ?? {}), desktopProfile: reconciled };
138174
saveConfigPreservingClaudeCode(config);
139175
if (flags.includes("--apply")) {
140-
const result = await applyProfile(reconciled, "static");
176+
const result = await applyProfile(reconciled, "static", deps);
141177
if (!result.ok) { console.error(`프로필은 저장했지만 Desktop 적용에 실패했습니다: ${result.reason ?? "unknown error"}`); return 1; }
142178
}
143179
console.log("Claude Desktop 프로필을 가져왔습니다.");

‎src/cli/doctor.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,18 @@ export async function runDoctor(args: string[] = []): Promise<void> {
873873
console.log(` [${check.level}] ${check.message}`);
874874
}
875875

876+
// #857: a running Codex app-server can keep an older in-memory catalog than
877+
// the one on disk — surface it outside sync time.
878+
const { collectCodexAppServerCatalogState } = await import("../codex/app-server-processes");
879+
const catalogState = collectCodexAppServerCatalogState();
880+
if (catalogState.state === "stale") {
881+
console.log(` [WARN] Codex app-server (PID(s): ${catalogState.processes.map(p => p.pid).join(", ")}) started before the on-disk catalog changed; its in-memory model list disagrees with ocx. Action: restart Codex (or run \`ocx sync --restart-codex\`)`);
882+
} else if (catalogState.state === "unknown") {
883+
console.log(" [WARN] Could not verify whether the running Codex app-server's model catalog is current (start time or catalog unreadable). Action: if the model list looks stale, restart Codex");
884+
} else if (catalogState.state === "fresh") {
885+
console.log(" [OK] Codex app-server model catalog is current with the on-disk catalog.");
886+
}
887+
876888
// Hints, not fixes.
877889
const hints: string[] = [];
878890
const proxyDown = proxyDownRestartHint({

0 commit comments

Comments
 (0)