Skip to content

feat(macos): redesign chat window as native shell with sessions sidebar, toolbar pickers, slash commands, and context usage#101103

Merged
steipete merged 20 commits into
mainfrom
claude/zealous-tesla-84e8ed
Jul 7, 2026
Merged

feat(macos): redesign chat window as native shell with sessions sidebar, toolbar pickers, slash commands, and context usage#101103
steipete merged 20 commits into
mainfrom
claude/zealous-tesla-84e8ed

Conversation

@steipete

@steipete steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Closes #101086

What Problem This Solves

The native macOS chat window lagged far behind the web Control UI. It was a single fixed column in a bare NSWindow with a dated gradient background: sessions were only reachable through a cramped dropdown of raw routing keys (agent:main:main), session/thinking/model pickers were squeezed into a strip above the composer, and the surface had no slash-command autocomplete, no context-window/token/cost visibility, no message copy actions, no transcript export, and no compact/clear-history affordances. "New session" silently fell back to sessions.reset because the Mac transport never implemented sessions.create, so starting a fresh session actually wiped the current one.

Why This Change Was Made

Rebuilds the chat window as a native macOS shell (OpenClawChatWindowShell in OpenClawChatUI, macOS-only): a NavigationSplitView with a searchable sessions sidebar (pinned/recent sections, unread dots, relative timestamps, pin/copy-key/delete context menus, connection footer) and a unified toolbar carrying the context-usage ring (tokens/cost with a compact action), thinking picker, model picker (pinned/recent/all sections), and a session actions menu (new ⌘N, refresh ⌘R, copy session key, export transcript ⇧⌘E, compact, clear history with confirmation). The transcript uses clean chrome: assistant messages render as plain flowing text with an avatar, user messages in accent bubbles that follow the system accent (host override preserved for the seam color). The shared slash-command panel is enabled on macOS with full keyboard navigation (↑/↓/Tab/Return/Esc) routed through the composer NSTextView, and the Mac gateway transport now implements commands.list, sessions.create, sessions.patch, and sessions.delete. The compact menu-bar panel keeps the existing single-column presentation. Full web parity (split panes, checkpoints, workspace rail, thread search, in-window talk mode) is intentionally out of scope and tracked in #101086.

User Impact

macOS users get a first-class chat window: browse/search/switch/pin/delete sessions in a sidebar, create real new sessions, see context pressure and session cost at a glance, autocomplete slash commands with the keyboard, copy messages via right-click, export transcripts, and compact or clear a session from the toolbar — all in native window chrome with frame persistence. iOS behavior is unchanged aside from the slash panel no longer appearing for transports without a command catalog.

Evidence

  • swift test --parallel in apps/shared/OpenClawKit: 531 tests green (15 new: context-usage calculator, sidebar section/filter/display-name model, composer key routing). One pre-existing wall-clock-timeout test (definitive live-send rejection restores draft without queueing) flakes under heavy parallel host load and passes in isolation and on rerun.
  • swift test --parallel in apps/macos: 653 tests green (includes window/panel controller smoke tests running the new shell).
  • swift build --product OpenClaw release-style build green; OpenClawChatUI also built for generic/platform=iOS Simulator to prove the shared-package changes compile for iOS.
  • swiftlint (repo config) clean on touched files; swiftformat --lint clean for apps/macos/Sources and the new shared sources.
  • Live verification against a real gateway on macOS: session switching from the sidebar (title/subtitle/model/cost update per session), slash panel with gateway commands.list catalog, keyboard completion (/ → ↓ → Tab inserts /commands), context ring showing 9%/3% per session, connection footer, message context menu. Screenshots were captured during live verification; the Crabbox artifact broker is not configured on this host, so they are held locally rather than attached (available on request).

@openclaw-barnacle openclaw-barnacle Bot added app: macos App: macos size: XL maintainer Maintainer-authored PR labels Jul 6, 2026

@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: 8816ee1f8b

ℹ️ 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 thread apps/macos/Sources/OpenClaw/WebChatSwiftUI.swift Outdated
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Jul 6, 2026

@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: 53caf9c855

ℹ️ 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 thread apps/macos/Sources/OpenClaw/WebChatSwiftUI.swift Outdated
Comment thread apps/macos/Sources/OpenClaw/WebChatSwiftUI.swift Outdated

@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: 65182953ef

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

@clawsweeper

clawsweeper Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 6, 2026, 9:03 PM ET / 01:03 UTC.

Summary
The branch rebuilds the macOS chat window into a native split-view shell, adds Mac gateway session and command transport support, updates shared chat UI helpers/tests, and documents the new window.

PR surface: Docs +8, Other +2013. Total +2021 across 18 files.

Reproducibility: yes. for the review finding by source inspection: with active sessionKey == "global" and sessions containing both global and agent:ops:global, the exact lookup selects the literal row before alias-aware matching. The broader native UI behavior was not live-replayed because no inspectable exact-head macOS artifact is attached.

Review metrics: none identified.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #101086
Summary: This PR is the implementation candidate for the canonical macOS native chat redesign tracker, which remains open until a PR lands.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🦐 gold shrimp
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Fix selected-global active-row resolution for context usage, title, and model metadata.
  • Attach a redacted exact-head native macOS screenshot, recording, log, or linked artifact that shows session switching, slash commands, and context usage.
  • [P1] Rerun or resolve the remaining exact-head failing CI lane before merge.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR text reports live macOS gateway verification, but the current head has no inspectable screenshot, recording, terminal output, logs, or artifact showing the redesigned native window after the latest fixes; please attach redacted proof and update the PR body to trigger re-review, or ask a maintainer for @clawsweeper re-review if it does not rerun.

Risk before merge

  • [P1] Selected non-default global sessions can still show default-global context, title, or model metadata while actions target the selected agent.
  • [P1] The current head has no inspectable native macOS screenshot, recording, log, or artifact proving the redesigned real UI after the latest fixes.
  • [P1] Exact-head CI includes a failing Android third-party lane even though the Mac/iOS native lanes are green; this is not tied to a review finding but still needs normal pre-merge handling.

Maintainer options:

  1. Fix alias metadata before merge (recommended)
    Use the same selected-global alias preference for window title, model label, and context usage that the sidebar uses for selection.
  2. Accept temporary metadata drift
    Maintainers could intentionally land with the known default-global metadata risk and follow up immediately, but users may see one agent's metadata while mutating another.
  3. Pause for a narrower branch
    If the full shell remains too risky, pause this PR and split the session-state changes from the visual redesign.

Next step before merge

  • [P1] Human PR follow-up is needed because the external PR has an inspectable-proof gap and a product-scope maintainer label; automation should not repair while contributor proof remains missing.

Maintainer decision needed

  • Question: After the alias metadata bug and exact-head native proof gap are resolved, should maintainers accept this XL native macOS chat-shell scope as the landing shape for the linked redesign?
  • Rationale: The branch adds a broad user-facing native app surface under a protected maintainer label, so automation should not decide whether the full native shell or a narrower split is the permanent product direction.
  • Likely owner: steipete — They own the linked issue and candidate branch and have the strongest recent history on the Apple chat surfaces.
  • Options:
    • Accept full shell after blockers (recommended): Land the native split-view redesign once the metadata bug, visible proof gap, and CI state are resolved.
    • Split the parity work: Ask for smaller PRs that land sessions/create, slash commands, and context usage separately with focused proof.
    • Defer the redesign: Keep the linked issue as product backlog if maintainers do not want the native window to move this far from the compact panel yet.

Security
Cleared: No concrete security or supply-chain concern found; the diff does not change dependencies, workflows, secrets handling, or downloaded code execution paths.

Review findings

  • [P2] Prefer selected aliases for context usage metadata — apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatContextUsage.swift:74-77
  • [P2] Resolve toolbar title and model through the selected row — apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatWindowShell.swift:85-87
Review details

Best possible solution:

Resolve active-session metadata through one alias-preferred helper shared by the sidebar, title/model label, and context usage, then attach inspectable exact-head native macOS proof before maintainer scope approval.

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

Yes for the review finding by source inspection: with active sessionKey == "global" and sessions containing both global and agent:ops:global, the exact lookup selects the literal row before alias-aware matching. The broader native UI behavior was not live-replayed because no inspectable exact-head macOS artifact is attached.

Is this the best way to solve the issue?

No for the current patch state: the native-shell direction matches the linked issue, but the landing shape still needs one alias-aware active-session metadata fix and visible exact-head native proof. A shared active-session-entry resolver would be safer than repeating exact lookup plus fallback logic.

Full review comments:

  • [P2] Prefer selected aliases for context usage metadata — apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatContextUsage.swift:74-77
    When a selected non-default global session is active, sessions.list can contain both the literal default global row and agent:<active>:global. This exact-first lookup picks the default row before the alias-aware fallback, so the toolbar context ring/cost/model-window metadata can describe the wrong agent while actions are scoped to the selected one. Late discovery: this exact-first path was present after the 994e00e1ac0 review cycle, but the later sidebar alias fix made the mismatch clearer.
    Confidence: 0.9
    Late finding: first raised on code an earlier review cycle already covered.
  • [P2] Resolve toolbar title and model through the selected row — apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatWindowShell.swift:85-87
    The new window shell still looks up the active row by exact sessionKey, and currentModelLabel repeats the same pattern below. In the selected-global case where the sidebar now prefers agent:<active>:global, the title/model subtitle can still come from the default global row, making the visible toolbar disagree with the selected row and scoped actions. Late discovery: this lookup was visible in earlier reviewed heads, but it now conflicts with the selected-alias sidebar behavior.
    Confidence: 0.86
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.87

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add merge-risk: 🚨 session-state: The PR changes session creation, switching, deletion, reset, compact, metadata, and context display paths, and a remaining bug can mis-associate selected-global session metadata.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.

Label justifications:

  • P2: This is a substantial macOS app feature with real chat/session workflow impact but no emergency data-loss, security, or availability signal.
  • merge-risk: 🚨 session-state: The PR changes session creation, switching, deletion, reset, compact, metadata, and context display paths, and a remaining bug can mis-associate selected-global session metadata.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
Evidence reviewed

PR surface:

Docs +8, Other +2013. Total +2021 across 18 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 1 9 1 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 17 2194 181 +2013
Total 18 2203 182 +2021

What I checked:

Likely related people:

  • steipete: Opened the linked tracker and PR, is assigned on the PR, owns CODEOWNERS, and recently merged Apple session search and context usage work on the same shared chat and macOS surfaces. (role: recent area contributor and product proposer; confidence: high; commits: 91d4e8ed8e66, 4babbb2f6f3e; files: apps/macos/Sources/OpenClaw/WebChatSwiftUI.swift, apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel.swift, apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel+SessionKeys.swift)
  • Luke: Introduced the earlier macOS model selector and persisted thinking changes that this PR moves into the redesigned toolbar. (role: adjacent feature introducer; confidence: medium; commits: 061b8258bc35; files: apps/macos/Sources/OpenClaw/WebChatSwiftUI.swift, apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatComposer.swift, apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (8 earlier review cycles)
  • reviewed 2026-07-06T19:44:29.594Z sha 4e331b7 :: needs real behavior proof before merge. :: [P1] Scope Clear History to the selected global agent | [P1] Scope Compact Session to the selected global agent
  • reviewed 2026-07-06T21:08:57.493Z sha 4e331b7 :: needs real behavior proof before merge. :: [P1] Scope Clear History to the selected global agent | [P1] Scope Compact Session to the selected global agent
  • reviewed 2026-07-06T21:58:35.605Z sha 9a159ab :: needs real behavior proof before merge. :: [P1] Scope global history and subscriptions to the selected agent | [P1] Scope Clear History to the selected global agent | [P1] Scope Compact Session to the selected global agent
  • reviewed 2026-07-06T22:46:33.240Z sha 65cde39 :: needs real behavior proof before merge. :: [P1] Scope global history and subscriptions to the selected agent | [P1] Scope Clear History to the selected global agent | [P1] Scope Compact Session to the selected global agent
  • reviewed 2026-07-06T23:07:17.835Z sha 933f435 :: needs real behavior proof before merge. :: [P1] Scope global history and subscriptions to the selected agent | [P1] Scope Clear History to the selected global agent | [P1] Scope Compact Session to the selected global agent | [P1] Scope toolbar model patches to the selected global agent | [P2] Ignore stale session totals in context usage
  • reviewed 2026-07-06T23:39:23.975Z sha aaa26d9 :: needs real behavior proof before merge. :: [P2] Hide Delete for main and default global sessions
  • reviewed 2026-07-07T00:09:04.124Z sha aaa170f :: needs changes before merge. :: [P2] Use alias matching before treating deletes as inactive | [P2] Resolve context usage through alias-aware session lookup
  • reviewed 2026-07-07T00:25:28.132Z sha 994e00e :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jul 6, 2026
@steipete steipete closed this Jul 6, 2026
@steipete steipete reopened this Jul 6, 2026
@steipete
steipete force-pushed the claude/zealous-tesla-84e8ed branch from 4e331b7 to 9a159ab Compare July 6, 2026 21:32

@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: 9a159abff2

ℹ️ 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 thread apps/macos/Sources/OpenClaw/WebChatSwiftUI.swift
@steipete
steipete force-pushed the claude/zealous-tesla-84e8ed branch from 65cde39 to 933f435 Compare July 6, 2026 22:52

@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: 933f435e1d

ℹ️ 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 thread apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatContextUsage.swift Outdated
@steipete steipete self-assigned this Jul 6, 2026

@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: 575b37f3a5

ℹ️ 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 thread apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatWindowShell.swift Outdated
@steipete
steipete requested a review from a team as a code owner July 6, 2026 23:27
@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord channel: voice-call Channel integration: voice-call app: android App: android app: ios App: ios app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes scripts Repository scripts labels Jul 6, 2026
@steipete
steipete force-pushed the claude/zealous-tesla-84e8ed branch from 994e00e to e7440bd Compare July 7, 2026 00:39
@clawsweeper clawsweeper Bot removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 7, 2026
@blacksmith-sh

This comment has been minimized.

@clawsweeper clawsweeper Bot removed merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 7, 2026
@steipete
steipete force-pushed the claude/zealous-tesla-84e8ed branch from 41b4dd0 to fe62a2e Compare July 7, 2026 00:49
@steipete
steipete merged commit bb658d0 into main Jul 7, 2026
140 of 141 checks passed
@steipete

steipete commented Jul 7, 2026

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: macos App: macos docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS chat window: native redesign with sessions sidebar, toolbar pickers, slash commands, context usage

1 participant