← Back to Pull requests

refactor(desktop): move Composer staging into a persistent owner #5868

Closed
unknown closed this pull request without merging on Sep 30, 2026 17:14 UTC
View on GitHub
unknown unknown commented on Sep 30, 2026 06:01 UTC
Author

Summary

Refs #4582 — M3 / D, first slice.

Attachment, directory-reference and quote staging currently live in AppShell, so local staging updates invalidate the shell and send callbacks receive render-bound state. Move their controller into a persistent ComposerStagingProvider, with actual Composer, transcript annotation and session-reference readers below it. AppShell keeps only stable commands; the controller and context/binding modules are sealed by the architecture guards. The attachment service is injected through the Desktop adapter. The staging readers compose under the Conversation publication/observation owner introduced in #5869; transcript state remains private to that owner.

Submission captures the original draft before awaiting. Cleanup remains bound to that draft and directory Host. The public snapshot exposes only operations consumed in production; recovery can add restoration when its later slice defines that ownership. Accepted sends remove only captured quotes, preserving quotes added or edited during delivery; failed sends retain staging. The Composer input stays mounted across staging, section and Session changes. AppShell drops from 44 to 43 stateful hook calls and removes its staging-service bridge access.

Readiness, revision-draft state, send-pending state and delivery recovery remain later M3 slices. This preserves current-main revision/queue behavior; it does not implement the product changes in #5058 or #5274. Those open PRs overlap the submit/quote hooks and will need integration through the captured command boundary.

Verification

  • Desktop: 3,093/3,093, including 35/35 focused staging/revision/queue tests. Mutations that clear edited quotes, omit successful follow-up cleanup, or bypass revision-entry guards each fail a behavioral assertion; the restored implementation passes.

  • Production-owner tests cover ancestor/sibling render isolation, persistent editor-node identity, same-tick quote capture, original-draft/Host cleanup, edited-note retention, accepted/refused/failed sends through the production follow-up enqueue action, empty quotes, and invocation-time revision-entry guards.

  • Renderer architecture fixtures: 121/121; strict architecture comparison against d7dffca98c5b9f878ef9b71b4dcda4122e03f1c6 and AppShell hook gate pass.

  • npm run build, npm run typecheck, npm run lint, npm run format:check, Desktop/UI Knip, ASF headers, Astryx inventory and Windows inventory pass.

  • Earlier validation at 19d48183: UI 696/696 and full Storybook browser smoke: 441 stories / 481 theme renders, including all Slash Menu and Shared Session Guest play assertions; the mention-story fixtures mount the persistent staging owner. The existing runner retried product-workhub--retry-while-work-filtered after one failure under four-way concurrency; it passed alone. No retry policy or timeout was changed.

  • Real Electron regression: 3/3 isolated fake-backend journeys (directory reference remove/send/reload, cross-Session @ reference submission, and transcript pointer capture outside the native window). The directory chooser return is mocked; no manual OS dialog or real-model acceptance is claimed. No intended visual redesign.
  • AI use

  • No generative tool made a substantive contribution

  • Generative tooling made a substantive contribution
  • Tool(s) and scope: OpenAI Codex implemented this ownership migration, tests, documentation and validation under human direction. The commit includes Generated-by: OpenAI Codex. This PR awaits independent human review.

    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 — submission captures staging; successful cleanup preserves quotes added or edited while the send is pending, as described above.

  • No
  • Diff: 489 lines (+366 / -123) across 6 files Reviewer: hqhq1025 Review duration: 672m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.47) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 489 lines diff across 6 files
    0.47
    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.371
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #5868"
    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: 47.4% (MEDIUM) · Higher = larger blast radius
    47.4%
    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: 18.7% · Safe to merge
    18.7%
    Repository