Skip to content

refactor(ui): replace MCP retirement host adapters with a factory - #174375

Merged
steipete merged 1 commit into
mainfrom
solid2/w-idiom-components-mcp-retirement-reviewed
Oct 16, 2026
Merged

steipete merged 1 commit into
mainfrom
solid2/w-idiom-components-mcp-retirement-reviewed

Conversation

@steipete

Copy link
Copy Markdown
Contributor

MCP App teardown retained a Lit-shaped class and fake requestUpdate hosts after its rendering callers moved to Solid. Replace it with createMcpAppUnmountGate(invalidate, afterCommit?), and cut over all five consumers in the same change. The gate retains plain synchronous state because routing and chat read retiring immediately after render().

The existing owner still keeps the old App connected while teardown is pending, coalesces intermediate replacements, and restarts surviving Apps only after the owning renderer commits. The factory also shares the identical retained-value/apply branch after teardown. No routes, tags, selectors, markup, styles, or lazy import boundaries change; no screenshot is needed for this behavior-preserving factory refactor.

Proof Result
pnpm tsgo:ui Passed
Three focused test files, once, --maxWorkers=1 36 tests passed; 31.66 s wrapper wall time (29.26 s Vitest)
Targeted oxlint and formatting Passed; existing warnings in unchanged router/files-panel code
Baseline and head pnpm ui:build Passed on the same machine
Strict performance checker, baseline/head Passed; no violations
Production pnpm deadcode:knip Passed in 1m 12.2s
Independent P0–P2 review Scoped-clean; no actionable findings
git diff --check Passed

Startup JS: 339,779 → 339,787 B gzip (+8 B), with 7 JS requests and 1 CSS request on both sides. Startup raw bytes remain 1,034,275 B, and each startup asset retains its raw length. No startup import edge was added. CSS remains 38,786 B gzip.

Metric across six production files Before After
LOC 2,355 2,349
Controller/host identifiers 10 2
createEffect references 9 9
untrack references 9 9
addEventListener references 5 5

Production delta: −6 LOC; test delta: 0 LOC. The two remaining host identifiers belong to separate transcript viewport/offset adapters and are outside the MCP retirement owner. The old class and fake-host constructor callers are gone. Existing test assertions remain intact, covering coalescing, rebound restart, retained siblings, root cleanup, and restart after the files-panel header commits.

Full UI CI (ci:full) is required because this shared owner serves router and chat lifetimes. No local E2E, parity suite, lease, dependency update, or full test suite was used.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T15:36:26.511297Z cbdcd48 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.

@steipete
steipete enabled auto-merge (squash) October 16, 2026 15:43
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR replaces the MCP App unmount class and fake host adapters with one synchronous factory across all five consumers.

Example: Close and reopen the Parts tray App while teardown is pending.

  • Before: The class retains the connected App and restarts it after the renderer commits.
  • After: The factory preserves the same retention and restart behavior.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A coherent, source-reviewed refactor with retained boundary tests; supplied behavioral validation is harness-based and full UI CI is unfinished.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; supplied validation covers the gate, Solid retirement, and files-panel boundaries with mocked App teardown, without claiming shipped-entry-point evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes
Reason: The maintainer-directed change removes obsolete host adapters across every consumer without adding another owner, configuration, or user-facing behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-directed refactor completes the factory cutover without an identified correctness regression; full UI CI remains pending and the context check fails on PR-body headings.

Priority: P3
Reviewed head: cbdcd48b120ac5c56282d6e605886deec923b54a

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI retirement gate receives render identities and departing DOM roots, awaits nested MCP App teardown, then permits the latest render and restarts surviving Apps after commit.

flowchart TD
  A[Router and chat renderers] --> B[Unmount gate factory]
  B --> C[Connected MCP App views]
  C --> D[Teardown settlement]
  D --> B
  B --> E[Latest renderer commit]
  E --> F[Restart surviving Apps]
Loading

Technical review

Best possible solution:

Retain this focused factory cutover with the existing synchronous lifecycle and post-commit restart contracts.

Do we have a high-confidence way to reproduce the issue?

No product bug is claimed; source comparison supports the stated behavior-preserving refactor, and no target code was executed during this review.

Is this the best way to solve the issue?

The factory is a small, complete replacement that removes fake hosts while retaining the existing owner and synchronous decisions.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5aec20581650.

Provenance checked

  • Connected teardown, coalescing, and surviving-view restart keeps the original intent (7d62a27: Keep outgoing Apps connected until bounded teardown finishes and restart only views surviving the parent commit.)
  • Lazy render and transcript geometry commit keeps the original intent (774d9e6: Advance DOM and row ownership together so late measurements cannot be assigned to replacement rows.)
  • Solid callers and retirement lifetime keeps the original intent (91fd61d: Preserve App identity and await retirement while moving rendering to Solid.)
  • Solid unmount test fixtures keeps the original intent (3be4118: Remove Lit fixtures while retaining observable DOM, teardown, rebound, and sibling assertions.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned introduction and complete cutover: The introduced diff removes the class, preserves synchronous state and the retiring getter, and updates every production consumer; repository reference searches found no remaining old-class caller. (ui/src/components/mcp-app-unmount.ts:30, cbdcd48b120a)
  • Preserved lifecycle contract: Pending renders retain their accepted value; teardown settlement invalidates once; the consolidated branch preserves retained-value selection and all three existing restart scheduling paths. (ui/src/components/mcp-app-unmount.ts:51, 5312db7cc5fd)
  • Feature history and original intent: fix(ui): teardown MCP Apps before unmount #111124 established connected teardown and surviving-view restart; fix(ui): prevent transcript overlap during MCP app teardown #125837 established atomic DOM and row-model commits; this PR preserves both contracts. (ui/src/components/mcp-app-unmount.ts:86, 7d62a277fffe)
  • Current-main context: The fetched main still has the class implementation; comparison with the introduction base shows no intervening changes to the seven touched paths. (ui/src/components/mcp-app-unmount.ts:30, 5aec20581650)
  • Validation and check attribution: The complete PR body reports 36 focused tests, types, lint, builds, performance checks, and dead-code validation. The failing context check explicitly requests authored problem and evidence headings; it reports no production defect. UI E2E checks remain in progress. (cbdcd48b120a)
  • Repository policy applied: Read root and UI instructions plus Solid and test-review guidance; the patch retains one synchronous owner, removes superseded adapters, and preserves behavioral assertions. No maintainer-notes directory or installed Solid cheatsheet is present; no dependency API changes require resolving that local documentation gap. (ui/AGENTS.md:1, cbdcd48b120a)

PR surface

Source -6, Tests 0. Total -6 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 51 57 -6
Tests 1 6 6 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 57 63 -6

Review metrics

Metric Value Why it matters
Production versus test delta Production +51/-57; tests +6/-6 The factory removes six production lines while retaining the existing test assertions.

Labels

Label changes:

  • add P3: Behavior-preserving internal cleanup with no demonstrated user-facing defect.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: Behavior-preserving internal cleanup with no demonstrated user-facing defect.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 16, 2026, 11:48 AM ET / 15:48 UTC.

@steipete
steipete merged commit fcc7003 into main Oct 16, 2026
101 of 102 checks passed
@steipete
steipete deleted the solid2/w-idiom-components-mcp-retirement-reviewed branch October 16, 2026 15:53
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

vincentkoc added a commit that referenced this pull request Oct 16, 2026
* commit '14e993fff3ecb84eb1d7c9724c4ceda235d797e4': (110 commits)
  fix(decisions): align accounting ratchet evidence
  feat(memory): activate PostgreSQL memory search and lifecycle (#174374)
  fix: join process shutdown and isolate runtime fixtures (#174359)
  refactor(ui): scope native gateway observation to Solid (#174367)
  refactor(ui): own canvas widget lifetime in Solid (#174370)
  perf(control-ui): keep agent avatar faces stable across agent publications (#174239)
  perf(models): release unused account catalog instructions (#174361)
  refactor(ui): own composer command menus in Solid stores (#174321)
  refactor(ui): separate sidebar filter state from view lifecycle (#174352)
  test(release): make artifact qualification deadlines deterministic
  fix(codex): preserve sandboxed process inspection and setup errors (#174284)
  fix(gateway): stop worker processes before draining their queues (#174312)
  refactor(agents): reuse prepared tool facts (#174349)
  test(gateway,plugins,ui): remove low-value tests (batch d174) (#174331)
  refactor(ui): replace MCP retirement host adapters with a factory (#174375)
  refactor(logging): remove redundant native success traces (#174330)
  refactor(test): remove dead control-plane fixture branches (#174377)
  refactor(mcp): remove test-only session runtime seams (#174347)
  feat(matrix): account-root state databases follow the selected engine (#174315)
  refactor(discord): collapse private interaction and factory seams (#174322)
  ...
vincentkoc added a commit that referenced this pull request Oct 16, 2026
* commit '14e993fff3ecb84eb1d7c9724c4ceda235d797e4': (110 commits)
  fix(decisions): align accounting ratchet evidence
  feat(memory): activate PostgreSQL memory search and lifecycle (#174374)
  fix: join process shutdown and isolate runtime fixtures (#174359)
  refactor(ui): scope native gateway observation to Solid (#174367)
  refactor(ui): own canvas widget lifetime in Solid (#174370)
  perf(control-ui): keep agent avatar faces stable across agent publications (#174239)
  perf(models): release unused account catalog instructions (#174361)
  refactor(ui): own composer command menus in Solid stores (#174321)
  refactor(ui): separate sidebar filter state from view lifecycle (#174352)
  test(release): make artifact qualification deadlines deterministic
  fix(codex): preserve sandboxed process inspection and setup errors (#174284)
  fix(gateway): stop worker processes before draining their queues (#174312)
  refactor(agents): reuse prepared tool facts (#174349)
  test(gateway,plugins,ui): remove low-value tests (batch d174) (#174331)
  refactor(ui): replace MCP retirement host adapters with a factory (#174375)
  refactor(logging): remove redundant native success traces (#174330)
  refactor(test): remove dead control-plane fixture branches (#174377)
  refactor(mcp): remove test-only session runtime seams (#174347)
  feat(matrix): account-root state databases follow the selected engine (#174315)
  refactor(discord): collapse private interaction and factory seams (#174322)
  ...
vincentkoc added a commit that referenced this pull request Oct 16, 2026
* commit '0c6c7ee5837ed93f6fb09ca58b280e76878c21f1': (109 commits)
  feat(memory): activate PostgreSQL memory search and lifecycle (#174374)
  fix: join process shutdown and isolate runtime fixtures (#174359)
  refactor(ui): scope native gateway observation to Solid (#174367)
  refactor(ui): own canvas widget lifetime in Solid (#174370)
  perf(control-ui): keep agent avatar faces stable across agent publications (#174239)
  perf(models): release unused account catalog instructions (#174361)
  refactor(ui): own composer command menus in Solid stores (#174321)
  refactor(ui): separate sidebar filter state from view lifecycle (#174352)
  test(release): make artifact qualification deadlines deterministic
  fix(codex): preserve sandboxed process inspection and setup errors (#174284)
  fix(gateway): stop worker processes before draining their queues (#174312)
  refactor(agents): reuse prepared tool facts (#174349)
  test(gateway,plugins,ui): remove low-value tests (batch d174) (#174331)
  refactor(ui): replace MCP retirement host adapters with a factory (#174375)
  refactor(logging): remove redundant native success traces (#174330)
  refactor(test): remove dead control-plane fixture branches (#174377)
  refactor(mcp): remove test-only session runtime seams (#174347)
  feat(matrix): account-root state databases follow the selected engine (#174315)
  refactor(discord): collapse private interaction and factory seams (#174322)
  refactor(feishu): reuse streaming merge in dispatcher tests (#174371)
  ...
vincentkoc added a commit that referenced this pull request Oct 16, 2026
* commit '14e993fff3ecb84eb1d7c9724c4ceda235d797e4': (110 commits)
  fix(decisions): align accounting ratchet evidence
  feat(memory): activate PostgreSQL memory search and lifecycle (#174374)
  fix: join process shutdown and isolate runtime fixtures (#174359)
  refactor(ui): scope native gateway observation to Solid (#174367)
  refactor(ui): own canvas widget lifetime in Solid (#174370)
  perf(control-ui): keep agent avatar faces stable across agent publications (#174239)
  perf(models): release unused account catalog instructions (#174361)
  refactor(ui): own composer command menus in Solid stores (#174321)
  refactor(ui): separate sidebar filter state from view lifecycle (#174352)
  test(release): make artifact qualification deadlines deterministic
  fix(codex): preserve sandboxed process inspection and setup errors (#174284)
  fix(gateway): stop worker processes before draining their queues (#174312)
  refactor(agents): reuse prepared tool facts (#174349)
  test(gateway,plugins,ui): remove low-value tests (batch d174) (#174331)
  refactor(ui): replace MCP retirement host adapters with a factory (#174375)
  refactor(logging): remove redundant native success traces (#174330)
  refactor(test): remove dead control-plane fixture branches (#174377)
  refactor(mcp): remove test-only session runtime seams (#174347)
  feat(matrix): account-root state databases follow the selected engine (#174315)
  refactor(discord): collapse private interaction and factory seams (#174322)
  ...
vincentkoc added a commit that referenced this pull request Oct 16, 2026
* commit '0c6c7ee5837ed93f6fb09ca58b280e76878c21f1': (109 commits)
  feat(memory): activate PostgreSQL memory search and lifecycle (#174374)
  fix: join process shutdown and isolate runtime fixtures (#174359)
  refactor(ui): scope native gateway observation to Solid (#174367)
  refactor(ui): own canvas widget lifetime in Solid (#174370)
  perf(control-ui): keep agent avatar faces stable across agent publications (#174239)
  perf(models): release unused account catalog instructions (#174361)
  refactor(ui): own composer command menus in Solid stores (#174321)
  refactor(ui): separate sidebar filter state from view lifecycle (#174352)
  test(release): make artifact qualification deadlines deterministic
  fix(codex): preserve sandboxed process inspection and setup errors (#174284)
  fix(gateway): stop worker processes before draining their queues (#174312)
  refactor(agents): reuse prepared tool facts (#174349)
  test(gateway,plugins,ui): remove low-value tests (batch d174) (#174331)
  refactor(ui): replace MCP retirement host adapters with a factory (#174375)
  refactor(logging): remove redundant native success traces (#174330)
  refactor(test): remove dead control-plane fixture branches (#174377)
  refactor(mcp): remove test-only session runtime seams (#174347)
  feat(matrix): account-root state databases follow the selected engine (#174315)
  refactor(discord): collapse private interaction and factory seams (#174322)
  refactor(feishu): reuse streaming merge in dispatcher tests (#174371)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui ci:full Keep ordinary native-locale CI selection on the next PR run. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant