← Back to Pull requests

refactor(desktop): own Conversation publication and observation #5869

Closed
unknown closed this pull request without merging on Sep 30, 2026 12:24 UTC
View on GitHub
unknown unknown commented on Sep 30, 2026 06:29 UTC
Author

Summary

Refs #4582 — R2 M2 / C, based on d6876d708fdb8dc0bf35fd8e194ada4d69c92599 after #5850 and #5851.

AppShell currently owns transcript publication, observation resources and the messages threaded into its children. This moves those responsibilities into a persistent ConversationProvider and ConversationLifecycle. Actual transcript, pending-message, usage and approval readers subscribe below that owner. An ordinary durable-message update with unchanged chrome/pending/usage projections no longer renders Shell or Composer in the production-component harness.

  • Keep Catalog as the requested-selection authority. Publish Session, rows and range together; reject obsolete handoffs, seed completions and errors. Transcript open, seed/retry, publication and disposal share one lifecycle with injected Desktop services.

  • Replace root publication setters, range refs and the full Session UI controller with explicit target/chrome reads and semantic commands. Register both construction/observation owners and seal their private modules with the existing architecture checker.

  • Preserve the persistent Composer independently of conditional transcript mounting, live-to-durable handoff, shared-session identities and all retained live Turns. AppShell's stateful hook inventory decreases from 54 to 44 call sites (32 to 29 hook names).
  • Catalog readers filter rail-only bookkeeping while still observing status/profile changes. Reading-position failures retain their original localized action-failed copy and desktop diagnostic scope. Transcript read/refresh copy has one production source and direct tests; consumer Session refs are readonly, and unused bootstrap/ShellRun forwarding modules are removed.

    No intended product, visual, shortcut, IPC or storage change. The render evidence establishes notification isolation for the tested path, not elapsed-time or full-app performance gains.

    Verification

    Local checks passed with Node 24.19.0 / npm 11.19.0:

  • Desktop production build and all Desktop typechecks, including stories.

  • Desktop tests: 3,078 passed; UI tests: 694 passed.

  • Architecture/hook-gate tests: 147 passed; strict architecture check against upstream/main and AppShell hook gate passed.

  • Follow-up regression on 7fb2baaa3a236626451fc84772ae82dd36206916, after rebuilding: all 34 Electron tests passed (20 files, 3.7 minutes, one worker, no retries). This includes streaming/remount recovery, local-message persistence across renderer/application restart, unavailable live endpoint with cached history, history paging, references, draft focus, /compact, Workbar/Terminal/Side Chat lifetimes and WorkHub native window reconstruction.

  • Re-ran 49 focused owner/error-copy/bootstrap/ShellRun/reading-position tests against rebuilt output: all passed. Four new assertions first reproduced lifecycle render churn and incorrect restore copy on the pre-fix implementation, then passed after the fix; production read/refresh copy is covered in all three locales.

  • Lint, format, Desktop/UI scoped Knip, locale hygiene, ASF headers, Astryx and Windows inventories, and git diff --check passed.
  • New tests mount the production owner/readers and exercise notification isolation, persistent Composer and observer lifetimes, A→B→C handoff, stale results, seed-before-transcript ordering, retry and cleanup. The fake transcript rejects snapshots before its first batch, matching the Desktop adapter.

    Windows native interaction and real-account acceptance were not run locally.

    Integration and review focus

    The current assumptions remain Catalog-owned selection, the existing Main/preload Host observer, distinct requested/published/owner identities, and one Conversation workspace per renderer. See the feature README for public capabilities, retained transitional consumers and redesign triggers. Shared observation across surfaces or a relocated Host observer requires revisiting this lifecycle seam.

  • D / #5868: staging can remain under its persistent Composer owner. C wraps the existing Composer and transcript leaves, preserving D's inner readers. The second PR to land must rebase shared AppShell/public-entry/test changes and regenerate architecture/Astryx inventories from merged source. Readiness, revision/submission and delivery recovery are subsequent M3 work.

  • #5712: integrate bounded history through the injected transcript controller and private reading lifecycle. Do not restore a Shell-owned range controller. Invocation-time Copy/Save/revision reads still mean the published range; this PR does not implement full-history export or history-window redesign.
  • Review gates

  • Hosted CI passes on the updated PR head 7fb2baaa3a236626451fc84772ae82dd36206916. The previous implementation run passed on 7524313ab; it does not validate this follow-up commit.

  • Independent human review, including C/D integration and the publication/lifecycle boundary, is complete.
  • AI use

  • No generative tool made a substantive contribution

  • Generative tooling made a substantive contribution
  • Tool(s) and scope: OpenAI Codex implemented the refactor, tests and documentation and ran the local verification. The commit includes Generated-by: OpenAI Codex; retain it in the final squash commit. Final review and merge remain human decisions.

    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
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: hqhq1025 Review duration: 354m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #5869"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%
    Repository