Skip to content

Stabilize runtime prompt turns#222

Merged
dutifulbob merged 4 commits intomainfrom
fix/runtime-prompt-turns
Apr 6, 2026
Merged

Stabilize runtime prompt turns#222
dutifulbob merged 4 commits intomainfrom
fix/runtime-prompt-turns

Conversation

@osolmaz
Copy link
Copy Markdown
Member

@osolmaz osolmaz commented Apr 5, 2026

What

  • add a shared prompt-turn helper used by both the CLI session runtime and the embedded runtime manager
  • accept a prompt turn when a reply is observed in session updates even if the prompt RPC itself timed out
  • preserve the freshly created persistent client for the first turn so the first prompt does not force an unnecessary resume
  • add regression coverage for the late-reply timeout case

Why

Prompt execution was still keyed too tightly to the prompt RPC result. That left a gap where a reply could already exist in session state while the RPC path still timed out. The first turn on a freshly created persistent session could also fail because the runtime threw away the live client and immediately tried to resume the session.

Impact

This makes prompt handling more consistent across the CLI runtime and the embedded runtime API, and it closes the late-reply timeout case that was breaking downstream flows.

Validation

  • pnpm -s typecheck:tsc
  • pnpm -s build
  • pnpm -s build:test && node --test dist-test/test/runtime-manager.test.js --test-name-pattern 'streams runtime events and saves updated status|accepts a session reply even when the prompt RPC times out'

@blacksmith-sh

This comment has been minimized.

Copy link
Copy Markdown
Member Author

osolmaz commented Apr 6, 2026

Validation summary:

  • Shared prompt-turn handling now backs both the CLI session runtime and the embedded runtime manager.
  • Prompt turns are now session-authoritative on timeout: if a reply lands in session updates after the prompt RPC times out, the turn is salvaged instead of being forfeited.
  • Fresh persistent sessions now reuse the live client on the first turn instead of forcing an immediate resume path.
  • The earlier Blacksmith failure on integration: cancel yields cancelled stopReason without queue error was fixed in the latest head; current CI is green.

Validation run on current head 4f5091335ce28fe1381dc8bc92571206e380ee66:

  • pnpm -s typecheck:tsc -> pass
  • pnpm -s build -> pass
  • pnpm -s build:test && node --test dist-test/test/runtime-manager.test.js --test-name-pattern 'accepts a session reply even when the prompt RPC times out|waits for late reply chunks to settle before ending a salvaged turn|falls back when a kept-open persistent client is no longer reusable|streams runtime events and saves updated status' && node --test dist-test/test/integration.test.js --test-name-pattern 'integration: cancel yields cancelled stopReason without queue error' && node --test dist-test/test/runtime.test.js -> pass
  • codex review --base main -> rerun after the latest push; no explicit new P0/P1 findings surfaced after the addressed fixes

CI:

  • Build: pass
  • Conformance Smoke: pass
  • Format: pass
  • Lint: pass
  • Test: pass
  • Typecheck: pass
  • scope: pass
  • Docs: skipped

There are no open review threads on the PR at this head.

@dutifulbob dutifulbob marked this pull request as ready for review April 6, 2026 09:46
@dutifulbob dutifulbob merged commit a983e63 into main Apr 6, 2026
8 checks passed
@dutifulbob dutifulbob deleted the fix/runtime-prompt-turns branch April 6, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants