Repository navigation
Extract provider process supervision and stream reading from Codex - #24989
Conversation
bed0251 to
0b95df2
Compare
…ed reader resolveProviderChildEnv is now the only place that overlays and strips a provider's environment; the spawn spec and the request-scoped Codex session both call it. supervisedPosixLaunch only accepts a launch without env fields, so an override can no longer be silently ignored there. Edits to the shared stream reader or the env rule now run the real-binary Codex contract job.
Review summary (head
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (29)
💤 Files with no reviewable changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughThe change generalizes process launch, supervision, teardown, and record-reading utilities under provider-process APIs. Codex code adopts the shared APIs, and Claude and native-chat code update supervisor imports. Tests cover environment resolution, supervision, and teardown. CLI includes, CI path matching, timing entries, and the child-process import allowlist are updated. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The shared process utilities show no established behavior regression or merge-blocking risk. The change is ready to merge after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The inspected changes preserve existing command authority, environment filtering and process-cleanup behavior. No introduced security concern was identified. Risk remains low rather than minimal because broader exposure and runtime behavior were not fully verified. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 31.25% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 25 files. (3 skipped: 3 unsupported.)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
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 |
ELI5
Process supervision and stream reading for structured chat lived in the Codex folder even though Claude already shared the supervisor. Another provider would have to import Codex modules or copy them. This extraction has no user-visible change: existing Claude and Codex chats start, stream, and stop as before.
What Changed
src/main/provider-process/. Keep the existing Codex launch type as an alias for compatibility.resolveProviderChildEnv: start from the inherited environment, apply the launch's overrides, then remove the keys the launch asks to delete. Both the shared spawn function and Codex's short-lived request session (used for trust grants and session index repair) call it; the session's own copy of the rule is gone. Claude continues to supply its complete environment. Caller-supplied environments are copied, not changed.The inline supervisor script, process signals, grace periods, and stream pause/resume behavior are unchanged. Codex protocol handling and its per-request timeout remain in the Codex connection and session modules.
Why
Moving the working functions makes them reusable without a dependency on the Codex protocol. Keeping the environment rule in exactly one function means a new caller cannot lose overrides or keep a key it asked to remove, and a later change to the rule (for example, Windows' case-insensitive variable names) reaches every launch at once instead of missing a copy. A full lifecycle unification is a separate follow-up, #25204, because it must build on the child-close changes already in flight.
Linked Issue
Internal foundation work for structured chat through Agent Client Protocol; no separate issue.
Visual Proof
N/A — no UI or interaction change.
Testing
New tests pin the single environment rule directly (override, then delete, without changing the supplied objects) and through the spawn specification on Windows, macOS, and Linux. A type-level test fails to compile if the supervisor wrapper ever accepts a launch with environment overrides again. Teardown tests verify a non-Codex label reaches the Windows teardown and POSIX kill log, while retaining coverage for Codex's existing label.
What I verified / didn't
987fb5307f2on macOS, 165 tests passed across 17 explicit files: provider environment rule, provider supervisor unit and integration, provider teardown, Claude process spawn and exit-proof ladder and supervised-stop integration, Codex connection, session, model-catalog probe, account index repair, and teardown integration, the process-tree kill gate, structured session host teardown and recovery resolution, self-initiated tree-kill log, and continuous-integration path classification.stream-json/stream-chainmodules in unrelated files, because the local dependency install predates main adding those packages. CI typecheck on987fb5307f2is the authority and was still running when this was written.git diff --checkpassed.qoder-history-search-downgradefailure is excluded from acceptance; this PR does not change that test or its request parser.Review
Differences from the common pattern
The process ownership mechanisms remain different from the common pattern; the move does not claim to unify them.
Agent skill upstream boundary
Notes
Execution stays on the spawning runtime. No client wire format, persisted data, or workspace assumptions change. Folder workspaces retain the same launch-directory behavior.
Checklist
N/Awith reason987fb5307f2at time of writing); affected local tests pass; packaging remains covered by CI