Skip to content

refactor(ui): register session title targets explicitly - #176973

Merged
steipete merged 3 commits into
mainfrom
solid2/w-zero-sidebar-links
Oct 19, 2026
Merged

steipete merged 3 commits into
mainfrom
solid2/w-zero-sidebar-links

Conversation

@steipete

@steipete steipete commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Session-link titles relied on document-wide mutation observation and provider subtree scans. Markdown and Solid producers now register their target and label nodes directly with the existing title owner, and release them with their own lifetime. Friendly titles, navigation, URL suffixes, lazy runtime loading, and batched lookups remain intact.

The Markdown reconciler owns discovery inside its foreign-DOM island and preserves decorated node identity while streaming. A provider-scoped title owner survives native bridge reconnects because the bridge retains caller-owned DOM; disconnect retires Gateway references and asynchronous work, while producer teardown releases the targets. Forwarded source labels use stable refs and keyed identity. The independent Markdown onUpdate hook in #176468 is not a prerequisite and is not included here.

A loader-free registration handoff lets producers mount before the existing lazy bootstrap arrives without importing its runtime. This breaks the import cycle found by the first CI run; the full import-cycle guard now reports zero cycles. The final runtime has zero effects and zero queries. Two adjacent sidebar renderer captures also stop using redundant untrack calls for values that are already lifetime-stable.

Evidence

Check Result
Production UI types pnpm tsgo:ui passed with the default tsrs checker
UI-component test types node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.ui-components.json --incremental passed with default tsrs
Focused tests, default pinned Bun Current reduction: 1 deferred-registration, 25 session-title, and 6 Markdown-link cases pass with --maxWorkers=1; unchanged forwarded-attribution cases passed on the prior head. All UI, mocked-Gateway, real-Gateway and browser-extension shards pass on current-head run 39213012784
Formatting and scoped lint Passed; four existing-style reactive-accessor warnings are recorded below
Production Knip Exact base and head both report only unused export MCP_CATALOG_LIST_LIMITS in src/agents/mcp-catalog-listing.ts; logs are byte-identical. No new finding
Before/head production builds One pnpm ui:build per side passed on the same machine
Strict startup performance 337,402 → 337,384 B gzip (−18 B), 7 JS requests; 1 → 1 CSS request, 38,500 B unchanged. Both strict runs fail only new boot JS gzip: 1,051,126 → 1,051,142 B against the existing 1,050,000 B limit. The 16 B New Session increase is the registration handoff needed to keep the runtime lazy and the dependency graph acyclic; no budget changed
Import graph Full pnpm check:madge-import-cycles passes with zero cycles
Isolated review Scoped-clean, no accepted/actionable P0–P2 findings; the initial review's provider-reconnect finding has a red/green regression
Browser proof Synthetic session links and forwarded source labels at 1440×960 and 390×844; before/after PNGs are byte-identical. Node runtime used for Playwright capture

Lint warnings: reactive accessors passed to plain renderer helpers at app-sidebar-session-list-render.tsx:273 and app-sidebar-session-catalog-render.tsx:36,85,416. No suppressions were added.

Refactor counts

Measured over the ten changed production files against 0b702b5508545fb70fa5b3c4e72930c3004f26ab:

Pattern Before After
createEffect 2 1
createRenderEffect 0 0
untrack 3 1
addEventListener 0 0
querySelector(All) 5 1
Mutation observers 3 1

Production LOC: 2,749 → 2,871. Test LOC: 970 → 1,129. The extra production code replaces implicit DOM observation with producer registration and release; the lookup/cache owner stays in place. Tests cover lazy registration, target removal, retained Markdown identity, native provider reconnection, and forwarded-label behavior.

Allowed survivors: markdown-dom-ref.ts:24 synchronizes the shared foreign-DOM adapter; app-sidebar-session-list-render.tsx:226 intentionally captures keyed initialSectionId; markdown-dom-reconciler.ts:491 queries only the owned Markdown fragment. The runtime's MutationObserver at line 109 tracks the active foreign trigger lifetime, and its runWithOwner at line 459 mounts the detached Solid portal.

Before and after

The attached before/after captures from the original candidate use the same synthetic Gateway scenario, desktop and mobile viewports, and screenshot helper. They are reused for the patch-identical rebase and the registration-only cycle and budget repairs, which changes no rendered markup. Both full-frame comparisons are byte-identical. The initial artifact-only capture attempt failed before browser startup because the temporary config omitted workspace aliases; the corrected harness reuses the shared Vitest resolution config. No product change was needed.

Before: desktop session titles

After: desktop session titles

Before: mobile session titles

After: mobile session titles

The prior replacement run 39209756241 passed every runtime UI shard but exposed a 46 B New Session budget crossing: CI measured 1,049,976 → 1,050,046 B. This revision removes the resolver wrapper, a duplicate deferred setup turn, and duplicate label initialization while preserving the foreign-origin code-link guard. Its same-machine base/head delta is now 16 B instead of the prior 70 B. Current-head CI 39213012784 passes all runtime shards. Its sole nonaggregate failure remains New Session boot gzip: actual CI base d0320310f87521ae30aa0c071039d7ef7aac9b95 is 1,050,257 B and tested merge 7aeb0e6c9ecac1034db669c328dd6624c2e3e541 is 1,050,313 B against the unchanged 1,050,000 B limit. Both exceed the same cap; the native inherited-failure route is used for this current-run overage. The earlier PR-only crossing is not waived. The retained CI merge has ordered base/head parents and exactly matches the independently reconstructed merge tree; its actual merged delta contains only the 14 intended paths.

Current head: 61b3d5cd015f27ccc2b803d34da79abf40f243b9. The three-file budget reduction has a fresh, full-context isolated review with no actionable P0–P2 findings.

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

clawsweeper Bot commented Oct 19, 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 19, 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-19T07:05:22.291269Z 61b3d5c New commits
ℹ️ 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 19, 2026 05:51
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR replaces automatic session-title discovery with producer-owned registration and cleanup.

Example: A chat message references agent:main:research, titled Research plan.

  • Before: A mutation observer discovers the link and replaces its raw key with Research plan.
  • After: The Markdown producer registers the link explicitly, preserving Research plan and its navigation.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful owner-backed refactor with inspected browser parity evidence, blocked by a source-verified dependency cycle.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after browser captures exercise the Control UI's rendered session links and forwarded labels with synthetic Gateway data at desktop and mobile sizes; committed tests additionally cover retained Markdown identity, provider remounts, and removal before asynchronous decoration completes.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Session titles must remain readable and navigable while streaming and renderer lifetimes change.
Reason: The maintainer-authored direction gives producers explicit lifecycle ownership while preserving the established resolver, cache, navigation, and lazy runtime.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep this PR open: the refactor has owner-backed value, but an introduced import cycle blocks the architecture check.

Priority: P3
Reviewed head: 4ea903c25b1e6fec187134ca93bfe94e37b548d0

Before merge

  • Break the new static cycle through the hovercard provider type (P2) - This import closes markdown-dom-ref → session-progress-hovercard-registration → session-progress-hovercard.runtime → session-hovercard-solid → session-progress-card-view → markdown-dom-ref. Although the registration-to-runtime import is type-only, check-madge-import-cycles.ts includes static type imports, so this PR introduces a cycle rejected by the required architecture check, which is failing on this head. Give registration a narrow provider contract independent of the runtime module and retain the dynamic runtime import.
  • Complete next step - Have the CI owner classify the remaining real-Gateway failures and reconcile the PR-context check with the current body; do not assign unrelated failures to this PR without attribution.

Findings

  • [P2] Break the new static cycle through the hovercard provider type — ui/src/components/markdown-dom-ref.ts:3
Agent review details

How this fits together

Control UI Markdown and forwarded-attribution producers supply DOM targets to the provider-scoped title owner, which resolves session identities and titles through the roster and Gateway.

flowchart LR
  A[Markdown producer] --> C[Target registration]
  B[Forwarded attribution] --> C
  C --> D[Session title owner]
  D --> E[Roster and Gateway]
  E --> D
  D --> F[Titled session links]
Loading

Technical review

Best possible solution:

Keep explicit producer registration and break the import cycle by giving the bootstrap a narrow provider contract independent of the runtime renderer.

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

Source inspection establishes both the previous observer-based discovery and the introduced static import cycle; the exact-head architecture annotation corroborates the latter.

Is this the best way to solve the issue?

Producer registration fits the existing ownership model and removes competing discovery paths, but the bootstrap must not depend on the renderer that consumes Markdown.

Full review comments:

  • [P2] Break the new static cycle through the hovercard provider type — ui/src/components/markdown-dom-ref.ts:3
    This import closes markdown-dom-ref → session-progress-hovercard-registration → session-progress-hovercard.runtime → session-hovercard-solid → session-progress-card-view → markdown-dom-ref. Although the registration-to-runtime import is type-only, check-madge-import-cycles.ts includes static type imports, so this PR introduces a cycle rejected by the required architecture check, which is failing on this head. Give registration a narrow provider contract independent of the runtime module and retain the dynamic runtime import.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm check:madge-import-cycles
  • pnpm tsgo:ui
  • pnpm test ui/src/components/session-link-titling.test.ts ui/src/components/markdown-session-links.test.ts ui/src/pages/chat/components/chat-message.forwarded-attribution.test.ts --maxWorkers=1
  • git diff --check

What I checked:

  • Introduced dependency cycle: The added Markdown ref import closes markdown-dom-ref → session-progress-hovercard-registration → session-progress-hovercard.runtime → session-hovercard-solid → session-progress-card-view → markdown-dom-ref; the registration-to-runtime edge is type-only. (ui/src/components/markdown-dom-ref.ts:3, 4ea903c25b1e)
  • Architecture failure corroborates source: The exact-head architecture check reports madge-import-cycles failed. Its scanner includes static type imports without excluding isTypeOnly, so the source-verified cycle violates this check. (scripts/check-madge-import-cycles.ts:23, 4ea903c25b1e)
  • Existing behavior and ownership: Fetched main still uses the host-scoped MutationObserver and subtree discovery; feature history traces session titling through progress-card integration, local URL support, unloaded-session resolution, and the Solid migration. (ui/src/components/session-link-titling.ts:87, c51d21c0d73e)
  • Browser evidence inspected: All four downloaded desktop/mobile screenshots were inspected. They show Shared plan and Research plan links plus the forwarded update label, with matching before/after appearance. (4ea903c25b1e)
  • Other required-check failures: Annotations report a session PR-reader timeout, a media replay reader dereferencing null, and a PR-context rejection despite the current body containing both required sections. These are not attributed to this diff; full job-log retrieval was blocked by the proxy's Azure storage allowlist. (4ea903c25b1e)
  • Related work remains distinct: refactor(chat): own transcript DOM and async lifetimes #176468 owns broader transcript lifetimes and an independent Markdown update hook; its body does not establish that this registration refactor is redundant.

PR surface

Source +104, Tests +135. Total +239 across 12 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 9 231 127 +104
Tests 3 159 24 +135
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 390 151 +239

Review metrics

Metric Value Why it matters
Production versus test LOC Production +231/-127; tests +159/-24 The net growth replaces implicit observation with explicit registration and release while retaining the existing lookup/cache owner; added tests exercise distinct teardown and reconnect boundaries.

Labels

Label changes:

  • add P3: This is a behavior-preserving ownership refactor without an established urgent user-facing incident.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P3: This is a behavior-preserving ownership refactor without an established urgent user-facing incident.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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 19, 2026, 1:55 AM ET / 05:55 UTC.

@steipete
steipete disabled auto-merge October 19, 2026 06:09
@steipete
steipete force-pushed the solid2/w-zero-sidebar-links branch from 4ea903c to 4c94211 Compare October 19, 2026 06:24
@steipete
steipete force-pushed the solid2/w-zero-sidebar-links branch from 4c94211 to 61b3d5c Compare October 19, 2026 06:58

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 61b3d5cd01

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +3 to +5
// Producers can mount before the app's lazy hovercard bootstrap has loaded.
const { promise: registrar, resolve: installSessionTitleRegistrar } =
Promise.withResolvers<SessionTitleRegistrar>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reduce production LOC before landing this refactor

Across the ten touched production files, this refactor grows from 2,749 to 2,871 lines (+122), despite the required Solid refactor checklist stating that production LOC must decrease. Please consolidate the new registration and lifecycle machinery or narrow the refactor until it is net-negative; otherwise this leaves a larger implementation for equivalent behavior and does not meet the repository's refactor acceptance rule.

AGENTS.md reference: ui/AGENTS.md:L3-L5

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 8a4fb92 into main Oct 19, 2026
101 of 106 checks passed
@steipete
steipete deleted the solid2/w-zero-sidebar-links branch October 19, 2026 07:26
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
)

* refactor(ui): register session title targets explicitly

* fix(ui): keep session title registration outside lazy runtime graph

* perf(ui): trim session title registration bootstrap
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. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant