openclaw - ✅(Solved) Fix Bug: bare /new can submit empty prompt after session reset [1 pull requests, 3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#73789Fetched 2026-04-29 06:15:10
View on GitHub
Comments
3
Participants
3
Timeline
7
Reactions
0
Author
Participants
Timeline (top)
commented ×3cross-referenced ×2mentioned ×1subscribed ×1

Bare /new (and likely bare /reset) can create a fresh session and then submit an empty prompt to the model. With openai-codex-responses this fails immediately with:

One of "input" or "previous_response_id" or 'prompt' or 'conversation_id' must be provided.

Error Message

The session transcript records an empty user message followed by an assistant error from the provider.

Root Cause

Bare /new (and likely bare /reset) can create a fresh session and then submit an empty prompt to the model. With openai-codex-responses this fails immediately with:

One of "input" or "previous_response_id" or 'prompt' or 'conversation_id' must be provided.

PR fix notes

PR #73930: fix(agents): fail fast when openai-codex Responses receives empty messages (#73820)

Description (problem / solution / changelog)

Fixes #73820.

Problem

`buildOpenAIResponsesParams` routes `openai-codex-responses` requests via top-level `instructions` (from `systemPrompt`) and assigns the converted messages array directly to `input`. With `context.messages: []` the resulting `input: []` reaches the Codex backend, which rejects it with:

One of "input" or "previous_response_id" or 'prompt' or 'conversation_id' must be provided.

That 400 closes the upstream socket before the streaming consumer classifies the failure, so callers see a 15-31s timeout instead of the underlying error. Reproduced in the wild via `active-memory`'s memory-flush bootstrap run (#73820, woodhouse-bot reporter).

Fix

Throw a local error before the request is sent when `isCodexResponses && messages.length === 0`, surfacing the actionable `must be provided` text immediately. Non-Codex Responses providers still allow empty `input[]` so the OpenAI Responses path is unchanged.

What changed

FileChange
`src/agents/openai-transport-stream.ts`6-line guard right after `convertResponsesMessages`
`src/agents/openai-transport-stream.test.ts`3 new regression tests + 1 minor test update
`CHANGELOG.md`Unreleased Fixes line

Tests

3 new regression tests:

  1. Throws when `isCodexResponses && messages: []` — exact error message via regex
  2. Does not throw when `isCodexResponses && messages: [user "ping"]` — happy path
  3. Does not throw when `non-codex && messages: []` — preserves OpenAI Responses contract

Plus 1 test fixup: pre-existing `"maps low reasoning to medium for Codex mini"` test had `messages: []`; now passes a single user "ping" to exercise reasoning-effort path without colliding with the new fail-fast.

``` pnpm vitest run src/agents/openai-transport-stream.test.ts → 93 passed (90 existing + 3 new, no regressions, +1 test fixup) ```

🦞 lobster-biscuit


Sign-Off: hclsys

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/agents/openai-transport-stream.test.ts (modified, +85/-1)
  • src/agents/openai-transport-stream.ts (modified, +15/-0)

Code Example

One of "input" or "previous_response_id" or 'prompt' or 'conversation_id' must be provided.

---

{
  "promptLen": 0,
  "messagesLen": 0,
  "messages": []
}

---

const transcriptBodyBase = isHeartbeat
  ? HEARTBEAT_TRANSCRIPT_PROMPT
  : isBareSessionReset
    ? softResetTail
    : hasUserBody
      ? baseBodyFinal
      : "[User sent media without caption]";

---

const transcriptBodyBase = isHeartbeat
  ? HEARTBEAT_TRANSCRIPT_PROMPT
  : isBareSessionReset
    ? (softResetTail ? softResetTail : baseBodyForPrompt)
    : hasUserBody
      ? baseBodyFinal
      : "[User sent media without caption]";
RAW_BUFFERClick to expand / collapse

Summary

Bare /new (and likely bare /reset) can create a fresh session and then submit an empty prompt to the model. With openai-codex-responses this fails immediately with:

One of "input" or "previous_response_id" or 'prompt' or 'conversation_id' must be provided.

Environment

  • OpenClaw: 2026.4.26
  • Provider/model: openai-codex/gpt-5.5 (openai-codex-responses)
  • Surface observed: Telegram group topic session
  • Runtime: gateway via Node 22 on Linux

Repro

  1. Have an existing Telegram topic/group-bound session.
  2. Send a bare /new command.
  3. Runtime creates a new session and starts the first turn.

Expected

The new session should receive the configured startup/reset prompt and reply normally.

Actual

The first model call is made with no user prompt/messages:

{
  "promptLen": 0,
  "messagesLen": 0,
  "messages": []
}

The session transcript records an empty user message followed by an assistant error from the provider.

Suspected cause

In the reply run path, isBareSessionReset correctly builds a non-empty reset/startup body, but the transcript prompt for a bare reset is derived from softResetTail:

const transcriptBodyBase = isHeartbeat
  ? HEARTBEAT_TRANSCRIPT_PROMPT
  : isBareSessionReset
    ? softResetTail
    : hasUserBody
      ? baseBodyFinal
      : "[User sent media without caption]";

For bare /new, softResetTail === "". Later, resolveRuntimeContextPromptParts() sees transcriptPrompt is empty while effectivePrompt contains the startup context, treats that content as runtime-only system context, and calls the session prompt with an empty prompt. Some providers reject that request.

Suggested fix

For bare reset/new with no tail, use the startup/reset body as the transcript prompt instead of "", e.g.:

const transcriptBodyBase = isHeartbeat
  ? HEARTBEAT_TRANSCRIPT_PROMPT
  : isBareSessionReset
    ? (softResetTail ? softResetTail : baseBodyForPrompt)
    : hasUserBody
      ? baseBodyFinal
      : "[User sent media without caption]";

This preserves the existing behavior for /new some note while ensuring bare /new submits a real prompt.

extent analysis

TL;DR

Update the transcriptBodyBase logic to use baseBodyForPrompt when softResetTail is empty for bare /new commands.

Guidance

  • Review the transcriptBodyBase assignment logic to ensure it handles the softResetTail empty case correctly for bare /new commands.
  • Verify that the baseBodyForPrompt variable contains the expected startup/reset prompt content.
  • Test the updated logic with bare /new commands to ensure the model receives a valid prompt.
  • Consider adding logging or debugging statements to monitor the transcriptBodyBase and effectivePrompt values for bare /new commands.

Example

const transcriptBodyBase = isHeartbeat
  ? HEARTBEAT_TRANSCRIPT_PROMPT
  : isBareSessionReset
    ? (softResetTail ? softResetTail : baseBodyForPrompt)
    : hasUserBody
      ? baseBodyFinal
      : "[User sent media without caption]";

Notes

This fix assumes that baseBodyForPrompt contains the correct startup/reset prompt content. If this is not the case, additional modifications may be necessary.

Recommendation

Apply the suggested fix to update the transcriptBodyBase logic, as it preserves the existing behavior for /new some note while ensuring bare /new submits a real prompt.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix Bug: bare /new can submit empty prompt after session reset [1 pull requests, 3 comments, 3 participants]