Skip to content

refactor(gateway): simplify session and reload bookkeeping - #168980

Merged
steipete merged 13 commits into
mainfrom
deslop/p03-gateway-core-20261010
Oct 11, 2026
Merged

steipete merged 13 commits into
mainfrom
deslop/p03-gateway-core-20261010

Conversation

@steipete

@steipete steipete commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Reduces Gateway complexity spent defending speculative config, catalog and display-read interleavings.

User Impact

Normal session, channel, Talk and desktop features remain. Authorization at private-row presentation and external effects, durable writes, shutdown settlement and resource bounds stay in place. Optional previews and attribution can briefly show older same-session facts; a failed catalog acquisition reports its existing error instead of replaying indefinitely. A queued config observation is applied after the current serialized transaction rather than cancelling it mid-flight.

Why This Change Was Made

The Gateway had overlapping ownership mechanisms around work already owned by a serialized queue, a pending promise, a current process pair or a final authorization check. This cut removes that duplicate state while retaining measured caches and the minimal checks needed by ordinary concurrent requests. It also removes tests whose only contract was a deliberately forced, now-accepted interleaving; kept security, data and shutdown tests are not weakened.

Best-effort tradeoffs accepted

Evidence

Pre-rebase node scripts/check-changed.mjs --base origin/main passed at f74889f79dc3dc94c18900335c3d97efcc39d1f2, including all 28 dependent test-type graphs, core and extension production/test typechecks, all three Knip scans (zero findings), changed-file/extension lint, ratchets, and webhook/pairing guards. Extension lint emitted one non-failing max-lines warning in untouched extensions/crabbox/src/crabbox-worker-provider.ts.

Candidate: 8c72a3cea17e559938fa951c2d9ef199d70424bd, rebased only after GitHub reported CONFLICTING, onto 7dd5b520d4757cafdad089abb0fe44a7ce6c691d. Net production reduction: 746 lines (510 added, 1,256 removed; tests, test-support, fixtures, generated files and declarations excluded). This uses the campaign's 500–999 honest-pass exception; the coverage log below records all original KEEP decisions rather than padding the cut. Three formerly unused async approval types now have consumers in newer main; their definitions are restored exactly, without ignores.

The final test-fixture and cleanup reviews are scoped-clean through P2. Full-branch review raised two documented best-effort tradeoffs (mid-read transcript rewrite and registry remapping), declined with retained authority/target checks identified. A later review suggested guarding same-ID identity replacements; that was declined after verifying that production emits replacement only when the session ID changes and emits reset for same-ID lifecycle changes. Reset invalidation remains intact. Final-content proof includes 32 Talk-registry/transcription/backfill tests, 87 channel-presence policy tests, 7 targeted realtime shutdown/final-write tests, 14 catalog tests, and the selected archived-residency test passing; production core typechecking passes. Earlier candidate proof also passed all 95 channel cases, 31 history-worker cases and 8 source-routing cases. The channel exhaustion regression failed at the intended retained-route assertion before its correction and passes afterward. Runtime and Madge import cycles are both zero; the final pre-push lint-suppression suite passed all 3 tests in 29.98 seconds (38.35 seconds wrapper). The 50-file core lint pass found one unused test import; its removal passes focused lint. Catalog test wall time was 303.95 seconds (346.60 seconds wrapper); archived-residency was 332.45 seconds. No CI-time claim is made yet.

Before rebase, all three Knip export scans passed with zero findings and all 13 SDK transcript-runtime tests passed. The refreshed SDK comparison on production-identical head 53353895b0d749886ed07b884131bd2a3d10eb39 completed with digest b86f9b78: 150 dependency-closure-affected exports and two internal whole-module declaration differences, with no named export additions/removals or public signature changes. Async approval definitions now match main exactly. Final core/Gateway/infra types, targeted lint, zero runtime/Madge cycles, and all three lint-suppression tests pass (9.24 seconds Vitest, 12.14 seconds wrapper).

The broad Gateway run was interrupted when its Testbox job was cancelled, after 8,360 passing case lines and twelve failed case lines; it has no complete-suite summary. The subsequent projection run completed 22 files with 136 passes and four failures. One failure pinned forged inode reuse and is removed; the catalog case now preserves observable refreshed model facts without demanding intermediate cache eviction. The two remaining failures exposed a real same-stack publication regression: native row facts were published and then erased by an identity notice. A per-row idempotency check fixes it without global fences. All 25 tests in the affected three projection files then passed, keeping the native/worker create, replacement and reset matrix unchanged.

The coordinator authorized test-only updates to the heartbeat-owned reload/runtime-service tests. Obsolete stale-config, watcher-handoff and duplicate-idle fixtures are removed; direct shutdown, receipt settlement, publication failure and model-refresh recovery coverage remains. The cron child-handoff fixture reset admission while replacement startup was still detached and used a virtual scheduler it never advanced. It now retains the helper lifetime through completion, uses the host-timer adapter and explicitly joins the real child; its original one-child, persisted-disable and 10-second assertions stay and pass. Two ordinary install/RPC timeouts from the interrupted broad run remain unqualified. No timeout was raised or skip/retry added.

The first rebase was required by a named pre-existing UI test-root budget failure, not main drift. It kept main's async account descriptions and prepared native session ownership. The budget was not raised. The unchanged 8,193-row category performance case timed out locally under host load and passed on Testbox in 6,890 ms.

After PR creation, GitHub reported CONFLICTING. The conflict-only rebase onto 50cf629016e248cdea5fac810c8fc6b194155e01 retained main's new committed transcript-fact reuse from #168719 and this lane's timer simplification. Core and Gateway-root types pass. Across the affected seven projection files, 76 retained cases pass; one obsolete variant was removed after it deliberately discarded an exact committed owner fact and substituted a broad profiles invalidation during a held worker reply (#155767). Real owner, profile, membership-revocation and accepted-fact coverage stays. The desktop authority check now runs once immediately before dispatch; all 11 process tests pass, and focused independent review is clean. Final integration review of the live type restoration and synthetic-test cleanup is clean through P2.

The conflict-proof Testbox request remained queued without a host for ten minutes and was stopped. Native status is completed with no IP; the wrapper retains a claim/key because the request has no GitHub-run association. It ran no proof. Local focused proof is used instead.

Seven retained-memory cases in the untouched server-plugin-reload.recovery.test.ts failed locally and reproduced on clean main snapshot f8fe56a999119cf87f46af99cfd463ac6f4bfe97 with the same assertions:

  • Provider replacement held-close: Plugin first is retiring instead of successful cleanup.
  • Provider replacement failed-close: wrong error class instead of PluginInstanceUnavailableError.
  • Watcher restart pending, initialized, and separate-registry: recovering instead of reloading (three cases).
  • Retained indexing after early checkpoint and restart failure: recovering instead of reloading (two cases).

The baseline run reports 7 failed, 1 passed, 103 filtered-out cases in 550.72 seconds. These inherited failures remain failures; no timeout, retry, skip, or expectation was changed for them. The initial baseline attempt failed before collecting tests because package-local dependency links were absent; that setup error is not counted as baseline proof.

The initial scope review mistakenly treated synthetic PR reproductions as real incidents. This pass re-evaluated all 15 KEEP rows: 8 flipped to removal/minimal keepers, 7 retain explicit security, durability, shutdown, bounded-resource or measured-performance justification. The detailed coverage ledger is maintained with the lane.

Exact-head CI and test-only follow-up

Run 38126904478 tested 53353895b0d749886ed07b884131bd2a3d10eb39 and failed. All check runs were enumerated; there were no cancellations. The follow-up changes only tests, and all 112 focused cases across the seven affected/sibling files passed in four sequential shards (1,180.10 seconds wrapper). Fresh independent review is clean through P2.

Failed job Attribution and follow-up
checks-node-compact-small-1 Two obsolete display-name revalidation cases removed. The separate disconnection/snapshot case now holds the existing state-reader boundary instead of a removed profile watcher; its rejection remains tested.
checks-node-changed-compact-small-1-1 Stale positive worker-read expectation reproduced on clean main f442662cabd under Bun. Main subsequently fixed the fixture in 952c102 by explicitly invalidating facts. The final branch preserves that test byte-for-byte, including positive keyed reads, unchanged siblings, no main-thread SQL, and subsequent clean-row reuse.
checks-node-changed-compact-small-9 Removed only the newer-write hash variant that pinned config supersession during secrets preparation; no credential/config value changes in that fixture. Same-source echo and actual secrets admission/snapshot/rollback checks remain.
checks-node-changed-compact-small-19 Removed unrelated registry creation as a reason to revoke otherwise-current history. Four actual shared-state authority revocation variants remain.
checks-node-changed-compact-large-21 Removed forced registry rediscovery/retry interleavings. Kept completed-registration history reads, physical replacement, cancellation, archive and worker lifecycle coverage.
checks-node-changed-compact-large-14 Test waited for a config getter before releasing the publication that the simplified getter now awaits. Removed that deadlocking handshake, retained catalog/currentness assertions, and passed the full file including the four cleanup-cascade cases.
checks-node-changed-extensions-bundle-2 Inherited Linux steering failures independently reproduced on unrelated PR #169026 at 5e30a97b9207d19ac4eb2aaa3922e7f811b5292f, run 38137511377, job 114464519186. Both steering test files and the executed steering/transcript-write owners are unchanged. The peer's delivered-command additions are outside these paths. The same six failures include missing acceptance, a completed-answer timeout and database-closing teardown cascade. The precise deadlock cause remains unresolved; passing local replays are not claimed as a fix.
openclaw/ci-gate Downstream aggregate of the failed test jobs.

No CI rerun was requested. The necessary test-only repair receives a new exact-head run; unqualified failures are not relabeled as main-red.

The subsequent exact-head run 38135696717 at 4d7caf4119d7922b14cf51b7d51b50bbcae5efe7 had two failed test jobs and the aggregate gate, with no cancellations: job 114459199610 was the over-strict zero-worker-read expectation corrected above; job 114459199622 was the independently qualified steering failure; gate 114461165617 aggregated them. The final conflict-only rebase preserves main's repaired row-read test and new live borrowed-turn self-reload refusal, and keeps the existing simplification where main independently removed a source assertion.

Conflict-integration proof: the four-file reload/activation/recovery/row run completed with 215 passed and three retained-memory failures (825.82 seconds wrapper). All three reproduce on clean rebase main 6781784f3714b2914a04ed3003ded6f7870dab2e: separate-registry watcher restart, early checkpoint failure, and early restart failure expect reloading but observe recovering. The focused baseline completed with three failures and 108 filtered cases in 280.44 seconds; no expectation was weakened. The corrected, current-main row test independently passes all five cases (186.62 seconds wrapper). Fresh isolated review accepts that correction. The two remaining full-branch review suggestions are declined: Talk synchronous reentrant shutdown is explicitly best-effort and no production cleanup callback initiates it; desktop host/request/abort authority is already checked immediately before dispatch.

The required lint-suppression suite reports two passes and one inventory mismatch, repeated identically on clean 6781784f371 (44.28 seconds candidate / 32.42 seconds baseline). Reported drift is in untouched state/test-utils and Solid HTML files; this lane changes neither those files nor the suppression test and adds no suppression. The inventory is not widened. Madge reports zero cycles.

At conflict-repair publication, core production types and all three Gateway test-type graphs pass, and runtime value cycles and Madge cycles are both zero. The broader 28-graph changed check and refreshed SDK API comparison are still running locally; their previous-head results above are not presented as fresh-head completion. Hosted CI will be observed on exactly 923cc70b5a8c03c0c80dd299a4455caf4dac15ab before landing. Refreshed heartbeat exclusions have no production overlap with this lane; only the already-authorized test overlaps remain.

The next conflict-only integration supersedes that publication: main #169100 moved row preparation into session-row-database-facts.ts and added actor-fact reuse. This branch retains that implementation, moving only the existing global revision-fence and repeated registry-wait removal into the new owner. Main #168991's history replacement guard/test deletions remain; the obsolete row-test correction commits are dropped and the current-main row test is unchanged. Fresh isolated P2 integration review is clean; all 21 selected actor, incognito, history-lifecycle and keyed-row tests pass (220.71 seconds wrapper), core production and Gateway-root/methods test types pass, and runtime/Madge cycles are zero. The preceding changed check passed all pre-type gates and 14 test-type graphs; it was interrupted for the required conflict repair, not reported complete. The SDK comparison completed at production-equivalent pre-move head a87ef2f546d76581f8efed056dbe213ccfe4c327 against 6781784f371: digest b5f709b8, 150 closure-affected exports, two internal whole-module declaration differences, no named export additions/removals or public signature changes. This final integration preserves main's internal module move and introduces no new public surface.

The repair's changed-file check ran on Testbox against the verified candidate source. All selected type graphs (28 core and three root-test), Knip scans (zero entries), lint and guard commands emitted passing results. The wrapper itself exited 1 during cleanup when its GitHub run read failed; that exit remains recorded. Native status was completed with no IP, and a subsequent cleanup reconciliation succeeded. The separate pre-push suppression suite passed all three cases (8.86 seconds, 11.50 seconds wrapper). Production is identical to the previous zero-cycle/API-checked head.

Coverage log: all 15 original KEEP decisions re-evaluated
Flipped owner Removed after the sharpened provenance review
session-row-projection-generation.ts Physical source inventories, repeated file probes, config-reference fences and raw-event reentry suppression; #154069/#163030 used forced interleavings.
session-row-projection-catalog.ts replacement retention Exact replacement-promise/supersession choreography; retain the cache and one pending read under the performance rule.
session-row-projection-catalog.ts dirty symbols Publication-revision tokens; overlapping synthetic replacements do not justify stale-result fencing.
session-row-projection-backfill.ts Mid-read interruption/requeue and same-session stale-preview rejection; retain input deduplication, bounds and one final current-row check.
session-row-projection-materialize.ts / projection owner Reentrancy checks and global config/database fences; retain accepted facts, bounded slices and per-row sharing checks.
Plugin recovery / channel pause Nested predecessor/token choreography; retain ordinary settlement and bounded recovery for Peter's recorded September 17 outage in #150953.
server-channels.ts Queued duplicate stops, redundant handoff ownership and deferred snapshot closures; retain one stop promise, account authority and sibling settlement.
session-utils-store-sources.ts Registry rescans/retry; #158587/#159102 provide CI/harness evidence, not a human-use incident. Capture the route once and retain final target/reader authority.
Remaining owner Why it meets the sharpened bar
Per-recipient session event projection Security: current viewer, sharing, source session and lifecycle authorize each private delivery.
Exact/bulk row read sharing Real bounded-resource protection and measured duplicate-I/O avoidance; concurrent pages retain their own scopes.
Retained session reads and credential-bearing GitHub requests Security: current reader, source and credential selection are checked at the external effect.
Talk shutdown join User-data durability and ordinary settlement of accepted speech, transcripts and mutation summaries.
Desktop registry ownership and bounds Security: observation/control tokens bind the current desktop; native sessions and failed cleanup remain bounded.
Terminal reservations and archive drain Ordinary parallel opens must respect session/native-process caps; archive and shutdown settle owned processes.
HTTP auth-bypass metadata and TLS renewal Security: auth exception paths and listener credentials stay with the validated owner.

The eight flips are event-generation observation, catalog replacement fencing, catalog revision symbols, backfill interruption/revision checks, materializer global generations, plugin/channel pause choreography, per-account redundant lifecycle state, and source-registry rediscovery. Both previously deferred candidates—Talk reentry and idle-task duplicate checks—were also implemented. Existing tests and synthetic repros are used as proof tools, not as evidence of a real incident.

@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

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

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XL labels Oct 11, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR simplifies bookkeeping for Gateway session projections, config reloads, channel teardown, Talk cleanup, and desktop processes.

Example: While a WhatsApp reload drains active work, another config.patch changes selfChatMode from true to false.

  • Before: The newer observation ends the drain, allowing committed work to finish before the successor configuration applies.
  • After: The successor request remains counted as active while awaiting queued application, delaying both operations until the default 300000 ms deadline.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful owner-approved simplification with meaningful in-process coverage, but the retained reload dependency defect blocks merge.
Proof confidence 🦐 gold shrimp (3/6) The supplied maintainer-authored exemption applies; reported validation exercises production owners in process, while inspected historical screenshots do not establish this refactor's behavior.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Gateway operations carry overlapping bookkeeping around work already governed by existing lifecycle and publication owners.
Reason: The supplied maintainer-authored classification establishes direction, and the body records the accepted tradeoffs.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep this PR open: the maintainer-approved simplification is useful, but the previously reported reload-drain dependency cycle still blocks merge.

Priority: P2
Reviewed head: 8c72a3cea17e559938fa951c2d9ef199d70424bd

Before merge

  • Let the drain escape requests awaiting successor config application (P1) - This previously reported blocker remains. During a channel reload drain, a second hot-reloadable config.patch or config.apply persists its write and awaits its application receipt while retaining a separate request root. Active-work accounting counts that root, but the serialized reload queue cannot apply the successor until its predecessor returns. With currentness now depending only on shutdown, the newer observation no longer ends the wait; scheduling its reload also returns early while the predecessor runs, so it creates no lifecycle-lease-demand escape. Both operations wait until the default 300000 ms deadline. Separate drain completion from transaction cancellation and restore the removed newer-admitted-write regression.
  • Complete next step - Obtain diagnostics for the current-head check-prod-types, checks-node-changed-compact-small-19, and checks-node-changed-compact-large-13 failures and determine which, if any, this diff causes.

Findings

  • [P1] Let the drain escape requests awaiting successor config application — src/gateway/config-reload.ts:324-325
Agent review details

How this fits together

Gateway owners consume configuration writes and session events, apply runtime changes, present authorized session views, and settle channel and process lifetimes.

flowchart TD
A[Config writes and session events] --> B[Gateway owners]
B --> C[Serialized config application]
B --> D[Resident session projection]
C --> E[Active work drain]
E --> F[Channel and process lifetimes]
D --> G[Authorized client replies]
Loading

Technical review

Best possible solution:

Retain the simplification while allowing queued config requests to end their predecessor's drain without abandoning committed runtime work.

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

Source establishes the successor-request cycle through application-receipt waits, root accounting, and serialized reload execution; no target code was executed.

Is this the best way to solve the issue?

The accepted bookkeeping reductions fit repository policy, but serialization still needs a drain escape for requests awaiting that same queue.

Full review comments:

  • [P1] Let the drain escape requests awaiting successor config application — src/gateway/config-reload.ts:324-325
    This previously reported blocker remains. During a channel reload drain, a second hot-reloadable config.patch or config.apply persists its write and awaits its application receipt while retaining a separate request root. Active-work accounting counts that root, but the serialized reload queue cannot apply the successor until its predecessor returns. With currentness now depending only on shutdown, the newer observation no longer ends the wait; scheduling its reload also returns early while the predecessor runs, so it creates no lifecycle-lease-demand escape. Both operations wait until the default 300000 ms deadline. Separate drain completion from transaction cancellation and restore the removed newer-admitted-write regression.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 38f456226f62.

Provenance checked

  • Config observations and reload drains changes intended behavior with a stated reason (0da947d: Committed reload tails must finish before successors run, while newer admitted RPCs must be able to end the drain to avoid deadlock.)
  • Session generation, materialization, and physical witnesses changes intended behavior with a stated reason (e0d8000: Bind deferred projection publication to captured source identity, request authority, configuration, and prepared facts.)
  • Catalog and optional preview bookkeeping changes intended behavior with a stated reason (2db54d7: Retain completed catalog facts during replacement and avoid session stalls or unchanged catalog broadcasts.)
  • Incognito presentation and cleanup changes intended behavior with a stated reason (7855489: Retain captured actors and stores through private-row preparation, synchronous consumption, and cleanup.)
  • Display attribution and transcript pagination changes intended behavior with a stated reason (34cb8f7: Prepare identity cohorts off-thread while preserving ordered conversion failures and current disclosure facts.)
  • Registry discovery changes intended behavior with a stated reason (3d90381: Retry registration-invalidated metadata discovery while retaining original state admission and physical source bindings.)
  • Channel teardown and recovery keeps the original intent (578690d: Recover channels after replacement drain timeouts without abandoning admitted writes or retaining permanent reload pauses.)
  • Talk and desktop lifecycle bookkeeping changes intended behavior with a stated reason (e94d0e9: Join connection cleanup during ordinary shutdown; the body explicitly accepts removing synthetic callback-reentrancy defenses while retaining ordinary joins and final dispatch authority.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/gateway/config-reload.test.ts src/gateway/server-reload-handlers.test.ts --maxWorkers=1
  • pnpm test src/gateway/server-reload-wizard-lease.test.ts src/gateway/server-methods/config.test.ts --maxWorkers=1
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 0da947d adds src/gateway/config-reload.ts:471 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0da947dbf0f4; files: src/gateway/config-reload.ts)
  • Vincent Koc: Raw commit 5487855 adds src/gateway/talk-relay-session-lifecycle.ts:43 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 548785581580; files: src/gateway/talk-relay-session-lifecycle.ts)

PR surface

Source -746, Tests -1788. Total -2534 across 58 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 30 507 1253 -746
Tests 28 897 2685 -1788
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 58 1404 3938 -2534

Review metrics

Metric Value Why it matters
Production versus test reduction Production +507/−1253 LOC; tests and support +897/−2685 LOC The net reduction supports the simplification goal, but the removed successor-request regression protects an ordinary queue dependency.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This unmerged internal refactor has useful simplification and a focused blocking repair.
  • merge-risk: 🚨 availability: Overlapping config RPCs can delay channel reload and config application until the five-minute drain deadline.
  • merge-risk: 🚨 compatibility: SDK-exposed attribution and transcript pagination change freshness and fallback semantics; the maintainer-authored body explicitly accepts those tradeoffs.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (4 earlier review cycles)
  • reviewed 2026-10-11T07:49:20.818Z sha f74889f :: blocked before merge. :: [P1] Let the drain escape requests awaiting successor config application
  • reviewed 2026-10-11T09:11:06.417Z sha 5335389 :: needs changes before merge. :: [P1] Let the drain escape requests awaiting successor config application | [P2] Update session-share fixtures for the display snapshot contract | [P2] Update the secrets publication test for queued observations
  • reviewed 2026-10-11T12:03:23.330Z sha 4d7caf4119d7922b14cf51b7d51b50bbcae5efe7 :: blocked before merge. :: [P1] Let the drain escape requests awaiting successor config application | [P2] Align the dirty-row fixture with its actual Node read contract
  • reviewed 2026-10-11T13:48:03.941Z sha 923cc70 :: needs changes before merge. :: [P1] Let the drain escape requests awaiting successor config application

Reviewed October 11, 2026, 10:07 AM ET / 14:07 UTC (Revision 5).

@steipete
steipete force-pushed the deslop/p03-gateway-core-20261010 branch from f74889f to 5335389 Compare October 11, 2026 08:58
@steipete
steipete marked this pull request as ready for review October 11, 2026 09:01
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Oct 11, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Oct 11, 2026
@steipete
steipete force-pushed the deslop/p03-gateway-core-20261010 branch from 4d7caf4 to 923cc70 Compare October 11, 2026 13:37
Remove repeated filesystem probes from generation observations while retaining captured database identity, row lifecycle checks, mutation invalidation, and recipient authorization.

Best-effort tradeoffs accepted: an out-of-band database replacement before the projection owner observes it no longer gets an additional per-event filesystem veto. The owner observes it on refresh or restart. The probes originated in e0d8000 (#154069); no production incident requiring the repeated probes was identified.

Proof: 23 unchanged topology and incognito tests pass; 49 baseline owner/broadcaster tests pass; independent P2 review is clean. No tests or lint suppressions changed. The lint-suppression inventory test has two unrelated existing entries missing from its allowlist. Full changed-check was stopped in the broad assertion scan; focused validation is recorded in the lane ledger.
Retain measured caches, row and recipient authority, and bounded reads while removing speculative physical witnesses, supersession retries, reentrant refresh guards, and post-consumption validation.

Best-effort tradeoffs: optional previews and display attribution may retain older same-session facts until their next publication; catalog acquisition errors are returned instead of replayed. External file replacement is observed by the owning runtime. No schema or protocol change.
Remove registry metadata replay and in-flight watcher-echo reconciliation. Serialized config application leaves newer observations queued and keeps physical source checks, credential validation, caller authority, and shutdown settlement.

Best-effort tradeoffs: a read does not expand its routing inventory when another database is registered, and a queued config finishes before the newer observation. Keep failed credential activation rollback coverage while dropping only supersession choreography.
Use one pending channel stop, one Talk cleanup promise, direct diagnostic snapshots, and existing process lifetime state. Keep strict caller settlement, ingress handoff, explicit effect authority, bounded resources and ordinary shutdown joins.

Best-effort tradeoffs: rare mid-read status changes refresh next time; internal impossible clocks and synthetic reentrant cleanup no longer have dedicated machinery. The recorded failed-reload recovery remains intact. Includes strict-join regression coverage.
@steipete
steipete force-pushed the deslop/p03-gateway-core-20261010 branch from 923cc70 to 8c72a3c Compare October 11, 2026 13:58
@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head CI attribution for 8c72a3cea17e559938fa951c2d9ef199d70424bd.

Run 38145324909 is terminal. It tested GitHub merge acf41ee90180437c5c97b97a888f2802e781e1d8, parents 133b56ba90541b79b5f90a35aa2c0b9a96f8b44c and this PR head. All check runs and all eleven failing jobs were inspected. No test job was cancelled.

Failed job Attribution and independent proof
check-prod-types (114487792249) Six pre-existing UI diagnostics: conflicting wa-tab* declarations and three invalid active properties. All six reproduce with node scripts/run-tsgo.mjs -p tsconfig.ui.json on clean main 3414fa0f2b51325ebd5bfc005877262def940333. UI sources, declarations and typecheck inputs have zero PR delta from the tested merge's first parent.
check-test-types-core-1 (114487792208) Same six UI diagnostics only; inspected separately. Same unchanged-source and clean-main proof.
check-test-types-core-2 (114487792215) Same six UI diagnostics only; inspected separately. Same unchanged-source and clean-main proof.
check-test-types-core-3 (114487792185) Same six UI diagnostics only; inspected separately. Same unchanged-source and clean-main proof.
check-test-types-core-4 (114487792261) Same six UI diagnostics only; inspected separately. Same unchanged-source and clean-main proof.
check-test-types-core-5 (114487792188) Same six UI diagnostics only; inspected separately. Same unchanged-source and clean-main proof.
checks-node-changed-compact-small-19 (114487597476) Four dreaming-startup-admission.test.ts failures at joinedPreparation === false. All four reproduce on clean main 3414fa0f; nine siblings pass. This invokes Memory Core directly, not the Gateway. Its service, memory/storage preparation and admission owners are unchanged by this PR.
checks-node-changed-compact-large-18 (114487597489) server-close.memory.test.ts fails at assert(agent) before sync or shutdown starts. Same missing native handle reproduces on clean main 3414fa0f; two siblings pass. The unchanged worker/read-only storage path does not guarantee the test's cached writable handle.
checks-node-changed-compact-large-13 (114487597403) Provider-validation instance cleanup throws SQLite ERR_SQLITE_ERROR, extended code 1802 (disk I/O error). The same pin-alpha cleanup error reproduces on clean main 3414fa0f (one failure, nine passes); its table label changed from “not allowed” to “denied,” but the failing cleanup mechanism is identical. Validation, prepared-runtime acquisition, instance disposal and SQLite execution owners are unchanged by this PR.
checks-node-changed-extensions-bundle-2 (114487597486) Six Codex steering failures: missing acceptance, a completed-answer timeout, and database-closing teardown cascade. Independently reproduced on unrelated PR #169026, tested head 5e30a97b9207d19ac4eb2aaa3922e7f811b5292f, run 38137511377, job 114464519186. The executed steering/transcript-write owners are byte-identical to that peer and unchanged by p03. Main's later test edits occur after the line-217 acceptance failure and in a later case than the completed-answer timeout; they cannot explain either root. This does not claim that whole test files are identical or that the deadlock's precise cause is resolved.
openclaw/ci-gate (114489807082) Downstream aggregate of the ten failed jobs above, not an independent failure.

The cancelled PR context and evidence job 114487342827 was superseded by successful same-head metadata job 114487456793. It is not a cancelled test suite. Security-sensitive review and dependency review statuses are successful. No CI rerun or proof-only push was requested.

This uses the coordinator-authorized inherited-only admin exception, pinned to the exact reviewed head. These failures remain recorded as failures, not relabeled green. No test expectation, timeout, retry, skip, suppression or scanner policy was weakened to release a gate.

Final focused proof: 21 actor/incognito/history/row tests pass; production and affected Gateway test types pass; scoped lint/format pass; runtime and Madge cycles are zero. SDK comparison: no named public export or signature changes. Net production reduction is 746 lines against the rebase base; the PR body contains all best-effort tradeoffs and the 15-row KEEP re-evaluation.

@steipete
steipete merged commit 3ed79ce into main Oct 11, 2026
126 of 139 checks passed
@steipete
steipete deleted the deslop/p03-gateway-core-20261010 branch October 11, 2026 14:32
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…168980)

* refactor(gateway): trust owned database identity for queued events

Remove repeated filesystem probes from generation observations while retaining captured database identity, row lifecycle checks, mutation invalidation, and recipient authorization.

Best-effort tradeoffs accepted: an out-of-band database replacement before the projection owner observes it no longer gets an additional per-event filesystem veto. The owner observes it on refresh or restart. The probes originated in 81c57e5 (openclaw#154069); no production incident requiring the repeated probes was identified.

Proof: 23 unchanged topology and incognito tests pass; 49 baseline owner/broadcaster tests pass; independent P2 review is clean. No tests or lint suppressions changed. The lint-suppression inventory test has two unrelated existing entries missing from its allowlist. Full changed-check was stopped in the broad assertion scan; focused validation is recorded in the lane ledger.

* refactor(gateway): simplify projection and catalog snapshot ownership

Retain measured caches, row and recipient authority, and bounded reads while removing speculative physical witnesses, supersession retries, reentrant refresh guards, and post-consumption validation.

Best-effort tradeoffs: optional previews and display attribution may retain older same-session facts until their next publication; catalog acquisition errors are returned instead of replayed. External file replacement is observed by the owning runtime. No schema or protocol change.

* refactor(gateway): apply captured config and source snapshots once

Remove registry metadata replay and in-flight watcher-echo reconciliation. Serialized config application leaves newer observations queued and keeps physical source checks, credential validation, caller authority, and shutdown settlement.

Best-effort tradeoffs: a read does not expand its routing inventory when another database is registered, and a queued config finishes before the newer observation. Keep failed credential activation rollback coverage while dropping only supersession choreography.

* refactor(gateway): share teardown and simplify optional lifecycle guards

Use one pending channel stop, one Talk cleanup promise, direct diagnostic snapshots, and existing process lifetime state. Keep strict caller settlement, ingress handoff, explicit effect authority, bounded resources and ordinary shutdown joins.

Best-effort tradeoffs: rare mid-read status changes refresh next time; internal impossible clocks and synthetic reentrant cleanup no longer have dedicated machinery. The recorded failed-reload recovery remains intact. Includes strict-join regression coverage.

* fix(gateway): preserve retry ingress through channel handoff

* fix(gateway): preserve cleanup timing and backfill progress

* refactor(gateway): remove unused background-work predicate

* test(gateway): remove obsolete catalog loader import

* refactor(gateway): preserve reload contracts without stale fences

* fix(gateway): preserve native publication and fixture lifetimes

* refactor(gateway): check desktop authority at command dispatch

* refactor(gateway): reconcile live contracts after rebase

* test(gateway): align retained coverage with simplified lifetimes
RomneyDa added a commit that referenced this pull request Oct 20, 2026
9e90500 backported the #169249 state-lease change (cleanup releases
through the worker writer queue, needed by #173225's native-cleanup
test) without #169249's reload fixture adaptation. Release now settles
after an awaited worker round trip, so fixtures that drove sequential
reloads with one vi.advanceTimersByTimeAsync(0) wake hung for 120s.

Port the b1cadee fixture changes to the terminal, restart-sequence
and operator model-policy tests: drive reloads through a scheduler clock
and join each wake. Apply the same join to the release-only watcher
handoff test (removed on main by #168980). Assertions are unchanged.

Adapted from b1cadee (#169249).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant