Skip to content

fix(ai): preserve transcript continuity across reconnect and retry - #7113

Open
zmuxuny wants to merge 4 commits into
apache:rocketmq-studiofrom
zmuxuny:fix/ai-attach-continuation-oct19
Open

zmuxuny wants to merge 4 commits into
apache:rocketmq-studiofrom
zmuxuny:fix/ai-attach-continuation-oct19

Conversation

@zmuxuny

@zmuxuny zmuxuny commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Fixes #7109
Fixes #7112
Fixes #7088

Brief Description

This consolidates #7113, #7115, and #7091 around one transcript-ownership lifecycle: a conversation's persisted prefix and live suffix must remain one answer until history successfully takes ownership, and none of that conversation's transient display state may leak into the next conversation.

  • Continue only the matching unfinished run. Coalesce adjacent Markdown/thinking and reconcile a live tool result with its persisted start, retaining the original arguments. Different runs, terminal history, and genuinely new tool starts remain separate; a continuation is not a new unread answer.
  • If the end-of-stream timeline refresh fails, retain the only live/optimistic copy. Retry completes that handoff only after a successful, still-current refresh, clearing duplicate live rows and only the reload error it actually recovered. Superseded retries, newer runs, navigation, and independent stream errors keep their own ownership.
  • Clear live and fallback speed measurements when departing a conversation so an unmeasured historical answer does not inherit another conversation's speed.

Original contributions and author attribution from all three PRs are retained. The additional integration regression exercises their common boundary: an attached split Markdown answer, failed final timeline refresh, and successful Retry must remain one answer across committed DOM changes. There are no backend, protocol, replay cursor, dependency, or unrelated UI changes.

How Did You Test This Change?

On the combined final tree:

  • npx vitest run src/pages/ai src/api/aiEvents.optionalFields.test.ts --pool=forks --maxWorkers=1: 23 files, 322 tests passed.
  • npx tsc -b: passed.
  • ESLint and Prettier checks on all 12 changed frontend files: passed.
  • git diff --check: passed.

This is the complete affected AI suite plus API terminal-bubble expectations, not a claim that every frontend or backend suite was run. Initial concurrent test attempts were resource-interrupted; the reported aggregate is the subsequent completed single-worker run.

Negative control: copied the final real routed AiPage test file unchanged into an independent worktree at base 127c47b06a268cc74224d5f34c56ec7c36ac0d55. Five selected regressions failed as expected: split attached Markdown, duplicated tool card, failed-refresh Retry leaving duplicate answers/error, cross-conversation speed attribution, and the combined attach/retry flow. No baseline production code was modified.

Controls retained include tool-id reuse, immutable prefix/suffix inputs, different/unknown run ownership, terminal history, unread/scroll behavior, repeated and failed retry, navigation/unmount/new-run supersession, independent stream errors, and same-conversation speed fallback.

Checklist

  • One bounded lifecycle change, preserving all three original regression sets
  • Original author attribution retained
  • Existing ASF headers retained; no new strings or dependencies
  • No backend or live-provider claims; frontend tests use controlled API responses
  • Backend architecture suite (mvn test), not run for this frontend-only change

AI assistance was used to investigate, consolidate, review, and validate this change. No live provider or cluster was contacted.

Production build: npm run build passed, including TypeScript, Vite production bundle, and license check (build.log).

@zmuxuny

zmuxuny commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

CI follow-up: 5523ddb fixes two strict expectations in aiEvents.optionalFields.test.ts that I missed when adding the assistant bubble's owning runId. Both fixtures already supply runId: 41; the expected assistant objects now retain it without weakening toStrictEqual or the absent-optional-field checks.

Expanded verification on the updated tree: all AI page tests plus ai.test.ts, aiConversations.test.ts, aiEvents.contract.test.ts and aiEvents.optionalFields.test.ts pass: 26 files, 371 tests. Changed-file ESLint, Prettier and git diff --check pass. The new upstream CI run is queued.

Absorb apache#7115 and apache#7091 into apache#7113, including combined retry recovery coverage.

Co-authored-by: Codex <codex@openai.com>
Signed-off-by: zmuxuny <xiahoumuxuan@gmail.com>
@zmuxuny zmuxuny changed the title fix(ai): join reattached answers with their persisted prefix fix(ai): preserve transcript continuity across reconnect and retry Oct 20, 2026
Reuse the five-line ConsumerPage timer isolation from commit
381c5c4, credited to pilichoumao's
apache#6521. Keep production polling, all existing
assertions, and independent automatic-refresh coverage unchanged.

Signed-off-by: zmuxuny <xiahoumuxuan@gmail.com>
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.

1 participant