Skip to content

fix(server): bound Codex session startup to release stalled commands - #11471

Open
Jolymmiles wants to merge 2 commits into
pingdotgg:mainfrom
Jolymmiles:fix/codex-startup-deadline
Open

fix(server): bound Codex session startup to release stalled commands#11471
Jolymmiles wants to merge 2 commits into
pingdotgg:mainfrom
Jolymmiles:fix/codex-startup-deadline

Conversation

@Jolymmiles

@Jolymmiles Jolymmiles commented Sep 12, 2026

Copy link
Copy Markdown

A Codex app-server that never finishes initialization or thread resume leaves startSession pending and holds the sequential provider command worker, so later sessions cannot start.

Bound Codex startup to 30 seconds and route the timeout through the existing failure cleanup. The runtime, session scope, and event consumer are released, and the caller receives an actionable error. A regression test verifies resource cleanup and that the next session starts successfully.

Validation:

  • The new regression test fails on the original code and passes with the fix.
  • All 53 CodexAdapter tests pass.
  • Server package typecheck and lint for both changed files pass.
  • The equivalent guard was verified against a stalled local peer and the installed server; a fresh live session completed successfully after restart.

Authored with OpenAI Codex (GPT-6).

Summary by CodeRabbit

  • Bug Fixes
    • Codex sessions that stall during startup now time out after 30 seconds instead of waiting indefinitely.
    • Failed session attempts now clean up associated resources and can be followed by a successful new session.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Sep 12, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at cd1375f

Macroscope's review found this PR approvable — This is a focused Codex startup bug fix that bounds stalled handshakes, invokes existing resource cleanup, and verifies that subsequent sessions can start. The normal startup path and product configuration remain unchanged.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: ed8596f6-5055-4fa4-978c-9f166c60a36a

📥 Commits

Reviewing files that changed from the base of the PR and between 03e1355 and cd1375f.

📒 Files selected for processing (2)
  • apps/server/src/provider/Layers/CodexAdapter.test.ts
  • apps/server/src/provider/Layers/CodexAdapter.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Codex session startup now fails after 30 seconds when the runtime handshake stalls. Error cleanup closes the runtime, session scope, and event fiber. A regression test verifies scope release and successful startup of a subsequent session.

Changes

Codex session lifecycle

Layer / File(s) Summary
Startup timeout and scope cleanup
apps/server/src/provider/Layers/CodexAdapter.ts, apps/server/src/provider/Layers/CodexAdapter.test.ts
startSession applies a 30-second timeout to runtime.start() and raises ProviderAdapterProcessError on timeout. The test verifies cleanup, failed-session removal, and successful startup and shutdown of a later session.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: t3dotgg

Merge Risk: ⚪ Minimal · up to 74888

Stalled Codex session startup is bounded and cleaned up, with regression coverage for recovery by a later session.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains what changed, why the change is needed, the cleanup behavior, regression coverage, and validation results. It does not use the template headings or an explicit checkli…
Title check ✅ Passed The title is concise and accurately describes the primary change: bounding Codex session startup to release stalled commands.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant