Skip to content

fix(cli): warn about restart state loss - #5488

Closed
AaronZ345 wants to merge 4 commits into
lidge-jun:devfrom
AaronZ345:fix/codex-restart-unsaved-state-warning
Closed

AaronZ345 wants to merge 4 commits into
lidge-jun:devfrom
AaronZ345:fix/codex-restart-unsaved-state-warning

Conversation

@AaronZ345

@AaronZ345 AaronZ345 commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • name the concrete unsaved desktop state at risk when ocx system codex-restart is missing --yes
  • repeat the warning on the confirmed human-readable path while preserving the restart behavior and confirmation requirement
  • align the nearby implementation comment and regenerate the CLI management surface reference

Partially addresses #4761. This PR only improves the destructive-restart warning; it does not close the broader app-server-only restart work.

Verification

  • bun test tests/cli/cli-headless-parity.test.ts tests/cli/cli-capabilities.test.ts tests/ci-workflows/skill-ocx.test.ts (112 pass)
  • bun test tests/responses/responses-compaction-routing.test.ts (124 pass)
  • bun test tests/usage/request-history-index.test.ts tests/codex-integration/codex-shim.test.ts (100 pass, 23 skip, 1 pre-existing timeout)
  • the same request-history timeout reproduces on a clean upstream/dev worktree (7.4s against a 5s limit)
  • bun run typecheck
  • git diff --check
  • fork CI: 33/33 jobs passed: https://github.com/AaronZ345/opencodex/actions/runs/35721924598

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

zhangyu.34 added 2 commits September 22, 2026 11:35
Name the unsaved desktop state at risk before requiring confirmation so operators can avoid losing drafts or approvals.

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Keep the generated command reference aligned with the expanded restart warning.

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Sep 22, 2026
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • review readiness checklist open (2/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 2/4).

Review readiness checklist

  • ⬜ All CI tests are green on my local testing.
  • ✅ I pushed my PR to the latest dev commit.
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ⬜ My PR is ready for review.

2/4 boxes ticked.

This PR stays in draft until every box above is ticked.

@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 32 / 80

이 PR은 ocx system codex-restart를 쓸 때, --yes 없이 실행하면 뜨는 안내 말을 더 구체적으로 바꾼 것이다. 예전에는 “데스크톱 앱을 끄고 다시 켠다” 정도만 말했는데, 이제는 저장되지 않은 작성 중인 글, 모델 선택창에서 고른 값, 승인 대기 창이 사라질 수 있다고 직접 이름을 붙인다. 실제로 재시작하는 동작이나 --yes가 꼭 필요하다는 규칙은 그대로다. 같은 내용을 capabilities.ts, 생성된 관리 표면 문서, structure/runtime.md, 테스트에도 맞춰 두었다. 이슈 #4761이 말한 큰 문제(카탈로그만 바뀌었을 때 데스크톱을 안 끄기, 앱 서버만 재시작하기)까지는 고치지 않았고, “잃을 수 있는 상태를 미리 말해 주기” 한 조각만 처리한 PR이다.

라인 - src/cli/system-command.ts의 codex-restart 바로 위 주석은 예전처럼 “세션을 끊는다”고만 적혀 있고, 새로 쓴 에러 문구(초안/모델 선택/승인 창)와 맞춰지지 않았다.
라인 - --yes를 이미 붙인 성공 경로 사람용 출력(Codex desktop app and app-server restart requested.)에는 상태 손실 경고가 없다. 실수로 --yes를 습관처럼 쓰는 운영자/에이전트는 에러 경로를 보지 못할 수 있다.
라인 - 이슈 #4761의 나머지(카탈로그 변경 없을 때 데스크톱 재시작 생략, 앱 서버만 재시작)는 이 diff 밖이다. 이 PR만 merge해도 이슈를 닫기엔 부족하다.

메인테이너의 판단이 필요한 지점

이 PR을 #4761의 “경고만 먼저” 조각으로 받고 이슈는 열어둘지, 아니면 파괴적 재시작을 줄이는 후속 작업이 같이 있어야 merge할지. 또한 draft이고 readiness checklist가 0/4라서, 지금 시점에서 리뷰 완료 표시를 할지 작성자 체크를 기다릴지.

너의 추천

경고 문구와 문서·테스트 정합은 좋고 범위도 작아서, 주석만 에러 문구와 맞춘 뒤 draft checklist를 채우면 merge해도 된다. #4761은 부분 해결로 두고 후속 이슈/PR로 “앱 서버만 재시작 / 불필요한 데스크톱 재시작 생략”을 따로 추적하는 쪽이 맞다. types.ts/config.ts 분할이나 preview deploy와는 무관하다.

이 댓글은 grok-bot이 작성했습니다

zhangyu.34 added 2 commits September 22, 2026 17:36
Keep destructive desktop state loss visible for habitual --yes users without changing the JSON contract.

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
@AaronZ345

Copy link
Copy Markdown
Contributor Author

Verification update for d18632efc:

  • focused restart surface: 112/112 passed
  • compaction regression control: 124/124 passed on both this branch and clean upstream/dev
  • typecheck and git diff --check: passed
  • fork CI: 33/33 jobs passed (run 35721924598)
  • the only focused local failure is the existing request-history large-index 5s timeout; it reproduces unchanged on clean upstream/dev (branch 7.7s, baseline 7.4s)

The correct Grok findings were addressed. I left the local-green and ready-for-review boxes open rather than claiming the baseline timeout is green.

lidge-jun added a commit that referenced this pull request Sep 23, 2026
…robe ceilings, hidden autostart, mise updates, Linux packaged E2E (#5682)

* fix(desktop): ad-hoc sign the bun sidecar on macOS after prepare

Bun's linker-signed standalone output is killed by macOS page validation
(CODESIGNING "Invalid Page"), so the bundled ocx sidecar never ran and the
desktop app stayed in "resolving". prepare-sidecar now reseals the copied
sidecar with an ad-hoc signature, but only when a macOS host prepares a
bun-darwin-* target, through the absolute /usr/bin/codesign; a failed or
unlaunchable codesign stops preparation. The decision and the spawn
boundary live in desktop/scripts/sidecar-signing.ts so they are tested
without running codesign.

Carries #5559.

Co-authored-by: agentHits <140916359+agentHits@users.noreply.github.com>

* fix(cli): warn about state loss before and after codex-restart

ocx system codex-restart fully quits and relaunches the Codex desktop app,
which can discard unsaved composer drafts, model-picker selections, and
pending approval prompts. The missing --yes error, the confirmed human
output, the capability metadata, the generated skill surface, and the
runtime structure doc now name that concrete loss. The restart request,
the --yes gate, and the JSON payload are unchanged.

Carries #5488. Refs #4761 (the warning slice only; restart scope is
unchanged).

Co-authored-by: Yu Zhang <34849476+AaronZ345@users.noreply.github.com>

* feat(server): OCX_PROBE_TIMEOUT_MS raises the liveness probe ceilings

On hosts where a content filter or EDR network extension adds a fixed cost
to every loopback connect, the shipped 750 ms probe expires before a
healthy proxy answers and every CLI liveness consumer reports it down.
OCX_PROBE_TIMEOUT_MS (whole milliseconds, 1 to 30000) raises the ceilings
on such hosts.

The override only raises: the 750 ms shared default and the 1500 ms
stop/start ownership budgets keep their floors, so a small value can never
shorten the budgets that prevent a duplicate proxy. Values above 30 s are
ignored so the single-shot stop deadline stays bounded (at most about 90 s).
The wiring tests read the constants in child processes, so no other test
file can observe an override. The CLI reference in all eight locales and
structure/ops/service-and-sidecars.md describe the setting.

Carries #5409 with the floor and ceiling fixed during the carry.

Co-authored-by: Kinso <5144108+kinsolee@users.noreply.github.com>

* perf(desktop): keep a hidden login launch on the startup surface

A login launch that starts hidden behind a usable tray no longer loads the
full dashboard after Ready. It keeps the small bundled startup page, and the
tray's Open Dashboard, a second ordinary launch, and the shell's open command
all go through startup::open_dashboard, which performs the run's single
navigation before showing the window. Manual launches and visible no-tray
launches keep eager navigation.

Two gaps in the original change are closed here. An open that arrives during
startup is recorded before progress is read, and finish reads it after
recording Ready, so whichever side runs second navigates. A WebView that
refuses the navigation script gives the one-shot claim back, so the next
open retries. Both reset with each run. Rust tests cover the first,
repeated, refused, and in-flight opens; the desktop guide in all eight
locales, structure/desktop-shell.md, and ADR-5494 describe the behavior.

Carries #5498. Refs #5493 (hidden-autostart deferral).

Co-authored-by: ingwannu <186453546+Ingwannu@users.noreply.github.com>

* fix(update): respect mise-owned installations

An opencodex package installed by mise was updated by npm self-update
inside mise's tree, behind mise's back. Install detection now recognises a
mise install from the adjacent .mise.backend.toml (tool alias plus the
canonical npm:@bitkyc08/opencodex backend) on both the lexical and the
resolved package path, reports installer "mise", and refuses mutation
with "mise upgrade <alias>" before any proxy stop, package write, or
worker creation: in the Node launcher, ocx update, the dashboard update
check and worker, and the sidebar badge. Unreadable or contradictory
metadata on either path fails closed without inventing a tool name. The
dashboard hides the command chip when there is no verified command, and
the lifecycle reference in all eight locales and all ten GUI catalogs
describe the behaviour.

Changes made while carrying it onto current dev:
- ported onto the update ownership transaction and the package-tree
  restart guard that landed after the PR's base;
- two verified owners whose tool roots differ only by a symlinked
  ancestor (macOS /var -> /private/var) are compared by canonical
  directory, so a real install behind a symlinked data directory is not
  reported as contradictory;
- the launcher refusal test now runs on Windows too (junction plus
  npm.cmd), proves the fake npm never runs, and covers contradictory
  metadata;
- the structure note moved to structure/ops/service-and-sidecars.md to
  keep structure/runtime.md within its line budget.

Carries #5316.

Co-authored-by: Gary Sassano <10464497+garysassano@users.noreply.github.com>

* test(desktop): add the Linux packaged-shell E2E driver

desktop/scripts/linux-packaged-e2e.ts boots the real AppImage and deb
payloads under a private Xvfb, Openbox and D-Bus session with fresh HOME,
XDG, CODEX_HOME and OPENCODEX_HOME roots and a reserved loopback port,
then requires a visible OpenCodex window, the bundled sidecar's matching
/healthz identity, port and version, and a clean drain after the only
window closes. Its report records readiness time and process-tree RSS as
evidence, not as budgets. Release asset collection accepts an explicit
isolated bundle root, and the AppImage patchelf wrapper follows the active
CARGO_TARGET_DIR so each Linux format can build in its own Cargo target.

Changes made while carrying it:
- the window is closed through the window manager (wmctrl -i -c, the
  EWMH close request a close button sends) instead of xdotool windowclose,
  which destroys the X window and can end the app without Tauri's
  close/drain path; the app must then exit on its own with code 0 and no
  signal, which is asserted and recorded in the report;
- verify-linux-sidecar.sh takes the staged AppImage directory as an
  optional argument, keeping the local default path;
- workflow wiring and the tests that read workflow files are in the
  following commit.

Carries #5502 (driver, scripts, docs). Refs #5493.

Co-authored-by: ingwannu <186453546+Ingwannu@users.noreply.github.com>

* ci(desktop): run the Linux packaged-shell E2E and isolate Linux release formats

CI: a new desktop scope (desktop/, gui/, src/, the standalone build
scripts, package.json, bun.lock and ci.yml itself) selects desktop-shell
alongside the native scope. When selected, the job builds the dashboard
and the bundled sidecar, builds the AppImage and the deb in separate Cargo
targets with updater artifacts disabled, stages them read-only, and runs
the packaged-shell E2E under dbus-run-session, xvfb-run and Openbox. The
report is uploaded with a SHA-pinned upload-artifact. The workflow keeps
contents: read, uses no secrets, and installs no package into the runner.
The aggregate gate derives the widened desktop-shell expectation the same
way the job does.

Release: on Linux, each format is built in its own CARGO_TARGET_DIR, staged
read-only, and collected from that staged root; the existing job-scoped
signing inputs are unchanged.

Changes made while carrying it:
- current dev's scope step no longer handles a privacy output; only the
  desktop output was added to it and to the aggregate;
- the Linux sidecar verifier moved after the isolated AppImage build and
  staging, and verifies the staged AppImage directory; before, it would
  have run before any Linux bundle existed in the default target;
- wmctrl is installed for the window-manager close request;
- the scope and aggregate tests that landed on dev after the PR's base
  now model the desktop output, and a new test file carries the CI wiring
  assertions.

Carries #5502 (workflow part). Refs #5493.

Co-authored-by: ingwannu <186453546+Ingwannu@users.noreply.github.com>

---------

Co-authored-by: agentHits <140916359+agentHits@users.noreply.github.com>
Co-authored-by: Yu Zhang <34849476+AaronZ345@users.noreply.github.com>
Co-authored-by: Kinso <5144108+kinsolee@users.noreply.github.com>
Co-authored-by: ingwannu <186453546+Ingwannu@users.noreply.github.com>
Co-authored-by: Gary Sassano <10464497+garysassano@users.noreply.github.com>
@lidge-jun

Copy link
Copy Markdown
Owner

Carried onto dev in bundle PR #5682 (squash-merged as 7f8d538), rebuilt on current dev as commit dc92d36 on the lane branch with a Co-authored-by trailer for you, so the credit stays on the merged commit. Closing this one as superseded. Thank you for the work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants