Fix duplicate Codex restore warning after graceful stop - #3164
Conversation
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. This PR stays in draft until every box above is ticked. Hygiene✅ Deterministic PR hygiene checks passed. |
Ingwannu
left a comment
There was a problem hiding this comment.
Requesting changes on exact head 0fe7c7dba5d33576a4235bbb9c9b178553aa70f8.
The ownership direction is correct, but the current boolean loses the teardown result that decides whether caller-side recovery is still required.
POST /api/stop deliberately returns HTTP 200 with a typed JSON body from performStopTeardown(). That body can be { success: false, sharedTeardown: "performed" } when native Codex restore or Grok cleanup failed; the process then exits with code 1. stopProxyGracefully() currently discards the body and returns only whether the process exited. On the no-receipt path this PR therefore computes nativeRestoreHandledByProxy = true, includes it in restoreBlocked, and suppresses the caller restore precisely when the proxy reported that its teardown failed. The duplicate warning disappears, but native Codex or the Grok fence can remain pointed at a dead proxy.
Please carry a typed, bounded graceful-stop outcome through stopProxyGracefully() / stopProxy() (or an equivalent narrow seam) and skip caller restoration only after a valid response proves sharedTeardown === "performed" && success === true. A malformed/missing body or success:false must conservatively leave caller restoration enabled. Receipt-backed sharedTeardown:"deferred" and hard-kill fallback must also keep caller restoration enabled; HTTP 409 must remain a refusal with no escalation.
The new test is currently a source-string assertion only. Add behavioral coverage for at least:
- no receipt + performed/successful proxy teardown → no second caller restore;
- no receipt + performed/failed proxy teardown → caller restore runs;
- valid receipt + deferred teardown → caller restore runs;
- graceful request failure/hard kill → caller restore runs;
- 409 refusal → no forced stop or shared restore.
This head is also one commit behind current dev, remains Draft, and has the readiness checklist at 0/4 with no full exact-head CI. Once the result boundary is preserved, rebase and request current-head CI. The bug is worth fixing; the blocker is preventing a warning-only cleanup from turning into an unrecoverable skipped cleanup.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
리뷰 · 우선순위 58 / 80설명 이 PR은 graceful stop 뒤에 Codex restore 경고가 두 번 뜨는 문제를 고칩니다. 프록시가 공유 Codex/Grok teardown을 이미 했으면, 지금 HEAD의 stop 경로는 graceful 성공 후에도 호출자가 restore를 한 번 더 시도할 수 있습니다. 사용자는 같은 경고를 두 번 봅니다. 패치는 remote hub 직후 방향과 직접 맞닿지는 않지만, stop/update 수명은 운영자가 매일 만집니다. #3118 stop history taxonomy, #2888 restart-codex shim 등과 같은 수명 축입니다. types/config 분할 무관합니다. 점수는 58입니다. 실사용자 혼란은 있으나 라우팅/허브 구멍보다는 낮습니다. 라인 src/cli/index.ts 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
|
Landed via maintainer rebase #3187. Your commit was cherry-picked onto current dev with author credit preserved, no conflicts. Focused verification on the rebase head: grok-lifecycle, process-control-graceful and update-stop-first together report 54 pass, 0 fail. The Windows timing/ACL and spill-publication failures you saw in the full run are the known environment-dependent set, not yours. Good catch on preserving caller-side restore for deferred receipts and the hard-kill fallback — those are exactly the paths where the proxy never got to do the teardown, and a blanket skip would have traded one bug for a worse one. |
Summary
ocx stop,ocx update, and related lifecycle commands from attempting a second Codex resume-history restore when the proxy already restored it.Verification
bun test tests/grok-lifecycle.test.ts tests/process-control-graceful.test.ts(39 pass, 0 fail)bun test tests/update-stop-first.test.ts tests/update-*.test.ts(14 pass, 1 skip, 0 fail)bun run typecheckbun run privacy:scangit diff --checkbun run testwas also run; it exposed unrelated Windows timing/ACL and spill-publication failures in existingresponses-state, retained-root serialization, API-key, and management integration tests.Checklist
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.