refactor(core): simplify session input promotion#33443
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
session.next.prompt.admittedas the durable, client-visible record of pending Session inputsession.next.prompt.promotedevent with the existingsession.next.promptedevent when input becomes model-visiblePrompted, regenerate SDK/OpenAPI output, and reset disposable V2 state while preserving canonical V1 conversationsDesign
The event log retains both facts needed by servers and clients:
PromptAdmitted: the prompt was accepted and is pending; replay can rebuild the inbox and clients can display queued inputPrompted: the runner made that input model-visible; the projector marks the inbox row consumed and appends the user message in the same EventV2 transactionExecution ownership remains process-local. Future multi-server execution still requires an explicit lease, but accepted pending work remains replayable and projectable onto another database.
Verification
bun run test test/session-prompt.test.ts test/session-projector.test.ts test/session-create.test.ts test/session-runner.test.ts test/session-runner-recorded.test.ts test/database-migration.test.ts(145 passed)bun test test/cli/tui/data.test.tsx(7 passed)bun run typecheck(23/23 workspace tasks)bun run script/migration.ts --checkThe earlier full Core suite passed 1005/1006 tests. The unrelated macOS watcher test consistently received an
addevent for.git/HEADwhere it expectschange; the focused watcher rerun reproduced the same failure.