Skip to content

fix: keep workspace new chats local until the first send - #2336

Merged
bkudiess merged 4 commits into
openclaw:mainfrom
bkudiess:bkudiess-chat-verification-status
Nov 19, 2026
Merged

bkudiess merged 4 commits into
openclaw:mainfrom
bkudiess:bkudiess-chat-verification-status

Conversation

@bkudiess

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Starting a new chat in the main workspace creates a Gateway-backed session before the first message. Empty or abandoned drafts can therefore appear as unverified sessions and leave unused Gateway sessions behind, unlike the web flow.

User Impact

User impact: New workspace chats stay local until the first Send, so opening or abandoning a draft no longer creates a Gateway session. If a send outcome is uncertain before the session identity is known, the same retry is blocked to avoid duplicating a message; users can edit the message or start a fresh draft.

Why This Change Was Made

Draft placement and selected options remain local until Send. The first Send prepares the selected Gateway session, applies confirmed options, and promotes the draft only after Gateway acceptance. This change is scoped to the main workspace New Chat flow; the separate Companion mascot quick-chat flow is unchanged.

Evidence

The fixture UI scenario passed and verified that opening New Chat and navigating back and forward does not create Gateway sessions. A screenshot was captured locally. An independent read-only review confirmed the main workspace send path is gated on first Send; it did not cover the separate Companion flow or run tests. The inventory-bound interactive proof pool remains pending.

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Required proof pools

  • windows-winui-interactive: the main workspace New Chat UX changed. The local fixture test and screenshot passed, but the inventory-bound capacity-dependent pool run is not complete.

Validation

The required build and test suites passed locally and on the supplied native Windows SSH host. The focused fixture UI test passed 1/1. The interactive proof pool is still pending. The initial focused-test attempts failed before test execution because GitVersion's child process could not resolve dotnet from the curated PATH; reruns with explicit .NET and Git paths executed successfully.

  • .\build.ps1: passed; all five product builds succeeded. Documentation validation covered 74 Markdown files.
  • dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: local 5,912 passed, 29 skipped, 0 failed; Crabbox 5,913 passed, 28 skipped, 0 failed.
  • dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore --filter 'FullyQualifiedName!~SettingsManagerIsolationTests.OpenClawTrayDataDirRedirectsSettingsAwayFromRealAppData' --logger 'console;verbosity=minimal': local 6,853 passed, 0 skipped, 0 failed. The excluded test reads the real roaming-profile settings file. The remote Tray run also passed 6,853 with 0 skipped and the same test excluded.
  • dotnet test .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -r win-arm64 -p:Platform=ARM64 -p:DevBuild=false --filter 'FullyQualifiedName~GatewayFixtureUiTests.NewChatIsLocalAndBackForwardDoesNotCreateGatewaySessions' --logger 'console;verbosity=normal': 1 passed, 0 failed.
  • Crabbox: provider ssh, Windows normal mode, static host; run run_0455604d534ae5071098ab31a7b5f1a0; no run URL was returned. Tested source was HEAD a0a2a24ec1ddedf87ef26396ee4034661425e164 plus its dirty changes (tracked diff SHA-1 ebe5c044bcf2d48a7ae04fe805e112fe708ff9a1; untracked ChatDraft.cs SHA-256 B75953FE87E014603C6F3066332410CBDFAD0DEA5B7D28776B94608938AFE2C4), committed unchanged as b1abed08fc92b5c0f312ff430bbdba833a36964c.
  • git diff --check: passed; Git reported a non-fatal LF-to-CRLF warning for TestTimingPatternBaseline.json.

Real Behavior Proof

  • Environment tested: local Windows ARM64 app with the synthetic Gateway fixture and isolated test data.
  • PR head or commit tested: source at HEAD a0a2a24ec1ddedf87ef26396ee4034661425e164 plus the dirty candidate recorded above; committed unchanged as b1abed08fc92b5c0f312ff430bbdba833a36964c.
  • Exact steps or command run: dotnet test .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -r win-arm64 -p:Platform=ARM64 -p:DevBuild=false --filter 'FullyQualifiedName~GatewayFixtureUiTests.NewChatIsLocalAndBackForwardDoesNotCreateGatewaySessions' --logger 'console;verbosity=normal'.
  • Evidence after fix: the focused UI scenario passed and captured a screenshot locally; the fixture assertion verifies no Gateway session is created while opening and navigating the unsent draft.
  • Observed result: 1 passed; the session count remained unchanged until Send.
  • Screenshot or artifact links verified? (Yes/No/N/A): No; the screenshot remains a local artifact and is not linked here.
  • Not verified or blocked: the windows-winui-interactive inventory-bound pool and a live production Gateway run are not complete. The separate Companion mascot quick-chat behavior is unchanged.

Security Impact

  • New permissions or capabilities? (Yes/No): No
  • Secrets or tokens handling changed? (Yes/No): No
  • New or changed network calls? (Yes/No): Yes; the existing sessions.create call is deferred until first Send in the main workspace flow. No new endpoint or permission scope is added.
  • Command or tool execution surface changed? (Yes/No): No
  • Data access scope changed? (Yes/No): No
  • If any answer is Yes, explain the risk and mitigation: session creation and option updates are response-confirmed; uncertain outcomes are kept from blind replay.

Compatibility and Migration

  • Backward compatible? (Yes/No): Yes
  • Config or environment changes? (Yes/No): No
  • Migration needed? (Yes/No): No
  • If yes, list the exact upgrade steps:

Review Conversations

  • I replied to or resolved every bot review conversation addressed by this PR.
  • I left unresolved only conversations that still need maintainer judgment.

@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🦞👀
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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 19, 2026
@bkudiess
bkudiess marked this pull request as ready for review November 19, 2026 05:51
@clawsweeper clawsweeper Bot added 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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 19, 2026
@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This PR keeps new workspace chats local until Send and promotes them after Gateway acceptance.

Example: Select assistant main, open New Chat, then navigate Back without sending.

  • Before: Opening New Chat creates an unused Gateway session.
  • After: The draft remains local and creates no Gateway session.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The source and regression coverage support the repair, but the supplied artifacts do not establish the changed user flow.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Opening or abandoning a new workspace chat leaves an unused Gateway session and can show unverified placement before the user sends anything.
Reason: The maintainer-authored direction has clear user value, preserves explicit forks and the separate Companion flow, and adds no configuration option.

Merge readiness

✅ Ready for maintainer review

Keep open: main still creates sessions eagerly, and this maintainer-authored PR addresses that behavior. The previous recovery-copy finding is fixed; no new actionable code defect was established.

Priority: P2
Reviewed head: 29ab3dc4626bb1d251115c5de5ffbae0e0cb1a4f

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Inspectable evidence is still needed for no creation before Send, successful first-send promotion and visible uncertain-creation recovery; the supplied results also do not show a failing base run.
Agent review details

How this fits together

Workspace navigation selects a local draft; the composer coordinates placement, confirmed options and sending through the existing authenticated Gateway client, then updates conversation identity and navigation history.

flowchart LR
  A[Workspace New Chat] --> B[Local draft]
  B --> C[Composer first send]
  C --> D[Placement and options]
  D --> E[Authenticated Gateway]
  E --> F[Acceptance receipt]
  F --> G[Conversation and navigation promotion]
Loading

Technical review

Best possible solution:

Retain local draft intent in the existing chat owners, defer Gateway mutations until Send, and promote navigation identity only after acceptance.

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

Main's NewSessionAsync visibly invokes session creation before any message; opening New Chat and abandoning it follows that path, though this review did not execute the app.

Is this the best way to solve the issue?

The invariant is that opening a draft performs no Gateway mutation and acceptance binds one conversation identity; the patch uses the existing page, composer, placement and provider owners, and the simplification review found no clearly unnecessary production layer.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8ffe470e7d50.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Barbara Kudiess: Raw commit 4ea07e8 adds src/OpenClaw.Shared/WebSocketClientBase.cs:883 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4ea07e858b81; files: src/OpenClaw.Shared/WebSocketClientBase.cs)
  • Karen: Raw commit 61979d6 adds src/OpenClaw.Shared/Sessions/ChatPlacement.cs:79 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 61979d6170a0; files: src/OpenClaw.Shared/Sessions/ChatPlacement.cs)
  • Scott Hanselman: Raw commit a51029e adds src/OpenClaw.Shared/WebSocketClientBase.cs:680 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: a51029ef6f77; files: src/OpenClaw.Shared/WebSocketClientBase.cs)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production and test growth Production +2,616/-249 lines; tests +3,574/-143 lines The substantial growth covers draft lifetime, acceptance and reconnect handling across existing owners, with separate transport, navigation and rendering regressions.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Avoids unused Gateway sessions and misleading empty-chat placement without establishing an urgent outage or blocked onboarding flow.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-19T06:09:26.980Z sha b1abed0 :: needs changes before merge. :: [P2] [P2] Explain how to leave a draft whose creation cannot retry

Reviewed November 19, 2026, 1:55 AM ET / 06:55 UTC (Revision 2).

bkudiess and others added 2 commits November 18, 2026 22:14
Resolve the timing baseline conflict without expanding allowances. Wait for the native disclosure header to be visible instead of a fixed settling delay.

Co-authored-by: Copilot App <[email protected]>
The no-replay guard keeps a draft whose sessions.create reply was lost from ever sending again, but the message told users to check the session list before trying again. Say the draft cannot be sent and point to opening the chat from the session list or starting a new chat, in every supported locale.

Co-authored-by: Copilot App <[email protected]>
@bkudiess

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

  • P2 recovery copy: fixed in 29ab3dc. The no-replay guard is unchanged; Chat_Placement_Error_DraftCreationUncertain now says the draft cannot be sent and points to opening the chat from the session list or starting a new chat, in all six locales.
  • Merge conflicts: resolved by merging current main (8ffe470) in 7306c1b, without raising the timing baseline.

Validation on 29ab3dc: ./build.ps1 passed; Shared 5,972 passed, 29 skipped, 0 failed; Tray 6,933 passed, 0 failed (one real-profile-reading test excluded on this host).

@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 19, 2026
@bkudiess
bkudiess merged commit e9423ae into openclaw:main Nov 19, 2026
54 of 56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: 👀 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