Repository navigation
refactor(ui): register session title targets explicitly - #176973
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs changes before merge. What this changesThis PR replaces automatic session-title discovery with producer-owned registration and cleanup. Example: A chat message references agent:main:research, titled Research plan.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete 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 Before merge
Findings
Agent review detailsHow this fits togetherControl 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]
Technical reviewBest 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:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c51d21c0d73e. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource +104, Tests +135. Total +239 across 12 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 19, 2026, 1:55 AM ET / 05:55 UTC. |
4ea903c to
4c94211
Compare
4c94211 to
61b3d5c
Compare
There was a problem hiding this comment.
💡 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".
| // Producers can mount before the app's lazy hovercard bootstrap has loaded. | ||
| const { promise: registrar, resolve: installSessionTitleRegistrar } = | ||
| Promise.withResolvers<SessionTitleRegistrar>(); |
There was a problem hiding this comment.
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 👍 / 👎.
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
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
onUpdatehook 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
untrackcalls for values that are already lifetime-stable.Evidence
pnpm tsgo:uipassed with the default tsrs checkernode scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.ui-components.json --incrementalpassed with default tsrs--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 39213012784MCP_CATALOG_LIST_LIMITSinsrc/agents/mcp-catalog-listing.ts; logs are byte-identical. No new findingpnpm ui:buildper side passed on the same machinenew 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 changedpnpm check:madge-import-cyclespasses with zero cyclesLint warnings: reactive accessors passed to plain renderer helpers at
app-sidebar-session-list-render.tsx:273andapp-sidebar-session-catalog-render.tsx:36,85,416. No suppressions were added.Refactor counts
Measured over the ten changed production files against
0b702b5508545fb70fa5b3c4e72930c3004f26ab:createEffectcreateRenderEffectuntrackaddEventListenerquerySelector(All)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:24synchronizes the shared foreign-DOM adapter;app-sidebar-session-list-render.tsx:226intentionally captures keyedinitialSectionId;markdown-dom-reconciler.ts:491queries only the owned Markdown fragment. The runtime'sMutationObserverat line 109 tracks the active foreign trigger lifetime, and itsrunWithOwnerat 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.
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
d0320310f87521ae30aa0c071039d7ef7aac9b95is 1,050,257 B and tested merge7aeb0e6c9ecac1034db669c328dd6624c2e3e541is 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.