Skip to content

fix(step-cli): limit new sessions while preserving active conversations - #9065

Merged
lidge-jun merged 3 commits into
lidge-jun:devfrom
luvs01:codex/step-cli-session-capacity
Nov 25, 2026
Merged

lidge-jun merged 3 commits into
lidge-jun:devfrom
luvs01:codex/step-cli-session-capacity

Conversation

@luvs01

@luvs01 luvs01 commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Bound the StepCode sessions owned by each OpenCodex home in a proxy process. When all eight slots are occupied, existing conversations continue to work. A new conversation receives the retryable step_cli_pool_full error until a slot becomes available. Opening and closing sessions count toward the limit, and a slot is released after cleanup is confirmed.

The cap applies even when retained conversations are idle but have not yet reached their idle timeout. No existing conversation is evicted to admit another one. The limit is separate from account or subscription quotas.

Verification

  • On Windows with Bun 1.4.4, bun test tests/adapters/step-cli-session.test.ts tests/adapters/step-cli-ownership.test.ts tests/adapters/step-cli-conversation.test.ts tests/adapters/step-cli-run-turn.test.ts passed all 80 tests with 203 assertions. The new case uses synthetic session children to check reuse, capacity during opening and closing, and admission after cleanup.
  • bun check --no-script --noEmit passed for 2,691 files. The structure and privacy checks and git diff --check passed.
  • The documentation build generated 820 pages. Checked the updated English and Spanish guides in the generated output.
  • Local coverage focused on the adapter and documentation. No provider account or live StepCode process was needed. The full local suite was not run.

Checklist

  • Scoped the change to StepCode session admission and its error classification.
  • Updated the provider contract and both user guides.
  • Independently reviewed slot lifetime, existing session reuse, and separation from quota errors. Maintainer review is requested.

Summary by CodeRabbit

  • New Features
    • Limited each OpenCodex home to eight StepCode sessions. Existing conversations remain available at capacity; new conversations can be retried when a slot opens.
    • Sessions count toward the limit until cleanup completes, including during the ten-minute idle shutdown period.
  • Documentation
    • Updated the English and Spanish guides and transport documentation with session capacity details.

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2530edc and 683581a.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The Step CLI session pool now limits each OpenCodex home to eight owned sessions. New conversation opens at capacity receive a retryable step_cli_pool_full refusal. Existing conversations remain available, and closing sessions count until cleanup completes.

Changes: Step CLI session capacity

Layer / File(s) Summary
Enforce and validate session capacity
src/adapters/step-cli/session-pool.ts, src/adapters/step-cli/errors.ts, tests/adapters/step-cli-session.test.ts, structure/providers/step-cli-transport.md, docs-site/src/content/docs/guides/step-cli.md, docs-site/src/content/docs/es/guides/step-cli.md
The session pool rejects new opens when eight sessions are owned. The error maps to a retryable 503 refusal. Tests cover reuse of existing conversations and capacity release after a closing child emits close. The transport and CLI guides document the limit and cleanup behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Possibly related PRs

Merge Risk: Minimal · previous review 4c0a3

This change limits each OpenCodex home to eight StepCode sessions. New conversations over the limit get a retryable step_cli_pool_full error, and existing conversations keep working. No concrete defect was found, and the capacity behavior and documentation are consistent. It looks safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(step-cli): limit new sessions while preserving active conversations" matches the main change. The changeset caps StepCode sessions per OpenCodex home at eight in session-pool.ts, return…
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.
Full details: Title check

Explanation

The title "fix(step-cli): limit new sessions while preserving active conversations" matches the main change. The changeset caps StepCode sessions per OpenCodex home at eight in session-pool.ts, returns step_cli_pool_full for new conversations at capacity, and keeps existing conversations reusable. The docs and tests cover the same behavior. The title is specific and concise, and it names the step-cli scope.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9e0e298 and 4c0a358.

Files selected for processing: 6

  • docs-site/src/content/docs/es/guides/step-cli.md
  • docs-site/src/content/docs/guides/step-cli.md
  • src/adapters/step-cli/errors.ts
  • src/adapters/step-cli/session-pool.ts
  • structure/providers/step-cli-transport.md
  • tests/adapters/step-cli-session.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Nov 23, 2026
@luvs01
luvs01 marked this pull request as ready for review November 23, 2026 02:51
@lidge-jun

Copy link
Copy Markdown
Owner

Maintainer integration into dev (MAINTAINERS.md, maintainer-integration path), under the coordinator's relaxed behind-dev gate.

  • Exact head: 683581ab5a0f6820623cbc72cace52340a7bc635.
  • PR checks passing on that head: enforce / enforce-target, ci, hygiene / hygiene, npm-global ubuntu-latest, docs site build, test changed, docker smoke, structure gate, gates, enforce / resolve-pr, label / label, storage policy, Catalog async contracts (ubuntu-latest), api usage, select windows runner, changes, validate-source. Skipped jobs are not counted as passing.
  • Relaxed gate: (a) 4 commits behind origin/dev c3aa113 (limit 10): PASS. (b) git merge-tree --write-tree c3aa113 683581a: clean. (c) dev commits since merge-base 8961476 touch none of this PR's files: yes; shared-class files dev touched: scripts/test-layout/layout-server-inbound.json tests/fixtures/test-layout-expected.json ; shared-class files this PR touches: none (guards below decide when both sides touch a class). (d) temporary local merge a7e2dea7b5d653423ec6deb64078032a21cb3ad7: bun run typecheck exit 0; bun test --timeout 60000 [focused: tests/adapters/step-cli-session.test.ts] [guards: tests/test-layout.test.ts tests/test-layout-tooling.test.ts tests/ci-workflows/file-size-ratchet.test.ts tests/ci-workflows/skill-ocx.test.ts]: 70 pass 0 fail exit 0; bun run structure:check exit 0: PASS.
  • Independent review (gpt-6.1-terra): APPROVE, no findings. The cap reserves capacity while opening and through cleanup and keeps existing and coalesced sessions working at capacity; the new capacity test fails against dev's session-pool.ts and passes here; six StepCode suites 107 pass.
  • scripts/ci/assert-mergeable-review.sh --maintainer-integration 9065: OK.

@lidge-jun
lidge-jun merged commit 927c3f3 into lidge-jun:dev Nov 25, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants