[WRONG BRANCH] fix(codex): single-flight prompt text probes to avoid concurrent subprocess floods - #354
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 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. |
⏳ DRAFT
What to do
Its title has been prefixed with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4559b28013
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const probe = await Bun.file(new URL("../src/codex/prompt-text-probe.ts", import.meta.url)).text(); | ||
| expect(probe).toContain("let activeProbe: Promise<PromptTextProbe> | null = null;"); | ||
| expect(probe).toContain("if (activeProbe) return activeProbe;"); | ||
| expect(probe).toContain("if (activeProbe === probe) activeProbe = null;"); |
There was a problem hiding this comment.
Test the single-flight behavior, not source substrings
This test never invokes concurrent probes; it only searches the implementation text and does not even assert the crucial activeProbe = probe assignment. Removing that assignment would restore one subprocess per caller while every expectation here still passes, so the reported regression is not actually guarded. Add a controllable spawn/probe seam, start simultaneous calls, assert one underlying invocation, and verify that a new invocation is allowed after settlement.
AGENTS.md reference: AGENTS.md:L284-L286
Useful? React with 👍 / 👎.
Motivation
Description
activeProbeso concurrent calls toprobePromptTextshare one in-flight process-backed probe rather than spawning independent children (src/codex/prompt-text-probe.ts).performPromptTextProbeand makeprobePromptTextwrap it to set/clear theactiveProbeslot so the shared operation is cleared after success or failure (src/codex/prompt-text-probe.ts).MAX_PROBE_OUTPUT_BYTESand the timeout are unchanged).tests/codex-prompt-route.test.ts).Testing
bun run typecheckand it passed.bun scripts/test.ts tests/codex-prompt-route.test.ts tests/codex-prompt-text-probe.test.ts; the changed prompt-route and prompt-text-probe checks passed under the repository test runner (repo Bun v1.4.x).bun testinvocation using an older Bun (1.2.14) reported an unrelatednode:zlibmissing export (zstdDecompressSync) preventing that specific run; this is environment-specific and unrelated to the change.Codex Task