Skip to content

Remember selected native chat session#950

Merged
shanselman merged 1 commit into
openclaw:mainfrom
TurboTheTurtle:fix/native-chat-last-session
Jul 9, 2026
Merged

Remember selected native chat session#950
shanselman merged 1 commit into
openclaw:mainfrom
TurboTheTurtle:fix/native-chat-last-session

Conversation

@TurboTheTurtle

@TurboTheTurtle TurboTheTurtle commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Closes #944.

Summary

  • Persists the user-selected native chat session from the channel dropdown.
  • Prefers the remembered session on remount when it still exists, and keeps it pending until sessions.list proves otherwise.
  • Cancels stale debounced last-state writes so an older default cannot overwrite an explicit selection.
  • Falls back to the main session when the saved selection disappears.

Validation

  • GitHub Actions passed on current head: repo-hygiene, test, setup/network/revocation E2E, win-x64 build, win-arm64 build, Socket, and CodeQL gate.
  • Focused provider tests pass for remembered selection, stale fallback, stale debounce overwrite prevention, models.list-before-sessions.list bootstrap ordering, and the main-session default regression.
  • Full macOS local build is blocked by the Windows-only build script and existing Windows-path assumptions in broader local suites.

Real behavior proof

  • Provider path exercised with session list reloads: selecting agent:main:review makes it the next snapshot default; removing that session reverts the default to agent:main:main.
  • Bootstrap ordering proof: with saved agent:main:review, a models.list snapshot before sessions.list keeps agent:main:review as the default, preserves it in memory, and keeps the delayed last-chat-state.json write on that session.
  • Persistence race proof: a pending debounced default save is armed, agent:main:review is selected, the debounce window elapses, and the persisted last-chat-state.json remains on agent:main:review.
  • Manual Windows UI launch was not available on this macOS host; Windows CI is the authoritative build/runtime signal.

@clawsweeper

clawsweeper Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 12:53 AM ET / 04:53 UTC.

Summary
The branch persists the selected native chat dropdown session in last-chat-state, restores it on remount while sessions are pending, cancels stale debounced saves, and adds provider regression tests.

Reproducibility: no. high-confidence live Windows reproduction was run in this read-only review. The linked issue at #944 plus current-main source inspection provide a credible source-level path: select a non-default native chat session, close/reopen the chat surface, and observe main/first-session fallback.

Review metrics: 2 noteworthy metrics.

  • Diff size: 3 files changed, +213/-14. The patch is focused but crosses provider persistence, UI selected state, and tray tests.
  • Provider regressions: 4 tests added. The new tests cover restore after reload, missing-session fallback, stale save cancellation, and models-before-sessions ordering.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #944
Summary: This PR is the candidate fix for the linked native chat selected-session persistence issue.

Members:

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

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

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

Rank-up moves:

  • [P1] Add current-head Windows native chat proof showing select a non-default session, close with X/to tray, reopen, and confirm the dropdown restores that session.
  • Redact private endpoints, tokens, session details, phone numbers, and other private data before posting proof.
  • Update the PR body after adding proof so ClawSweeper reruns automatically; if it does not, ask a maintainer to comment @clawsweeper re-review.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body provides provider/test scenario descriptions and says Windows UI launch was unavailable, so it still needs current-head real Windows native chat proof; screenshots, recording, terminal/live output, or redacted logs would count. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The real WinUI close-to-tray and reopen path is still unproven on this PR head, so provider tests alone do not show the dropdown restoring the selected session after an actual remount.
  • [P1] The PR changes persisted selected-conversation state; if the UI runtime path differs from the provider tests, merging could still restore or display the wrong conversation.

Maintainer options:

  1. Require Windows restore proof (recommended)
    Wait for current-head Windows native chat evidence showing a non-default selection survives close-to-tray/reopen and falls back when that session disappears.
  2. Accept provider-only confidence
    Maintainers could merge based on the focused provider tests, but would own the risk that the actual WinUI remount path still restores the wrong session.
  3. Pause until live proof exists
    Leave the PR open if no Windows environment can currently provide proof for this session-state behavior change.

Next step before merge

  • [P1] No ClawSweeper repair job is appropriate because the remaining blocker is contributor-supplied Windows real behavior proof, not a code change automation can safely make.

Security
Cleared: The diff is limited to local native chat state persistence and tray provider tests; no concrete security or supply-chain concern was found.

Review details

Best possible solution:

Land the focused persistence fix after current-head Windows native chat proof shows a non-default selection surviving close-to-tray/reopen and a removed saved session falling back correctly.

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

No high-confidence live Windows reproduction was run in this read-only review. The linked issue at #944 plus current-main source inspection provide a credible source-level path: select a non-default native chat session, close/reopen the chat surface, and observe main/first-session fallback.

Is this the best way to solve the issue?

Yes, the PR direction is the narrow maintainable fix: persist the explicit dropdown selection and keep it pending until sessions.list confirms whether it still exists. The remaining blocker is real Windows behavior proof, not a different code direction.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: The PR targets a normal-priority native chat session-state bug with a manual reselect workaround and limited blast radius.
  • merge-risk: 🚨 session-state: The PR changes how native chat persists and restores the selected conversation, and the real remount path is not yet proven.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body provides provider/test scenario descriptions and says Windows UI launch was unavailable, so it still needs current-head real Windows native chat proof; screenshots, recording, terminal/live output, or redacted logs would count. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

What I checked:

Likely related people:

  • shanselman: Blame ties the selected-state initialization and provider default-session resolver to commit 4166e0f, and PR metadata shows shanselman authored and merged the native chat landing PR that introduced this surface. (role: introduced behavior and recent merger; confidence: high; commits: 4166e0fd63f8, 365fdd358a1f; files: src/OpenClaw.Tray.WinUI/Chat/OpenClawChatRoot.cs, src/OpenClaw.Tray.WinUI/Chat/OpenClawChatDataProvider.cs)
  • calebeden: Recent merged chat PRs changed the same native chat provider/root/test surfaces around session and queued-message state. (role: recent area contributor; confidence: high; commits: f89a88a6baf4, c9b5476a873f, 02f2421a5e75; files: src/OpenClaw.Tray.WinUI/Chat/OpenClawChatRoot.cs, src/OpenClaw.Tray.WinUI/Chat/OpenClawChatDataProvider.cs, tests/OpenClaw.Tray.Tests/OpenClawChatDataProviderTests.cs)
  • steipete: PR metadata for the queued chat UI work shows steipete merged and committed adjacent hardening around the same provider and chat root surfaces. (role: adjacent merger; confidence: medium; commits: c9b5476a873f, a1601f23c80b, d36b6b27a123; files: src/OpenClaw.Tray.WinUI/Chat/OpenClawChatDataProvider.cs, src/OpenClaw.Tray.WinUI/Chat/OpenClawChatRoot.cs, tests/OpenClaw.Tray.Tests/OpenClawChatDataProviderTests.cs)
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 (6 earlier review cycles)
  • reviewed 2026-07-09T03:49:15.139Z sha 789f4cb :: needs real behavior proof before merge. :: [P2] Cancel stale chat-state timers on selection save
  • reviewed 2026-07-09T04:01:19.628Z sha 28f2269 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-09T04:06:48.464Z sha 28f2269 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-09T04:18:39.878Z sha 28f2269 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-09T04:25:24.816Z sha 28f2269 :: needs real behavior proof before merge. :: [P2] Preserve saved selection until sessions arrive
  • reviewed 2026-07-09T04:48:14.241Z sha e59459c :: needs real behavior proof 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 priority bug or improvement with limited blast radius. merge-risk: 🚨 session-state 🚨 Merging this PR could lose, corrupt, stale, or mis-associate session or agent state. labels Jul 9, 2026
@TurboTheTurtle TurboTheTurtle force-pushed the fix/native-chat-last-session branch from 789f4cb to 28f2269 Compare July 9, 2026 03:57
@TurboTheTurtle

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 9, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@TurboTheTurtle

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@TurboTheTurtle TurboTheTurtle force-pushed the fix/native-chat-last-session branch from 28f2269 to e59459c Compare July 9, 2026 04:44
@TurboTheTurtle

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 9, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@shanselman shanselman 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.

Reviewed with >90% confidence. Scope is small and focused; local focused chat/provider test run passed (223 tests); GitHub CI is green. The remembered-session logic is guarded against stale saved selections and stale debounced writes.

@shanselman shanselman merged commit c1bd9ae into openclaw:main Jul 9, 2026
14 checks passed
@danilovmy

Copy link
Copy Markdown

Volks, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 session-state 🚨 Merging this PR could lose, corrupt, stale, or mis-associate session or agent state. P2 Normal priority bug or improvement with limited blast radius. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

After close to tray and open again list of sessions ALWAYS set on middle of list and not on last chat.

3 participants