Skip to content

Fix stale Codex autostart shim repair - #5

Closed
Ingwannu wants to merge 1 commit into
mainfrom
codex/shim-stale-state-reinstall
Closed

Fix stale Codex autostart shim repair#5
Ingwannu wants to merge 1 commit into
mainfrom
codex/shim-stale-state-reinstall

Conversation

@Ingwannu

Copy link
Copy Markdown
Owner

Summary

  • detect stale Codex shim state when the wrapper path no longer contains the opencodex shim
  • repair missing or overwritten wrappers by reusing the saved original Codex backup
  • make shim status report whether the wrapper is an actual opencodex shim

Tests

  • bun test tests/codex-shim.test.ts
  • bun run typecheck

@lidge-jun

Copy link
Copy Markdown
Owner

좋은 PR 감사합니다! 코어 로직은 정확하고 stale shim 감지 + repair 경로 추가가 잘 되어 있습니다.

하나 blocking suggestion이 있습니다:

Repair 시 새 바이너리 보존 (codex-shim.ts repair 경로)

현재 repair가 unlinkSync로 wrapper를 삭제한 뒤 기존 backup을 가리키는 shim을 씁니다. 하지만 Codex 업데이트로 wrapper가 덮어써진 경우, 그 wrapper가 새 버전 바이너리입니다. 삭제하면 Codex 업데이트를 잃게 됩니다.

// 현재 (v2 바이너리 손실)
if (existsSync(existing.wrapperPath)) unlinkSync(existing.wrapperPath);
writeShim(existing.wrapperPath, existing.backupPath);

// 제안 (v2 바이너리를 백업으로 승격)
if (existsSync(existing.wrapperPath)) {
  renameSync(existing.wrapperPath, existing.backupPath);
}
writeShim(existing.wrapperPath, existing.backupPath);

이렇게 하면 Codex 업데이트 후 repair해도 최신 바이너리를 통해 실행됩니다.

수정 후 dev 브랜치로 머지 부탁드립니다! 현재 190 shim 개선 작업을 dev 위에서 진행 중이라, dev 기준으로 통합하면 좋겠습니다.

lidge-jun added a commit that referenced this pull request Jun 20, 2026
Add isShim() guard to prevent false "already installed" when wrapper was
overwritten by a Codex update. Add repair path that rewrites the shim when
the wrapper is missing or not an opencodex shim. Extract writeShim() helper.
Improve codexShimStatus() to distinguish shim/non-shim/missing wrappers.

Based on PR #5 by Ingwannu.

Co-authored-by: Ingwannu <Ingwannu@users.noreply.github.com>
@lidge-jun

Copy link
Copy Markdown
Owner

PR #5 변경사항을 dev에 머지하면서 repair 경로의 unlinkSync → renameSync 수정도 같이 적용했습니다. 추가로 shim 테스트 보강 + 문서화(README 3개 언어, docs-site CLI 레퍼런스, structure)도 완료했습니다.

dev 커밋:

  • f4b3d44 feat: detect and repair stale Codex autostart shim (PR Fix stale Codex autostart shim repair #5 기반)
  • d33beb1 fix: preserve Codex updates during shim repair
  • 9c938e8 test: extend shim tests
  • 93145fd docs: add autostart shim documentation

@lidge-jun

Copy link
Copy Markdown
Owner

Already merged into main via direct commits. Closing stale PR.

@lidge-jun lidge-jun closed this Jun 20, 2026
@lidge-jun
lidge-jun deleted the codex/shim-stale-state-reinstall branch June 20, 2026 18:07
lidge-jun added a commit that referenced this pull request Jul 12, 2026
…p audit

BLOCKER fixes:
- outbound.ts: detached pump pattern for SSE streaming — frames now reach
  the client as they arrive instead of buffering until upstream EOF; cancel
  calls reader.cancel() instead of the locked stream (#1)
- system-env.ts: transactional launchctl injection with incremental tracking
  and rollback on mid-flight failure (#2)

MAJOR fixes:
- system-env.ts: POSIX single-quote escaping for all user-controlled values
  in the generated shell file, preventing command injection (#3)
- system-env.ts: exported applySystemEnvToggle for runtime ON/OFF lifecycle (#7)
- claude-messages.ts: 120s hard timeout on native passthrough upstream fetch
  using AbortSignal.timeout, returning Anthropic 504 on expiry (#4)
- management-api.ts: reject non-plain-object PUT bodies (null, array, primitive)
  with 400; strict validation for blockedSkills, tierModels, modelMap, and
  autoCompactWindow (integer, range 100k-1M) (#5, #6)
- management-api.ts: call applySystemEnvToggle after systemEnv config toggle (#7)
- cli/claude.ts: override stale loopback ANTHROPIC_BASE_URL with live port;
  warn on gateway-cache and agent-sync failures instead of swallowing (#8, #10)
- gateway-cache.ts: distinguish discovery failure (keep cache) from authoritative
  empty success (write {models:[]}) (#9)

Test fixes: updated assertions for single-quote shell escaping, empty cache
semantics, validation messages, incremental tracking writes, and PUT response
shape.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants