Skip to content

fix(ui): release closed chat panes and refresh once on reconnect - #160079

Merged
steipete merged 2 commits into
mainfrom
codex/chat-lifecycle-cleanup
Sep 28, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/chat-lifecycle-cleanup

Conversation

@steipete

@steipete steipete commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Closing an active split chat could recreate the closed session in a hidden pane, retaining its live subscription; reconnecting could also load the same startup twice.

User Impact

Closed panes release their subscriptions, the surviving chat keeps its draft and identity, and a restored single pane has normal single-pane controls. No schema, stored-session-key, configuration, or protocol change is required.

Why This Change Was Made

Keep the survivor authoritative until navigation settles, reuse bounded release retries for subscriptions acquired after disposal, and let the existing connection startup own reconnect hydration. Drag handling moves into its existing indicator module so the page stays within its source-size budget, with real-event regression coverage for cleanup.

Related: #150153.

Evidence

Focused lifecycle, close-route, retained-session, page, and attachment-handoff tests pass. The original code fails the late-release/rollback and hidden-pane/singleton-control regressions. Native staged changed-file checks against the incorporated main commit pass, including UI types, fixture type graphs, lint, formatting, i18n, line limits and dead exports. Independent Codex autoreview found no actionable P0–P2 findings.

An isolated real Gateway and browser passed reconnect, draft preservation, one startup load, and late subscription release after an injected transient unsubscribe failure. The browser client and connection stayed unchanged during release, the closed pane remained detached, and the Gateway acknowledged subscribed: false. This is synthetic local live proof; no production deployment is claimed.

One-worker test command wall times: close-route 3.00s; retained sessions 2.33s; disposal 2.47s; history 1.93s; connection lifecycle 4.44s; page plus attachment siblings 3.92s. The first CI run exposed incomplete companion/catalog fixtures and teardown that outran lazy imports. The fixtures now use normal connection snapshots, catalog admission, explicit subscription replies, and joined imports; assertions remain intact. The missing CI shell-helper fixture is supplied by the existing main fix in #160024. Subsequent focused proof passed: companion 23.90s, page/attachment siblings 40.52s, and 22 affected CI fixture cases 38.67s. The other nine UI test files passed in the preceding 35.71s group, whose sole companion fixture failure was repaired and replayed. Initial failed CI UI shard: 92.45s; CI for the published head passed; ClawSweeper completed its review without findings. Production delta: +56 lines; the broader reduction campaign is accounted separately.

Before: a saved single pane incorrectly retains split-pane close controls.

Before: saved single pane with split-pane close controls

After: the same saved pane uses normal single-pane controls.

After: saved single pane with normal controls

@clawsweeper

clawsweeper Bot commented Sep 28, 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.

@steipete
steipete marked this pull request as ready for review September 28, 2026 03:55
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 3:25 AM ET / 07:25 UTC (Revision 2).

ClawSweeper review

What this changes

The Control UI releases closed chat panes and their message subscriptions, refreshes chat history once after reconnect, and restores single-pane controls.

Merge readiness

✅ Ready for maintainer review

Keep this PR open. Current main still has the reported pane and reconnect lifecycle behavior, while the branch provides a focused repair with meaningful regression coverage. I found no blocking introduced defect.

Priority: P1
Reviewed head: 50886a1b26d7777d332d56247e1868e619e5e5f6

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused repair has useful lifecycle regressions and inspected visual evidence, with no blocking introduced defect found.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The supplied repository state identifies a member author, so the external-contributor proof gate does not apply. Inspected before/after images show the single-pane controls; the body reports isolated browser and Gateway reconnect and unsubscribe observations without an attached request trace. The existing settings reader preserves ownerless saved singletons, and the new admission case exercises that existing-state path.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a member author, so the external-contributor proof gate does not apply. Inspected before/after images show the single-pane controls; the body reports isolated browser and Gateway reconnect and unsubscribe observations without an attached request trace. The existing settings reader preserves ownerless saved singletons, and the new admission case exercises that existing-state path.
Evidence reviewed 8 items Current main retains the reported paths: The fetched main and pinned PR base have identical blobs for the three changed production owners; the introduced diff shows the reconnect-specific refresh and one-shot stale release in those base blobs.
Introduced lifecycle repair: The pinned base-to-head diff adds bounded retries for late subscription release, retains the surviving pane until its route settles, and removes the extra reconnect refresh.
Route and reconnect regressions: The new close-route cases exercise a delayed route, pane detachment, survivor identity, and singleton controls; revised lifecycle cases assert one startup load and deferred secondary hydration.
Findings None None.
Security None None.

How this fits together

The Control UI turns chat routes and Gateway connection updates into visible conversation panes. Each pane displays history and holds a session-message subscription, while the page saves split-layout preferences.

flowchart LR
  A[Chat route] --> C[Chat page]
  B[Gateway connection] --> D[Pane lifecycle]
  C --> E[Pane layout]
  D --> F[History and subscriptions]
  E --> G[Visible chat panes]
  F --> G
  E --> H[Saved layout]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +56, Tests +416. Total +472 across 14 files.

View PR surface stats
Area Files Added Removed Net
Source 4 213 157 +56
Tests 10 618 202 +416
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 14 831 359 +472

Review metrics

Metric Value Why it matters
Production versus test growth production +56, tests +416 lines Production growth moves drag handling to its existing indicator owner and extends subscription cleanup; most added code exercises route and lifecycle regressions.

Technical review

Best possible solution:

Retain this owner-level repair and land it through the normal exact-head review and CI gates, preserving survivor identity and saved ownerless-pane admission.

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

Yes. Current-main source exposes the duplicate reconnect refresh and one-shot late-release paths; the PR reports baseline-failing focused regressions, which this read-only review did not execute.

Is this the best way to solve the issue?

Yes. The patch repairs pane and subscription lifecycle behavior in their existing Control UI owners without adding a configuration or protocol path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a61b5214bc83.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Closing a chat pane can retain a hidden live subscription, and reconnect can duplicate work in an active chat workflow.
  • merge-risk: 🚨 session-state: The patch changes surviving-pane route ownership and saved-layout clearing, where a wrong transition could affect chat selection or drafts.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies a member author, so the external-contributor proof gate does not apply. Inspected before/after images show the single-pane controls; the body reports isolated browser and Gateway reconnect and unsubscribe observations without an attached request trace. The existing settings reader preserves ownerless saved singletons, and the new admission case exercises that existing-state path.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The supplied repository state identifies a member author, so the external-contributor proof gate does not apply. Inspected before/after images show the single-pane controls; the body reports isolated browser and Gateway reconnect and unsubscribe observations without an attached request trace. The existing settings reader preserves ownerless saved singletons, and the new admission case exercises that existing-state path.

Evidence

What I checked:

  • Current main retains the reported paths: The fetched main and pinned PR base have identical blobs for the three changed production owners; the introduced diff shows the reconnect-specific refresh and one-shot stale release in those base blobs. (ui/src/pages/chat/chat-pane-context.ts:538, a61b5214bc83)
  • Introduced lifecycle repair: The pinned base-to-head diff adds bounded retries for late subscription release, retains the surviving pane until its route settles, and removes the extra reconnect refresh. (ui/src/pages/chat/chat-history-subscription.ts:75, 50886a1b26d7)
  • Route and reconnect regressions: The new close-route cases exercise a delayed route, pane detachment, survivor identity, and singleton controls; revised lifecycle cases assert one startup load and deferred secondary hydration. (ui/src/pages/chat/chat-page-close-route.test.ts:45, 50886a1b26d7)
  • Existing saved-layout contract: The settings reader already drops a bound singleton layout but preserves an ownerless global singleton; the PR exercises admission of that saved ownerless pane. (ui/src/pages/chat/split-layout-persistence.ts:112, 50886a1b26d7)
  • Inspected visual proof: The two prepared PR images visibly show a saved single pane with split controls before the change and normal single-pane controls afterward. The PR body separately reports an isolated browser and Gateway reconnect and unsubscribe result, without an attached request trace.
  • Prior review continuity: The completed review of the earlier head recorded no findings or rank-up moves. This review inspected the pinned current-head delta independently. (ceaba0083857)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • roboclaw-bot: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-28T04:02:29.360Z sha ceaba00 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 2632a5a into main Sep 28, 2026
107 of 108 checks passed
@steipete
steipete deleted the codex/chat-lifecycle-cleanup branch September 28, 2026 09:28
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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