Repository navigation
refactor(gateway): retire the legacy numeric ChatAbortMarker and dead registry surface - #124108
Conversation
… registry surface Abort markers are process-local in-memory state (nothing persists them), so the numeric ChatAbortMarker variant — in-process rollout compat for #91013 — has been unreachable in production since every producer moved to createChatAbortMarker. Deleting it also kills the registeredAtMs timestamp fallback in isChatAbortMarkerCurrent, which makes ChatRunEntry.registeredAtMs entirely write-only; the sequence comparison is the sole ordering authority. Dead surface riders (same owner file): - ChatRunRegistry.clear had zero callers (restart teardown clears through chatRunState.clear, which owns the whole store). - createChatRunRegistry/createToolEventRecipientRegistry standalone factories were consumed only by tests; production always goes through createChatRunState. Tests now use the state-owned instances, and the server-chat barrel re-exports are gone. Net -32 production LOC; 462 tests across the five touched suites green.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 4:39 AM ET / 08:39 UTC. ClawSweeper reviewWhat this changesThis PR removes the legacy numeric Gateway abort-marker branch, unused timestamp field, and test-only standalone registry factories while retaining state-owned registries. Merge readinessKeep this maintainer-owned cleanup open for the remaining exact-head checks and maintainer merge decision. The source sweep found no patch-introduced defect: production uses structured abort markers and the state owner already owns registry cleanup. Priority: P3 Review scores
Verification
How this fits togetherGateway chat-run state keeps in-memory run registrations, abort markers, and tool-recipient state. Abort and shutdown paths write markers; event projection and maintenance use them to decide delivery and cleanup. flowchart LR
A[Chat abort or restart] --> B[Gateway chat-run state]
C[Chat registration] --> B
B --> D[Sequence freshness decision]
D --> E[Event projection]
B --> F[Maintenance and shutdown cleanup]
Decision needed
Why: Repository policy keeps maintainer-authored and maintainer-labeled items open for an explicit maintainer decision even when source review finds no defect. Before merge
Agent review detailsSecurityNone. PR surfaceSource -32, Tests +2. Total -30 across 7 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge after the remaining exact-head checks pass, retaining the single structured in-memory marker contract and state-owned registry lifecycle. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR removes internal in-memory compatibility surface rather than fixing a separately reported user-facing failure. Is this the best way to solve the issue? Yes: source shows one canonical process-local state owner, all production writers already create structured markers, and consumers preserve the required timestamp and freshness behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f4beff12cd5e. LabelsLabel changes:
Label 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
|
|
Merged via squash.
|
… registry surface (openclaw#124108) Abort markers are process-local in-memory state (nothing persists them), so the numeric ChatAbortMarker variant — in-process rollout compat for openclaw#91013 — has been unreachable in production since every producer moved to createChatAbortMarker. Deleting it also kills the registeredAtMs timestamp fallback in isChatAbortMarkerCurrent, which makes ChatRunEntry.registeredAtMs entirely write-only; the sequence comparison is the sole ordering authority. Dead surface riders (same owner file): - ChatRunRegistry.clear had zero callers (restart teardown clears through chatRunState.clear, which owns the whole store). - createChatRunRegistry/createToolEventRecipientRegistry standalone factories were consumed only by tests; production always goes through createChatRunState. Tests now use the state-owned instances, and the server-chat barrel re-exports are gone. Net -32 production LOC; 462 tests across the five touched suites green.
What Problem This Solves
Dead surface in the gateway chat-run state owner, found by the round-5 run-lifecycle lane:
ChatAbortMarkervariant was in-process rollout compat for fix(gateway): ignore stale abort markers for fresh chat events #91013 (June 2026). Abort markers are process-local, in-memory only (ChatRunRecord.abortMarker— nothing persists them), so no shipped contract can carry the old shape across a restart; every production producer has gone throughcreateChatAbortMarker(structured) since. Only tests assigned raw numbers, and tests alone are not contracts.registeredAtMstimestamp fallback inisChatAbortMarkerCurrent(every entry is stamped bycreateChatRunEntry, soregisteredSequenceis always present) — which makesChatRunEntry.registeredAtMsentirely write-only. Deleted too.ChatRunRegistry.clearhad zero callers (restart teardown clears throughchatRunState.clear(), which owns the whole store).createChatRunRegistry/createToolEventRecipientRegistryfactories were consumed only by tests; production always goes throughcreateChatRunState(). Tests now use the state-owned instances and theserver-chat.tsbarrel re-exports are gone.Why This Change Was Made
Lean-code doctrine: compat is opt-in and this variant never had a contract — it was a live-rollout convenience that became permanent architecture. The sequence comparison is now the sole ordering authority for abort freshness, removing a two-signal inference (sequence-else-timestamp) where one recorded fact belongs.
User Impact
None visible — pure dead-surface removal. Net −32 production LOC.
Evidence
node scripts/run-vitest.mjs runover all five touched suites (server-chat.agent-events,gateway-misc,server-maintenance,server-runtime-subscriptions,server-methods) — 462/462 green.createChatAbortMarkercall sites atchat-abort.ts:633,server-close.ts:440,chat-abort-authorization.ts:233are the only marker producers; grep proves no remaining numeric assignment orregisteredAtMsreader outside the deleted code.pnpm tsgo,pnpm check:test-types(they enumerated every stale call site), oxfmt/oxlint clean; autoreview clean (0.99).Production LOC +8/−40 (net −32); tests +17/−15.