test(codex): hold prompt-probe admission through document edits - #4014
test(codex): hold prompt-probe admission through document edits#4014luvs01 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe integration tests add deterministic synchronization for in-flight prompt probes. Tests 28–40 now verify that mutations return busy while the held probe preserves pre-edit content across multiple document-selection scenarios. ChangesPrompt probe race tests
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Prompt-probe mutation tests now deterministically hold in-flight probes while verifying busy responses and pre-edit content, replacing timer-based synchronization without changing production behavior. No merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
✅ Deterministic PR hygiene checks passed. |
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request has been marked Ready for Review. Hygiene✅ Deterministic PR hygiene checks passed. |
|
@coderabbitai review Please review head The final file passed 75 tests / 851 assertions on Windows with Bun 1.4.0. Full contributor CI is https://github.com/luvs01/opencodex/actions/runs/34210267444. Please also check that the helper observes request rejection immediately and releases/drains the original request without replacing a held-phase assertion error. |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base="7797586a8899c673eab48886a490e85b480c6d72"
head="50929c1008f382fa4f47edcc34ad4cabe24b8403"
git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
git diff --check "$base" "$head"
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
git diff --find-renames --unified=80 "$base" "$head"
changed_file="$(git diff --name-only "$base" "$head" | head -n 1)"
printf '\n--- AST outline: %s ---\n' "$changed_file"
ast-grep outline "$changed_file" --items all || true
printf '\n--- Barrier and request-related references ---\n'
rg -n -C 5 'closeBarrier|barrier|Promise\.withResolvers|requestError|requestPromise|finally|busy' "$changed_file"Length of output: 61718 🏁 Script executed: #!/bin/bash
set -euo pipefail
test_file="tests/codex-integration/codex-prompt-route.test.ts"
probe_file="src/codex/prompt-text-probe.ts"
printf '%s\n' '--- Helper with line numbers ---'
nl -ba "$test_file" | sed -n '145,178p'
printf '%s\n' '--- Held helper call sites ---'
rg -n -C 3 'withHeldPromptProbeClose\s*\(' "$test_file"
printf '%s\n' '--- Counts ---'
printf 'helper definitions: '
rg -n 'async function withHeldPromptProbeClose\s*\(' "$test_file" | wc -l
printf 'helper invocations excluding definition: '
rg -n 'withHeldPromptProbeClose\s*\(' "$test_file" | tail -n +2 | wc -l
printf 'timer fixtures in affected cases: '
sed -n '900,1320p' "$test_file" | rg -n 'setTimeout\s*\(' | wc -l
printf '%s\n' '--- Probe module outline ---'
ast-grep outline "$probe_file" --items all
printf '%s\n' '--- Close barrier definitions and use context ---'
rg -n -C 12 'setPromptTextProbeCloseBarrierForTests|closeBarrier|await.*Barrier|\.close\s*\(' "$probe_file"
printf '%s\n' '--- Changed cases: post-helper assertions ---'
nl -ba "$test_file" | sed -n '900,1335p'Length of output: 1446 🏁 Script executed: #!/bin/bash
set -euo pipefail
test_file="tests/codex-integration/codex-prompt-route.test.ts"
probe_file="src/codex/prompt-text-probe.ts"
printf '%s\n' '--- Helper source (lines 145-178) ---'
sed -n '145,178p' "$test_file"
printf '%s\n' '--- Helper call sites and nearby assertions ---'
rg -n -C 5 'withHeldPromptProbeClose\s*\(' "$test_file" || true
printf '%s\n' '--- Held-lifetime and timer counts ---'
printf 'helper occurrences: '
rg -n 'withHeldPromptProbeClose\s*\(' "$test_file" | wc -l
printf 'setTimeout occurrences in cases 28-40: '
sed -n '900,1320p' "$test_file" | rg -n 'setTimeout\s*\(' | wc -l
printf '%s\n' '--- Probe module outline ---'
ast-grep outline "$probe_file" --items all || true
printf '%s\n' '--- Close barrier lifecycle ---'
rg -n -C 14 'setPromptTextProbeCloseBarrierForTests|closeBarrier|await.*Barrier|close\s*\(' "$probe_file" || true
printf '%s\n' '--- Cases 28-40 source (lines 900-1320) ---'
sed -n '900,1320p' "$test_file"Length of output: 12482 🏁 Script executed: #!/bin/bash
set -euo pipefail
probe_file="src/codex/prompt-text-probe.ts"
test_file="tests/codex-integration/codex-prompt-route.test.ts"
printf '%s\n' '--- Probe module outline ---'
ast-grep outline "$probe_file" --items all || true
printf '%s\n' '--- Test-only close barrier declarations, setter, reset, and close lifecycle ---'
rg -n -C 20 'setPromptTextProbeCloseBarrierForTests|closeBarrier|resetPromptTextProbeForTests|child\.once\("close"|\.once\("close"' "$probe_file" || true
printf '%s\n' '--- Full relevant probe module ---'
sed -n '1,340p' "$probe_file"
printf '%s\n' '--- Remaining affected cases and timer-fixture check ---'
sed -n '1320,1500p' "$test_file"
if sed -n '900,1500p' "$test_file" | rg -n 'setTimeout\s*\('; then
exit 1
else
printf '%s\n' 'No setTimeout fixture remains in cases 28-40.'
fiLength of output: 26871
I found no correctness issues. Key checks completed:
I did not execute the Bun test suite in this sandbox. The static review supports the reported Windows test result. ✅ Action performedReview finished.
|
리뷰 · 우선순위 48 / 80이 PR은 prompt-document admission 테스트가 느린 부모에서 flake 나는 문제를 고친다. 테스트는 “probe가 아직 살아 있을 때 문서를 고치면 두 번째 요청이 busy”를 가정하는데, fixture child가 200ms 만에 끝나면 첫 probe가 이미 끝나 두 번째 요청이 새 텍스트를 돌려 실패한다. 지금 구체적 패턴은 주의할 점: held 구간에서 던진 에러도 finally가 release하도록 되어 있어 누수는 막는다. 라인 tests/codex-integration/codex-prompt-route.test.ts 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
* test(lib): make idle deadline reset timing deterministic Carried from #4041 (author luvs01) for maintainer-side CI and sequential integration. Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com> * test: stabilize Windows fixture waits and case cleanup Carried from #4015 (author luvs01) for maintainer-side CI and sequential integration. Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com> * test(codex): verify timeout termination without racing child timers Carried from #4012 (author luvs01) for maintainer-side CI and sequential integration. Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com> * test(codex): hold prompt-probe admission through document edits Carried from #4014 (author luvs01) for maintainer-side CI and sequential integration. Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com> * test(clients): bound transaction fixture child completion Carried from #4004 (author luvs01) for maintainer-side CI and sequential integration. Closes #4003 Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com> * fix(codex): retain overlapping multiline TOML terminators Carried from #4039 (author luvs01) for maintainer-side CI and sequential integration. Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com> * fix(cli): reject unsupported caps and report ignored legacy values Carried from #4043 (author luvs01) for maintainer-side CI and sequential integration. Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com> * fix(codex): share trigger-only delegation guidance with v1 Carried from #4034 (author luvs01) for maintainer-side CI and sequential integration. Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com> * fix(codex): preserve settings when journal injection hashes are missing Carried from #4006 (author luvs01) for maintainer-side CI and sequential integration. Closes #4005 Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com> * docs(cli): note that --injection still accepts none and minimal CodeRabbit review on #4049: the effort reference documents caps only, so the new rejection of none/minimal reads as a global removal. --injection keeps both values because it sets the injection effort rather than a cap. --------- Co-authored-by: t <a@b.com> Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>
|
Landed on Verification at the exact merged head Closing this PR because the change is already on |
Summary
Prompt-document admission tests assume a probe is still active when a child start marker appears, then change a file and expect a second request to return
busy. Their children exit after 200 ms. If the parent resumes later, the first probe can already have completed and the second request correctly returns fresh text, failing the test.Use the existing test-only close barrier to hold admission explicitly through each edit and busy assertion. Let fixture children write their output and exit immediately. Release the barrier and drain the original request in
finally, observing early request errors without overwriting the held-phase assertion error.The change is confined to cases 28–40 in one test file: 25 parameterized cases, 14 held request lifetimes, and 13 child timer fixtures. Case 31 gets a fresh barrier for each create/delete transition. Existing fingerprint, old/fresh text, spawn-count, marker-count, and decoy checks remain. Runtime behavior, cancellation tests, and actual timeout/size limits are unchanged.
Verification
50929c1008f382fa4f47edcc34ad4cabe24b8403, based ondev7797586a8899c673eab48886a490e85b480c6d72.ok: truewithnew-teaminstead of the expected busy response in the quoted-key/comment-after-bracket case.bun run test -- --timeout 60000 --parallel=1 tests/codex-integration/codex-prompt-route.test.ts: 75 tests / 851 assertions passed on the final candidate, including all 25 affected cases.git diff --checkpassed. Independent read-only review verified the preserved assertions, separate barriers for the two transitions, and release/drain/error handling.50929c100, including the six Windows shards and unsharded macOS control. CodeRabbit's same-head review found no correctness issues and verified the helper's release, drain, and error behavior.Checklist
Review readiness checklist