Skip to content

[WRONG BRANCH] fix(kiro): persist local terminal continuations - #399

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-kiro-terminal-response-caching-issue
Draft

[WRONG BRANCH] fix(kiro): persist local terminal continuations#399
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-kiro-terminal-response-caching-issue

Conversation

@luvs01

@luvs01 luvs01 commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Prevent a regression where the localTerminal short-circuit returned a successful response ID without persisting continuation state, which caused follow-ups using previous_response_id to fail with Kiro continuation state is missing.

Description

  • For streaming local terminals, register an onCompletedResponse callback that calls rememberResponseState(...) so synthesized streaming terminals are stored like ordinary completions (src/server/responses/core.ts).
  • For non-streaming local terminals, call rememberResponseState(...) before returning the JSON response so buffered local terminals also persist continuation state (src/server/responses/core.ts).
  • Add an end-to-end regression test Kiro local terminal continuation that verifies both streaming and non-streaming local terminals emit a resp_... id and that a follow-up previous_response_id expands and forwards to Kiro as expected (tests/server-kiro-completion-e2e.test.ts).

Testing

  • Ran bun run typecheck with no errors.
  • Ran the focused Kiro E2E test file with 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).
  • Ran bun run privacy:scan which passed.
  • The full repository test run was not required for the focused fix; a full-suite run was attempted in the environment and produced unrelated baseline/time-sensitive failures outside the scope of this change, so the PR relies on the focused typecheck and focused test coverage above.

Codex Task

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-31T01:48:04.327424Z 1974ea9 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 31, 2026
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4a5e65ca-9293-4c54-be78-a7a1e8bb0da8


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

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot changed the title fix(kiro): persist local terminal continuations [WRONG BRANCH] fix(kiro): persist local terminal continuations Aug 31, 2026
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown

⏳ DRAFT

  • wrong target branch (main); retarget to dev.

What to do

  • Retarget this PR to dev — all contributions go to dev.

Its title has been prefixed with [WRONG BRANCH].
This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@github-actions
github-actions Bot marked this pull request as draft August 31, 2026 01:45

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant