Repository navigation
feat: handle lifecycle slash commands natively in Windows chat - #1036
Conversation
Handle exact /new, /reset, and /compact commands through lifecycle RPCs, preserve structured compaction boundaries, and retain safe compatibility behavior for older gateways. Co-authored-by: Copilot App <[email protected]> Copilot-Session: c41e789a-73e3-41ae-ac62-1ff5287599c0
Preserve explicit session selection and failed composer sends, retain live entries during authoritative reloads, widen compaction metrics, and clarify lifecycle timeout recovery. Co-authored-by: Copilot App <[email protected]> Copilot-Session: c41e789a-73e3-41ae-ac62-1ff5287599c0
Co-authored-by: Copilot App <[email protected]> Copilot-Session: c41e789a-73e3-41ae-ac62-1ff5287599c0
Co-authored-by: Copilot App <[email protected]> Copilot-Session: c41e789a-73e3-41ae-ac62-1ff5287599c0
Integrate openclaw#1040 demand-loaded history (LoadHistoryCoreAsync split, generation CTS, connection version guards) with PR openclaw#1036 authoritative reload path. Resolve provider conflicts preserving both connection-versioned history flights and authoritative reload pending queue. Address review findings: - Replace hardcoded 'New session' with localized Chat_PendingNewSessionTitle across all 5 locales (en-us, fr-fr, nl-nl, zh-cn, zh-tw) - Fix authoritative reload dropping valid live entries without OpenClawSeq when gateway clock skews behind local time: entries with no seq are now preserved since history coverage cannot be determined - Add post-timeout session list reconciliation for /new failures so user can see potentially-created sessions (protocol has no idempotency key; guidance message retained by design) - Add behavioral composer submission policy tests (reference equality, identity preservation, edit-during-send) - Add behavioral pending selection survival test for stale snapshots Co-authored-by: Copilot App <[email protected]> Copilot-Session: d2982ca8-bb56-4728-85bd-29542ce9d554
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: feat: handle lifecycle slash commands natively in Windows chat This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
The _authoritativeHistoryReloadPending flag was consumed in LoadHistoryCoreAsync's finally block without checking whether the completing request belonged to the current connection generation. A stale old-generation completion after disconnect/reconnect could consume the flag and trigger an unintended authoritative reload in the newer generation. Fix: - Only consume/schedule the pending authoritative reload when requestConnectionVersion == _historyConnectionVersion (same guard as _historyInFlight removal) - Clear _authoritativeHistoryReloadPending in AdvanceHistoryGenerationLocked so generation advances invalidate stale pending flags - Add deterministic regression test: StaleGenerationAuthoritativeReload_DoesNotReloadInNewGeneration Co-authored-by: Copilot App <[email protected]> Copilot-Session: d2982ca8-bb56-4728-85bd-29542ce9d554
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 4f0e93ff-d320-454d-b00a-865dac727d0c
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: feat: handle lifecycle slash commands natively in Windows chat This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Resolves a problem where users entering
/new,/reset, or/compactin the Windows chat surface would see those lifecycle commands sent as ordinary chat messages instead of receiving the native behavior and structured presentation available in other first-party clients (i.e., gateway-hosted web UI and Mac app).Why This Change Was Made
Exact, attachment-free lifecycle commands now use dedicated gateway RPCs while argument-bearing commands, attachments, and all other slash commands continue through
chat.send./newruns immediately without disturbing work in the source session,/resetconfirms before immediately clearing that session, and/compactis an ordered typed queue operation that never falls through tochat.send. The implementation safely supports older gateways when creating parallel sessions and reloads authoritative history after model-backed compaction.User Impact
Windows users can create, reset, and compact sessions without command or acknowledgement bubbles. Compaction boundaries are durable, localized, accessible timeline dividers. A queued
/compactwaits for active and earlier work, blocks later messages until completion, can be canceled while pending, and cannot deadlock the queue after failure. Newer composer edits and attachments survive awaited operations, and ambiguous/newtimeouts advise users to check the session list before retrying.Evidence
/compact, durable compaction-divider rendering after restart, safe/newcreation against an older gateway, and/resetcancellation preserving input.Before: compaction appeared as an ordinary chat exchange
Before this change, Windows sent
/compactthroughchat.send, so the commandand its acknowledgement appeared as chat bubbles rather than the structured
compaction event shown by the gateway web UI.
In this example,
/compactwas used twice in the web dashboard and once through the Windows app.After: compaction is a structured timeline event
Windows now invokes model-backed compaction directly, creates no command or
acknowledgement bubbles, and renders the durable structured boundary as an
accessible timeline divider. This now more closely models the behavior observed through
the gateway's web UI.
Here,
/compactwas invoked, and the compaction divider appears without rendering a chat bubble for the command.Video:
/newand/resetlifecycle behaviorThe recording shows
/newcreating and selecting a distinct empty session while preserving the original session and its history. It then demonstrates the/resetconfirmation flow: canceling preserves the command and transcript, while confirming clears the selected session after the gateway accepts the reset. Neither lifecycle command produces a command or acknowledgement bubble.new_reset.mp4
Change Type
Scope
winnodeValidation
.\build.ps1dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restoredotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restoreReal Behavior Proof
net10.0-windows10.0.22621.0\win-arm64.997a6a1f8b00a89f7f75e11ff734e1b277339ae0./compact,/new, and/resetcommands in a safe WinUI chat session and restarted the app after compaction to verify durable history rendering.chat.send, pending cancellation, failed compaction queue recovery, reset superseding an in-flight compaction, source-session preservation for/new, and composer revision/attachment preservation. Existing live proof shows the structured divider and lifecycle command UX./compactpreserves queue ordering and later work cannot race ahead of it.Yes/No/N/A): YesSecurity Impact
Yes/No): NoYes/No): NoYes/No): YesYes/No): NoYes/No): NoYes, explain the risk and mitigation: Exact lifecycle commands now invoke existing authenticatedsessions.create,sessions.reset, andsessions.compactgateway RPCs. Matching is deliberately restricted to exact, attachment-free commands; failures preserve local state and are surfaced visibly.Compatibility and Migration
Yes/No): YesYes/No): NoYes/No): NoOlder gateways that reject
succeedsParentare retried with an unlinked parallel-session request, preventing legacy parent rollover. Gateways withoutsessions.createshow a visible unsupported error and do not reset or mutate the current session as a fallback.Review Conversations