[WRONG BRANCH] fix(kiro): persist local terminal continuations - #399
[WRONG BRANCH] fix(kiro): persist local terminal continuations#399luvs01 wants to merge 1 commit into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
✅ Deterministic PR hygiene checks passed. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 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. Comment |
⏳ DRAFT
What to do
Its title has been prefixed with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1974ea9430
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const json = buildResponseJSON(terminalEvents, parsed._responseModelId ?? parsed.modelId, { | ||
| translatorBudget, | ||
| }); | ||
| rememberResponseState( |
There was a problem hiding this comment.
Preserve a replay anchor for empty local terminals
When a client sends previous_response_id together with the full history it already carries, this new snapshot cannot trigger the overlap skip: a local terminal has output: [], so rememberResponseState sets providerOutputStart equal to the end of the stored items, while expandPreviousResponseInput requires a matched provider-issued item after that boundary. It consequently prepends the stored history to the identical client history, and subsequent continuations can repeatedly inflate or corrupt the Kiro context. Preserve an authoritative replay anchor/terminal marker for this empty response, and cover a follow-up whose input includes the prior messages rather than only the delta.
Useful? React with 👍 / 👎.
Motivation
localTerminalshort-circuit returned a successful response ID without persisting continuation state, which caused follow-ups usingprevious_response_idto fail withKiro continuation state is missing.Description
onCompletedResponsecallback that callsrememberResponseState(...)so synthesized streaming terminals are stored like ordinary completions (src/server/responses/core.ts).rememberResponseState(...)before returning the JSON response so buffered local terminals also persist continuation state (src/server/responses/core.ts).Kiro local terminal continuationthat verifies both streaming and non-streaming local terminals emit aresp_...id and that a follow-upprevious_response_idexpands and forwards to Kiro as expected (tests/server-kiro-completion-e2e.test.ts).Testing
bun run typecheckwith no errors.bun test tests/server-kiro-completion-e2e.test.ts, which exercised the new continuation tests and passed (focused Kiro tests: 17 passing including the new continuation coverage).bun run privacy:scanwhich passed.Codex Task