Skip to content

fix(desktop): keep transcript lifecycle registry-owned - #3711

Open
Astro-Han wants to merge 1 commit into
apache:mainfrom
Astro-Han:fix/transcript-consumer-lifecycle
Open

fix(desktop): keep transcript lifecycle registry-owned#3711
Astro-Han wants to merge 1 commit into
apache:mainfrom
Astro-Han:fix/transcript-consumer-lifecycle

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • keep transcript consumers registered when a delivery send, acknowledgement, or capacity attempt fails
  • make the next delivery reset the existing consumer projection instead of silently detaching it
  • keep RuntimeHostSessionObservationRegistry as the sole transcript lifecycle authority and remove the Observer duplicate renderer-destruction listener

The production diff is +4 / -11. The earlier Renderer close/reopen retry has been removed; this repair adds no retry protocol, recovery state, or second consumer identity.

Root cause

RuntimeHostSessionObserver treated delivery work failure as consumer termination and removed the physical consumer from its indexes. RuntimeHostSessionObservationRegistry still retained the renderer logical registration because it owns continuity across Runtime Host replacement. Every later range request therefore passed the Registry and failed in the Observer with Desktop transcript consumer does not exist.

The diagnostic report cannot distinguish whether the original detach was triggered by a send failure, acknowledgement timeout, or delivery-capacity protection. All three entered the same silent-detach path.

Architecture

The lifecycle is now one-way:

  • the Registry owns whether the renderer transcript intent exists, including renderer destruction and Host replacement
  • the Observer owns bounded replica and delivery work, but a failed delivery is non-terminal; it marks the same consumer for a reset on the next attempt
  • the Renderer owns its materialized range and retains only its existing explicit user-facing reload action

This removes the conflicting Observer termination authority. Explicit close, renderer destruction, and Registry shutdown still release the consumer and idle Session normally.

Verification

  • RED: the new Observer regression failed on the old behavior with Desktop transcript consumer does not exist
  • node --test apps/desktop/dist/main/__tests__/runtime-host-session-observer.test.js apps/desktop/dist/main/__tests__/desktop-transcript-range-store.test.js — 51 passed
  • npm --workspace @maka/desktop run typecheck
  • npx biome check apps/desktop/src/main/runtime-host-session-observer.ts apps/desktop/src/main/__tests__/runtime-host-session-observer.test.ts
  • npm run check:asf-headers
  • real Electron fixture with temporary fault injection: forced a delivery failure, then observed the same consumer ID recover on the next transcript projection; no error toast or ErrorBoundary appeared. The probe, Electron window, fixture Runtime Host, installed Maka process, and residual Runtime Host were removed or stopped afterward.
  • full repository tests were not run locally

The previous CI failure was inherited from five missing ASF headers on the old base. #3708 fixed that baseline failure; this branch is rebased onto current green main and the new exact-head CI is running.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Codex diagnosed the lifecycle mismatch, performed the simplification audit, authored the Observer repair and regression coverage, and ran the focused automated and real-window verification. The commit includes the required Generated-by: Codex trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

@Astro-Han
Astro-Han marked this pull request as ready for review August 24, 2026 11:43
Keep a transcript consumer registered after delivery failures and request a reset instead of silently detaching it. This preserves the Registry as the sole lifecycle authority across Host replacement and removes the Observer's duplicate renderer-destruction listener.

Generated-by: Codex
@Astro-Han
Astro-Han force-pushed the fix/transcript-consumer-lifecycle branch from a1da22e to 52adc4e Compare August 24, 2026 18:10
@Astro-Han Astro-Han changed the title fix(desktop): recover detached transcript ranges fix(desktop): keep transcript lifecycle registry-owned Aug 24, 2026
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