refactor(chat): extract runtime state owners - #1096
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 6, 2026, 5:59 AM ET / 09:59 UTC. ClawSweeper reviewWhat this changesThe PR decomposes the tray Chat provider into focused conversation-state, history-loading, queue, reset, lifecycle, persistence, mapping, formatting, and snapshot-projection owners while retaining the public provider facade. Merge readinessKeep open for human merge review. The refactor is not on current main, has no discrete source defect identified, but its final head changes reset and deferred-abort behavior after the only reported real-gateway proof head; as a collaborator-authored PR, it also requires explicit maintainer judgment. Priority: P2 Review scores
Verification
How this fits togetherGateway history and events enter the tray Chat provider, which coordinates local conversation state and produces immutable snapshots for the WinUI chat timeline. Metadata and remembered state are persisted separately from the runtime transaction lock. flowchart LR
A[Gateway events and history] --> B[Chat provider facade]
B --> C[Conversation state]
B --> D[History loader]
C --> E[Snapshot projection]
D --> C
E --> F[WinUI chat timeline]
C --> G[Metadata and state persistence]
Decision needed
Why: The final branch changes central session-state behavior after its cited live proof, and collaborator-authored PRs require explicit maintainer judgment. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Publish redacted disposable-gateway output from final head 0e34872 that exercises reset, reconciled local echo, terminal lifecycle completion, and deferred-abort fencing, then obtain collaborator-path maintainer approval. Do we have a high-confidence way to reproduce the issue? Not applicable to the structural refactor itself. The final reset and lifecycle behavior has focused source and test coverage, but no high-confidence real-gateway reproduction from final head is available. Is this the best way to solve the issue? Yes for the architecture direction: the provider remains the facade while a single transaction root coordinates lock-free substates, with ledger entries and guard tests preventing responsibility drift. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against aac07abb1fbd. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
|
Added exact-head real gateway proof to the PR body: authenticated @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
4301c4f to
67d8a8b
Compare
|
Updated exact-head proof and review closeout for @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
67d8a8b to
61ed054
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use exact submitted echoes to open buffered post-reset lifecycles after queue reconciliation, and fence deferred abort work to the active runtime generation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
61ed054 to
0e34872
Compare
Summary
OpenClawChatDataProviderfrom 7,249 to 1,728 lines and leave it as the same publicIChatDataProviderfacade for bridge IO, telemetry, events, and composition.ChatConversationState.Ownership transfer
ChatConversationStateChatQueueState+ChatSendQueuePolicyChatResetStateChatHistoryStateChatHistoryLoaderChatPresentationStateChatLifecycleStateChatApprovalStateChatMetadataStoreChatStatePersistenceNo substate owns a second runtime lock or duplicate reset/history generation. Provider source guards prevent
_gateor mutable runtime collections from returning.Validation
./build.ps1: all projects passedgit diff --check: cleanValidation was run after rebasing onto current
maine9d571a9and integrating #1069 flattened session classification plus #1091 compacted-history/checkpoint behavior into the new owners.Real behavior proof
Validated exact D1 head
67d8a8b5through a disposable real-gateway profile:app.chat.sendandapp.chat.snapshot; no credential values were printed or retained.sent=true, queue count0, and snapshot polling observed one user echo, an active turn, then terminal state.Agent errorrather than model chunks. This provider blocker is explicit rather than reported as streamed-model success.chat.history; the marker and terminal state replayed exactly once without duplication.Redacted evidence is retained in
d1-live-gateway-proof-67d8a8b5-20260805-204618.Review
Architecture
Adds authoritative/closed ledger rows and behavioral/source guards for the transaction root, queue/reset/history/presentation/lifecycle/approval substates, history loader, metadata and persistence owners, mapper/projector/formatting owners, and provider residue.