Skip to content

fix(step-cli): require current user text to start a conversation - #9117

Open
luvs01 wants to merge 1 commit into
lidge-jun:devfrom
luvs01:codex/step-cli-input-before-session
Open

luvs01 wants to merge 1 commit into
lidge-jun:devfrom
luvs01:codex/step-cli-input-before-session

Conversation

@luvs01

@luvs01 luvs01 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A new StepCode conversation now requires nonblank user text in the current turn. Empty turns, replayed history alone and tool results without a conversation receive the existing invalid-input error before a new child is prepared.

A result for an existing conversation can still join its open or opening session. The existing conversation lock checks the held call and tool catalog before delivering the result. The eight-session limit and its error precedence are preserved.

Verification

  • Windows and Bun 1.4.4. Five focused StepCode suites covering turns, sessions, ownership, conversation ordering and tool results passed 87 tests during implementation. After adding the replay-boundary check, all 8 selected admission and continuation cases passed (42 assertions). Tests used mock StepCode children.
  • Verified the input error and zero session preparations, a current user message after restored history, matching results with and without user history, in-flight session reuse, and existing pool capacity.
  • Typecheck, structure checks, privacy scan and whitespace validation passed. The documentation build generated 820 pages and checked 126,324 internal links. The English and Spanish StepCode pages contain the updated guidance.
  • Local testing focused on StepCode because the Windows test runner is shared with other worktrees. The full repository suite is left to CI.

Checklist

  • Changes are scoped to StepCode session admission and its regression tests.
  • Updated the StepCode transport contract and English and Spanish provider guides.
  • Reviewed the existing session ownership and shutdown paths. The change introduces no credentials, headers or logging.

Summary by CodeRabbit

  • New Features
    • New StepCode conversations can now be started with non-empty user text. Tool-result-only turns can continue a matching call in an existing or opening conversation.
  • Bug Fixes
    • Turns without starting user text are now rejected when no conversation is available to continue, rather than opening a new conversation.
  • Documentation
    • Updated the StepCode guides in English and Spanish to clarify how user text, tool results, and existing conversations affect turn handling.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Step CLI adapter now requires starting user text to create a new session. A turn without that text can use an existing or opening session. If none is available, the adapter returns a 400 step_cli_no_user_text refusal. Tests and documentation describe these rules and tool-result continuations.

Changes: Step CLI conversation admission

Layer / File(s) Summary
Starting-text detection and session lookup
src/adapters/step-cli/projection.ts, src/adapters/step-cli/session-pool.ts, tests/adapters/step-cli-session.test.ts
hasStartingUserText checks for usable user text after the continuation boundary. The session pool returns an existing or opening session for an existing-only request, and returns undefined instead of opening a new session when none exists.
Adapter refusal and continuation behavior
src/adapters/step-cli/adapter.ts, tests/adapters/step-cli-run-turn.test.ts, docs-site/src/content/docs/guides/step-cli.md, docs-site/src/content/docs/es/guides/step-cli.md, structure/providers/step-cli-transport.md
The adapter returns a 400 step_cli_no_user_text refusal when no session is available. Tests cover rejected turns, restored history, and tool-result continuations. The documentation describes the starting-text and continuation rules.

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

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant runTurn
  participant hasStartingUserText
  participant StepSessionPool
  participant StepConversationHost
  runTurn->>hasStartingUserText: Check transcript for starting user text
  runTurn->>StepSessionPool: Open with existingOnly when text is absent
  alt Existing session or open is available
    StepSessionPool-->>runTurn: Return session
  else No session and existingOnly is true
    StepSessionPool-->>runTurn: Return undefined
    runTurn-->>runTurn: Return 400 step_cli_no_user_text refusal
  else Starting user text is present
    StepSessionPool->>StepConversationHost: Open a new session
    StepConversationHost-->>StepSessionPool: Return session
    StepSessionPool-->>runTurn: Return session
  end
Loading

Possibly related PRs

  • lidge-jun/opencodex#7267: Creates the Step CLI transport that routes Step Plan traffic through step --sdk-stdio; this change updates the same adapter and session-pool path.
  • lidge-jun/opencodex#9065: Adds the StepCode session-capacity limit; this change updates the session-admission path and tests its capacity behavior.
Merge Risk: Minimal · up to d90d1

Step CLI turns without starting user text can no longer open a new conversation and receive the existing 400 refusal instead. They can still resume an existing or opening conversation. No concrete defect was found, so the change is low risk 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): require current user text to start a conversation" matches the main change. The PR adds a hasStartingUserText check in projection.ts, passes existingOnly through runTurn and …
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): require current user text to start a conversation" matches the main change. The PR adds a hasStartingUserText check in projection.ts, passes existingOnly through runTurn and the session pool, and returns a 400 step_cli_no_user_text refusal when a turn has no starting user text. The docs and tests cover the same behavior. The title is specific, concise, and free of noise.

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 414faaf and d90d199.

Files selected for processing: 8

  • docs-site/src/content/docs/es/guides/step-cli.md
  • docs-site/src/content/docs/guides/step-cli.md
  • src/adapters/step-cli/adapter.ts
  • src/adapters/step-cli/projection.ts
  • src/adapters/step-cli/session-pool.ts
  • structure/providers/step-cli-transport.md
  • tests/adapters/step-cli-run-turn.test.ts
  • 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; 8 remain after this review.

@github-actions github-actions Bot added the bug Something isn't working label Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@luvs01
luvs01 marked this pull request as ready for review November 25, 2026 08:35

This branch has not been deployed

No deployments
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.

1 participant