Skip to content

Extract thinking-level reconciliation - #1094

Closed
bkudiess wants to merge 3 commits into
openclaw:bkudiess-extract-pending-request-registryfrom
bkudiess:bkudiess-extract-reasoning-clear-reconciler
Closed

bkudiess wants to merge 3 commits into
openclaw:bkudiess-extract-pending-request-registryfrom
bkudiess:bkudiess-extract-reasoning-clear-reconciler

Conversation

@bkudiess

@bkudiess bkudiess commented Aug 5, 2026 •

Copy link
Copy Markdown
Collaborator

Stack: 2 of 3 for #980

Depends on #1090.

Summary

Behavior-neutral extraction of the frozen #1077 thinking-level clear reconciliation state machine into the UI-free OpenClaw.Chat layer.

  • Adds ThinkingLevelClearReconciler as the focused owner of per-thread operation versions, connection generations, protected canonical intent, patch acknowledgement, committed-but-unconfirmed state, correlated snapshot acceptance, bounded retries, concrete supersession, interruption, and disposal.
  • Keeps OpenClawChatDataProvider responsible for invoking patch and snapshot requests, storing canonical session snapshots, surfacing errors and notifications, and managing thread UI state.
  • Does not add the Default reasoning command, composer/menu behavior, protocol/session patch behavior, localization, or UI.

Ownership boundary

  • Source design: the reasoning-clear state machine frozen inside OpenClawChatDataProvider in Add Default reasoning reset to chat #1077.
  • Layer 2 owner: ThinkingLevelClearReconciler is authoritative for the UI-free reconciliation seam and its state transitions.
  • Production status: this layer does not change OpenClawChatDataProvider or claim its responsibility is closed. Provider delegation and the closure guard are planned for Layer 3.
  • Preserved invariant: stale or uncorrelated snapshots cannot clear protected intent. Only a current-generation correlated snapshot can confirm the clear or establish later external convergence.

Validation

  • Current repair head 6480e8702f9bebe94cffbc2423bc3e60a3092b55:
    • git diff --check: passed
    • .\build.ps1: passed
    • Shared: 3426 passed, 32 skipped, 0 failed
    • Tray: 2055 passed, 0 failed
    • Focused reconciler and architecture tests: 18 passed, 0 failed
  • Earlier state-machine validation at 602183ae6be206f981b532b56736bd71b5981c2a:
    • Connection: 535 passed, 0 failed
    • SetupEngine: 703 passed, 0 failed
    • WinNode CLI: 126 passed, 0 failed
    • Concurrent supersession stress: 25 of 25 iterations passed
    • Real-process device identity: 26 passed, 0 failed
    • Live gateway protocol round trips: 3 passed, 0 failed

Real behavior proof

Current head 6480e8702f9bebe94cffbc2423bc3e60a3092b55 leaves the reconciler implementation from 602183ae6be206f981b532b56736bd71b5981c2a unchanged. Its focused deterministic tests cover pre-ACK nulls, committed-but-unconfirmed completion, correlated snapshot rejection, bounded retry restart, concrete supersession, disconnect, reconnect, client swap, disposal, and concurrent races. They also prove a late or duplicate rejection cannot reverse an acknowledged clear or invalidate its active refresh.

This is a behavior-neutral, UI-free extraction. No UI or screenshot proof is required.

Dependent integration proof

  • Dependent Layer 3 draft: #1077 at exact head c4f48b62c7f3729ade8293c77f9a50f3911ecadd.
  • Verified current ancestry: Layer 1 79b289e0d7d91e05a6f7da507d3cf25ec9927dfd is an ancestor of this Layer 2 head 6480e8702f9bebe94cffbc2423bc3e60a3092b55.
  • Add Default reasoning reset to chat #1077 currently descends from the previous Layer 2 head 602183ae6be206f981b532b56736bd71b5981c2a, not this repaired head. It must be restacked onto 6480e8702f9bebe94cffbc2423bc3e60a3092b55.
  • After restacking, Add Default reasoning reset to chat #1077 must flip chat-provider-thinking-level-clear-closure from planned to closed and add the production provider-delegation source guard. Its current implementation consumes both PendingRequestRegistry and ThinkingLevelClearReconciler through OpenClawChatDataProvider in the complete Default/Off UI and session-patch flow.
  • Its credential-free real Gateway path patches explicit off, reads canonical "off" through sessions.list, sends SessionPatch.Clear, reads canonical null, reconnects the isolated Tray, observes current-generation null through app.chat.snapshot, and restores original state in finally.
  • Exact-head UI artifacts: Default checked and explicit off checked. Both links resolve to the documented 960x680 PNGs and SHA-256 hashes.
  • Add Default reasoning reset to chat #1077's exact-head ClawSweeper review reports no actionable code or security findings, 4/6 patch quality, and 3/6 overall/proof confidence. Its remaining items are the two open dependency layers and the hosted exact-head Gateway E2E, not a Layer 2 code finding.
  • Build and Test pull_request CI cannot trigger for Extract thinking-level reconciliation #1094 or Add Default reasoning reset to chat #1077 while their bases are feature branches because the workflow accepts only main and master. Add Default reasoning reset to chat #1077's body documents the hosted isolated test path, but its exact-head hosted execution is still pending. No green CI claim is made.

Review

  • Independent Claude Opus final review: zero findings, 92% confidence
  • Independent GPT Codex final review: zero findings, 93% confidence
  • One consensus client-swap liveness finding was fixed and re-reviewed to zero findings.
  • Bundled autoreview helper produced no review result because local Codex authentication returned HTTP 401 and the Claude CLI is not installed. No success is claimed for that helper.
  • Upstream ClawSweeper reviewed prior head 14ab131e9a2b56822fe360aff0423d9d25566485 at 3/6 and found one P2 ordering race: RejectPatch could reverse an already acknowledged clear.
  • Exact-head repair review: Claude Opus zero findings at 93% confidence; GPT Codex zero findings at 95% confidence.
  • The ClawSweeper P2 is fixed at 602183ae6be206f981b532b56736bd71b5981c2a.
  • Architecture-closure repair review at 6480e8702f9bebe94cffbc2423bc3e60a3092b55: Claude Opus zero actionable findings at 90% confidence; GPT Codex zero findings at 94% confidence.
  • Opus noted only the expected coordination requirement: Add Default reasoning reset to chat #1077 must restack onto the renamed planned closure row and reintroduce the production closure guard.

Upstream status

  • ClawSweeper Dispatch: passed
  • ClawSweeper review: the post-ACK rejection P2 remains cleared; the architecture-closure P2 from prior head 602183ae6be206f981b532b56736bd71b5981c2a is addressed at 6480e8702f9bebe94cffbc2423bc3e60a3092b55 and awaits re-review
  • Build and Test: not triggered because the workflow limits pull-request bases to main and master
  • Prior-head CodeQL workflow dispatch: passed at 602183ae6be206f981b532b56736bd71b5981c2a (run 30983518842)
  • GitHub Stack object: not created because GitHub rejects fork-head pull requests from Stacks

@bkudiess
bkudiess marked this pull request as draft August 5, 2026 06:24
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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 Aug 5, 2026
@clawsweeper

clawsweeper Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed August 8, 2026, 11:16 PM ET / August 9, 2026, 03:16 UTC.

ClawSweeper review

What this changes

This PR adds a UI-free reconciler for clearing a session’s reasoning-level override, plus state-machine and architecture-boundary tests.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open. This collaborator-authored draft is a bounded, tested stack layer that current main and the latest release do not contain; it needs maintainer sequencing with its dependency and downstream integration PR.

Priority: P2
Reviewed head: 6480e8702f9bebe94cffbc2423bc3e60a3092b55
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused and well-covered for an intermediate state-machine extraction, with normal maintainer sequencing still required.
Proof confidence 🌊 off-meta tidepool Not applicable: This collaborator-authored intermediate extraction does not change a live user path; its deterministic tests are relevant supporting evidence, while Layer 3 owns gateway and UI proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This collaborator-authored intermediate extraction does not change a live user path; its deterministic tests are relevant supporting evidence, while Layer 3 owns gateway and UI proof.
Evidence reviewed 5 items Current-main gap: Current main exposes only a string-valued thinking-level setter through the chat provider and gateway bridge; it has no clear-reconciliation owner, so the PR's central extraction is not already implemented.
Exact-head implementation: The branch adds the focused reconciler with per-thread operation, connection-generation, correlated-refresh, retry, supersession, and disposal state, without modifying the production provider in this layer.
Focused coverage: The exact-head tests cover ACK ordering, correlated snapshots, bounded retry, reconnect/client swap, supersession, disposal, and concurrent clear operations.
Findings None None.
Security None None.

How this fits together

The chat provider receives user intent and gateway session snapshots. This new chat-layer component is intended to decide when a clear is confirmed or needs a refresh, while a later provider layer performs gateway calls and updates UI-facing session state.

flowchart LR
A[User selects reasoning default] --> B[Chat provider]
B --> C[Clear reconciliation]
C --> D[Gateway patch request]
C --> E[Correlated session refresh]
D --> E
E --> F[Canonical chat session state]
Loading

Decision needed

Question Recommendation
Should maintainers accept this standalone Layer 2 reconciliation seam after its Layer 1 dependency, then require a restacked Layer 3 integration PR for the user-visible behavior? Sequence the stack: Merge the prerequisite layer first, then this tested seam, and restack the downstream integration before its final gateway proof.

Why: The source supports the bounded extraction, but choosing stack order and accepting a non-user-visible intermediate layer requires maintainer ownership of the chat architecture.

Before merge

  • Resolve merge risk (P1) - This draft is Layer 2 of a stack. It should be sequenced after its Layer 1 dependency and the downstream integration PR at Add Default reasoning reset to chat #1077 must be restacked before end-to-end gateway behavior is assessed.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
State-machine coverage production +687, focused tests +440, test-project wiring +1, docs +4/-1 The large lifecycle owner is paired with focused tests for its critical ordering and recovery states.
Diff scope 5 files affected The branch remains bounded to one chat-layer seam, its tests, and architecture documentation.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the focused ownership seam only in stack order, then restack the provider/UI integration and validate the complete clear-to-canonical-snapshot path on its final main-based head.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the focused ownership seam only in stack order, then restack the provider/UI integration and validate the complete clear-to-canonical-snapshot path on its final main-based head.

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

Not applicable. This PR is a behavior-neutral extraction, and its state transitions are directly exercised by focused deterministic tests rather than a standalone user workflow.

Is this the best way to solve the issue?

Yes. Separating the UI-free lifecycle state from the provider is a maintainable seam, provided the later provider delegation remains the only production integration path.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded chat session-state improvement in a draft stack, with no demonstrated immediate production regression from this intermediate layer.
  • 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 collaborator-authored intermediate extraction does not change a live user path; its deterministic tests are relevant supporting evidence, while Layer 3 owns gateway and UI proof.

Evidence

What I checked:

  • Current-main gap: Current main exposes only a string-valued thinking-level setter through the chat provider and gateway bridge; it has no clear-reconciliation owner, so the PR's central extraction is not already implemented. (src/OpenClaw.Tray.WinUI/Chat/OpenClawChatDataProvider.cs:1972, 4712e227d110)
  • Exact-head implementation: The branch adds the focused reconciler with per-thread operation, connection-generation, correlated-refresh, retry, supersession, and disposal state, without modifying the production provider in this layer. (src/OpenClaw.Chat/ThinkingLevelClearReconciler.cs:1, 6480e8702f9b)
  • Focused coverage: The exact-head tests cover ACK ordering, correlated snapshots, bounded retry, reconnect/client swap, supersession, disposal, and concurrent clear operations. (tests/OpenClaw.Tray.Tests/ThinkingLevelClearReconcilerTests.cs:1, 6480e8702f9b)
  • Stack provenance: The three commits form a direct stack above Layer 1, and the checked diff is limited to the reconciler, tests, test project, and architecture ledger. (docs/ARCHITECTURE.md:66, 6480e8702f9b)
  • Release and review-tool check: The latest release tag resolves to an older June commit, while this August PR remains outside current main. The bundled autoreview helper could not materialize its full commit bundle because this partial clone needed an unavailable remote object; targeted source and test diffs were inspected directly instead. (4166e0fd63f8)

Likely related people:

  • bkudiess: Current-main history shows Barbara Kudiess recently maintaining the chat provider path, and the stacked extraction commits are by the same contributor. (role: recent chat-area contributor; confidence: high; commits: a1d933a3c7b7, ad472243bcb8, 6480e8702f9b; files: src/OpenClaw.Tray.WinUI/Chat/OpenClawChatDataProvider.cs, src/OpenClaw.Chat/ThinkingLevelClearReconciler.cs)
  • Caleb Eden: Recent history shows work on the nearby chat presentation path, making this a useful secondary routing contact for integration sequencing. (role: recent adjacent chat contributor; confidence: medium; commits: aac07abb1fbd; files: src/OpenClaw.Tray.WinUI/Chat/OpenClawChatDataProvider.cs)

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 (11 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-05T07:17:33.596Z sha 602183a :: found issues before merge. :: [P2] Defer the ownership closure until the provider delegates to it
  • reviewed 2026-08-05T08:24:23.770Z sha 602183a :: needs changes before merge. :: [P2] Defer the ownership closure until the provider delegates to it
  • reviewed 2026-08-05T08:34:40.744Z sha 602183a :: needs changes before merge. :: [P2] Defer the provider-ownership closure
  • reviewed 2026-08-05T09:18:03.599Z sha 6480e87 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-05T09:27:40.162Z sha 6480e87 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-08T14:24:46.405Z sha 6480e87 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-08T15:39:28.703Z sha 6480e87 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-09T00:06:32.073Z sha 6480e87 :: needs maintainer review before merge. :: none

@bkudiess
bkudiess marked this pull request as ready for review August 5, 2026 06:35
@bkudiess
bkudiess marked this pull request as draft August 5, 2026 06:36
@bkudiess

bkudiess commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 5, 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: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 session-state 🚨 Merging this PR could lose, corrupt, stale, or mis-associate session or agent state. labels Aug 5, 2026
@bkudiess

bkudiess commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. merge-risk: 🚨 session-state 🚨 Merging this PR could lose, corrupt, stale, or mis-associate session or agent state. and removed merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 5, 2026
@bkudiess

bkudiess commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 5, 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: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 session-state 🚨 Merging this PR could lose, corrupt, stale, or mis-associate session or agent state. labels Aug 5, 2026
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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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