Skip to content

refactor(ui): colocate side-panel header actions with their slot - #125019

Merged
steipete merged 1 commit into
mainfrom
steipete/sidebar-panel-header-actions
Aug 17, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/sidebar-panel-header-actions

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

sidePanelHeaderActions() was the last place a chat side-panel slot's identity lived outside its
declaration. It built a second slot-keyed map — an external-link anchor for Discussion, a clear-thread
dropdown for Side chat — which chat-pane-render.ts passed to the sidebar region separately from the
templates. So after #124950 gave every slot one definition for availability, content, label, icon, and empty
state, a slot's header controls still came from a different function with its own parameter list.

Why This Change Was Made

This is step 2 of the series that makes one declaration per slot the single source of truth. Header actions
move onto SidebarPanelDefinition.headerAction, the region's panelActions map is derived by
sidebarPanelActions() exactly as sidebarPanelTemplates() derives content, and sidePanelHeaderActions()
plus its call site are deleted. The inputs those actions need (discussionOpenUrl, onClearCompanion,
connected, pendingQuestion) now thread through the one builder instead of a parallel signature.

While in the same file, the availability default options?.available ?? params !== undefined became a named
hasPaneContext with a comment. Whether a tab is offered at all is load-bearing enough that it should not
read as an incidental undefined-check. No behavior change.

User Impact

None. Same actions on the same panels, same markup, same gating.

Evidence

The jsdom region test previously built its panelActions by calling the production function, so it proved
two separate things: that production's Side chat action is a dropdown, and that the region does not hoist a
destructive control into the always-visible row. Deriving that map from the new definitions inside a jsdom
test is not cheap — the builder constructs every slot's content and needs a full ChatPageHost — so rather
than fake production's markup and quietly keep the old assertion text, the two guarantees were split to the
level where each is honest:

  • the unit test keeps the region contract (renamed accordingly, with a comment): given a panel's action,
    the region renders it and does not lift its destructive item into the always-visible row;
  • a new case in chat-sidebar-panel-contract.e2e.test.ts covers production markup against a real
    Control UI: Side chat's header action is wa-dropdown.chat-session-rail__menu, the action row has zero
    direct button children, and Discussion's action carries its external href.

That is stronger than what it replaces: the production-markup invariant is now asserted against the running
app instead of a jsdom fixture.

pnpm test ui/src/pages/chat/components/chat-sidebar-region.test.ts ui/src/e2e/chat-sidebar-panel-contract.e2e.test.ts
 Test Files  1 passed (1)      Tests  15 passed (15)
 Test Files  1 passed (1)      Tests   2 passed (2)

pnpm check:changed green; Codex autoreview clean.

reviewMetrics — production vs test LOC: production +76 / −65 (net +11), tests +39 / −8. The small
positive is two inline action templates becoming declarations; it buys the deletion of the last parallel
slot-keyed map in this file. Series running total remains net-negative in production (−17 from #124950).

No CHANGELOG.md edit — release-only per repo policy, and this step is behavior-neutral.

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Aug 17, 2026
@steipete
steipete marked this pull request as ready for review August 17, 2026 03:47
@clawsweeper clawsweeper Bot added 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. labels Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 1:41 AM ET / 05:41 UTC.

ClawSweeper review

What this changes

The PR moves Side chat and Discussion header controls into chat sidebar panel definitions and derives the sidebar header-action map from those definitions.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep this active maintainer-owned refactor open. The current main branch still uses a separate header-action map, while this head removes that duplicate ownership without changing the shared region’s active-panel behavior.

Priority: P3
Reviewed head: 95c331510a05b51009a6357b12138c5e9211a818

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A clean, focused owner-boundary refactor with browser-level contract coverage and no actionable correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This is a maintainer-authored behavior-preserving refactor; the added browser contract test exercises the rendered Control UI, but an external-contributor proof gate does not apply.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a maintainer-authored behavior-preserving refactor; the added browser contract test exercises the rendered Control UI, but an external-contributor proof gate does not apply.
Evidence reviewed 5 items Current-main behavior: Current main still constructs Side chat and Discussion header actions in a separate sidePanelHeaderActions map, outside the panel definitions.
Definition-owned action source: The PR adds optional header actions to each panel definition, retains the existing clear-menu gating and external-link safety attributes, and derives the action map from those definitions.
Caller and region boundary: ChatPane supplies the same connected state, pending question, clear callback, and Discussion URL to the definition builder, then passes its derived action map to the unchanged region contract, which renders only the active panel's action.
Findings None None.
Security None None.

How this fits together

The Control UI builds sidebar panel definitions from chat session state, then supplies panel content and active-panel controls to the shared sidebar region. The changed path preserves the Side chat clear menu and Discussion external-link action while making their panel declarations the source of truth.

flowchart LR
  State[Chat session state] --> Definitions[Panel definitions]
  Definitions --> Content[Panel content map]
  Definitions --> Actions[Header action map]
  Content --> Region[Shared sidebar region]
  Actions --> Region
  Region --> Controls[Active panel controls]
Loading

Before merge

  • Resolve merge risk (P1) - The supplied exact-head status still had two checks in progress; merge should wait for the final exact-head green result and GitHub merge gate.
Agent review details

Security

None.

PR surface

Source +11, Tests +31. Total +42 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 76 65 +11
Tests 2 39 8 +31
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 115 73 +42

Review metrics

Metric Value Why it matters
Production vs test LOC production +11 net (+76/-65); tests +31 net (+39/-8) The small production increase is justified by moving two existing action templates into the canonical panel declarations and deleting the parallel action-map construction.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land one definition-owned sidebar flow once exact-head checks are green, with content, availability, empty state, and header actions all derived from the same panel declarations.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land one definition-owned sidebar flow once exact-head checks are green, with content, availability, empty state, and header actions all derived from the same panel declarations.

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

Not applicable: this is a structural refactor, and the relevant question is preservation of existing sidebar controls rather than reproduction of a defect.

Is this the best way to solve the issue?

Yes. Deriving content and header actions from the same panel definitions removes the remaining parallel slot-keyed map while retaining the shared sidebar-region boundary.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P3: This is a tightly scoped, behavior-preserving Control UI refactor.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-authored behavior-preserving refactor; the added browser contract test exercises the rendered Control UI, but an external-contributor proof gate does not apply.

Evidence

What I checked:

Likely related people:

  • steipete: The supplied related-item history identifies steipete as author of the merged sidebar-definition refactor, and the current head continues that same owner-boundary consolidation. (role: feature owner and recent area contributor; confidence: high; commits: 07da6f6d6d4e, 95c331510a05; files: ui/src/pages/chat/chat-pane-embedded-panels.ts, ui/src/pages/chat/chat-pane-render.ts)

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-08-17T04:24:49.754Z sha e8f2bd2 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the steipete/sidebar-panel-header-actions branch from e8f2bd2 to 95c3315 Compare August 17, 2026 05:35
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 17, 2026
@steipete steipete self-assigned this Aug 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready verification for head 95c331510a05b51009a6357b12138c5e9211a818:

  • pnpm test ui/src/pages/chat/components/chat-sidebar-region.test.ts ui/src/e2e/chat-sidebar-panel-contract.e2e.test.ts ui/src/e2e/chat-session-diff.e2e.test.ts ui/src/e2e/terminal-open.e2e.test.ts passed: 15 UI unit tests and 12 Control UI E2E tests.
  • node scripts/watch-pr-ci.mjs 125019 95c331510a05b51009a6357b12138c5e9211a818 completed green against CI run 31998452233.
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main completed clean with no accepted/actionable findings.
  • scripts/pr review-validate-artifacts 125019 validated READY FOR /prepare-pr with zero findings, and OPENCLAW_TESTBOX=1 scripts/pr prepare-run 125019 passed in hosted_exact_or_recent_parent mode. No separate Testbox lease/run was needed because the exact-head hosted gate was current and green.
  • The latest ClawSweeper review reported no correctness findings. It listed no Rank-up moves: items; its sole before-merge item was exact-head CI plus the merge gate, now satisfied.

Proof gap: no before/after screenshot was captured because this refactor intentionally preserves rendered markup and behavior. The browser contract test exercises the real Control UI and verifies the production Side chat dropdown and Discussion external-link action shapes directly.

@steipete
steipete merged commit 3d1185f into main Aug 17, 2026
147 checks passed
@steipete
steipete deleted the steipete/sidebar-panel-header-actions branch August 17, 2026 05:51
@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 maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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