Skip to content

perf(sessions): serve remaining per-turn session authority reads from workers - #165028

Merged
steipete merged 31 commits into
mainfrom
dbasync/sessauthtail
Oct 5, 2026
Merged

steipete merged 31 commits into
mainfrom
dbasync/sessauthtail

Conversation

@steipete

@steipete steipete commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Gateway turns still perform synchronous session-authority reads during reply delivery, lifecycle persistence, restart recovery, and maintenance admission.

User Impact

Part A of the session-authority migration moves these reads to existing workers while preserving fresh authority, FIFO ordering, and teardown settlement. Schemas, retention, durability, permissions, configuration, and released synchronous plugin callbacks remain unchanged. The diff adds zero new OPENCLAW_* names.

The coordinator-approved original workload reduced warmed main-thread SQL from 223.8 to 186.8 statements/turn (−16.53%). Total SQL increased 9.14% on workers; off-main share rose from 82.86% to 85.40%. Worker read amplification remains follow-up work. These are original-head execution counts, not latency claims or a benchmark of the integrated candidate.

Why This Change Was Made

Capture physical store identity before yielding, consume fresh worker-owned rows, and revalidate live run and routing authority immediately before side effects. Initialization supplies the transcript-start binding; the final anchor snapshot includes lifecycle facts. The lifecycle owner joins accepted preparation and persistence before teardown, including when parent scheduling is cancelled.

The final-reply lookup now precedes the final anchor snapshot, preventing a reproduced transcript-branch switch after the anchor decision from returning delivered. Lifecycle aliases use the worker lookup's canonical identity for the same FIFO. Header and session facts share one deferred snapshot; replay/context checks remain outside its narrow best-effort header catch. Main's qualified admission, session projection, message-injection settlement, current user-turn ownership, transcript-context validation, and commentary-media custody remain intact.

Related: #162433. Overlap with #165181, #165193, #165236, #165275, #165470 and the stacked tool-authority and observer/hook parts stays focused. No other PR branch was changed. Children #165205 and #165370 retain this branch as their base until landing.

Evidence

Candidate and qualification

Head: 44f2dc5c239e8bdc5d3c6fd9b9c4347ba5c9c132
Tree: 2fc578375d26ceaf461c6c6905c2cf4d95b4e2be
Integrated main: d5fbbe86a807404123534306615595be89b2f1f3

The exact combined tree passed the new sharing-freshness regression, all 12 ACP completion cases, and all 250 cases in the original 26-file CI group on Linux/Node 24.19.0 (run). Wall times were 49s, 132s, and 595s. The source/tree was verified around every gate; the lease is fully released.

Full check:changed passed in 2,668s on parent 11c4881, including all 27 core-test type graphs, extension production/test types, Knip, lint, ratchets and final guards. Its nine focused tail gates passed 56 selected tests, including ordered reads, pending/withdrawn input authority, worker custody, projection, imports/build guards, transcript mirrors and RPC exporters (run). The lease is fully released. Selectors' nonmatching tests are skips, not additional passes.

The five-file successor only repairs the ordered-read publication fence and registers its regression in the existing database-worker test lane. A source-bound applicability audit retains the fullcheck and package/update proof for unchanged contracts; the current delta receives fresh format/lint/types/ratchets, SDK, P2, native review, CI and ClawSweeper qualification. No prior-head receipt is relabeled as current-head CI or a new package. All 13 successor static checks passed: formatting, typed lint, semantic core/Gateway test types, and the affected ratchets/temp-creation check. Fresh P2 review with all three production owners is clean. Native exact-head review and preparation passed. CI run 37349931413 completed successfully with 85 successful jobs and 23 skipped. ClawSweeper revision 32 completed at 2026-10-05 17:50 UTC on this exact head, with no actionable correctness/security findings and nothing required before merge. Native landing follows these exact-head gates.

Sharing-facts fence repair

Parent CI run 37340906733 failed one ACP shard and its aggregate: two scenarios reported GatewaySessionFactsChangedDuringReadError, and the abort/persistence-failure scenario timed out waiting for runtime start. Main's scheduled run 37333951369 independently showed the same sharing-facts error.

Five serial full-file controls on each of parent and main base reproduced that error 5/5 on both. The PR had materially more failing scenarios and three 120s timeouts, so this interaction was repaired before landing rather than classified as unchanged inherited severity. The original Linux group failed 9/250 before the repair. The failed CI job log was fetched once; no CI rerun was used.

44f2dc5c begins the caller's publication fence after source validation and all ordered FIFO admissions, immediately before the first snapshot. Previously, predecessor writes completed before admission could exhaust the refresh allowance even though the upcoming snapshot included them. Physical-store, cross-owner alias, registry, source and revocation checks remain active throughout snapshot capture and synchronous consumption. The internal synchronous callback adds no SQL, database admission, snapshot subprocess, or retry allowance.

A real-membership regression fails on the original main owner and passes after repair; it requires an actual member and exactly one consumption. Local lookup/ordered/pending-authority owners passed 37 cases in 81.13s wall, and the new regression plus full ACP file passed 13 cases in 81.58s wall. The isolated regression cost 1.382s test / 11.98s wall. The exact successor Linux proof above confirms the original failing group passes without weakened assertions, sleeps, timeouts or retries. The identical five-file repair was also published directly to main as d511ab92b63ae9709ff13eb87da9c4707060dbc4 after fresh current-main regression/ACP proof (13 cases, 84.70s wall) and clean P2 review. No unrelated main integration was added to this candidate.

Slack readiness repair

afa1a5e51d83b1ee1747930aa9e561c348cf08f5 repairs a fixture prerequisite exposed by this branch. The old one-second resolver poll expired before request gathering completed. Admission now keeps its real scheduler; fake time starts only at the resolver for post-resolver settlement. An owned gate replaces polling, while delivery, the 25ms handoff, 30s no-reply deadline, final 25ms cleanup and lease-release assertions remain intact.

The full dispatch suite passed 132/132 in 300.98s; the Slack case took 1.178s. A negative control omitting final lease release fails at the active-lease assertion. On integrated c487eadd, readiness passed again in 1.472s test / 80.52s wall. Its dispatch/admission/scheduler/fixture inputs remain unchanged. The precise asynchronous dependency behind the old readiness delay was not isolated; this is fixture readiness/clock ownership evidence, not a claim of a Slack production bug. No new Gateway boot or production test seam was added.

Released SDK and published-driver boundary

Changed functions were traced through src/plugin-sdk exports, runtime APIs, documented subpaths, and released v2026.9.8 source. Released synchronous callback shapes are retained; new async readers and the relocated helper are internal. The new ordered admission hook is internal too. The native report conservatively includes its declaration in a wildcard subtree, which requires a refreshed report but does not make it a public export or justify compatibility scaffolding.

Parent 11c4881 native SDK comparison passed in 195.300s, digest 408de91ca583d05fbc6354c9ecf52ec8dfe40fa5cb08cc5a72860da46fd5cc98, with zero PR-scoped compatibility findings. The fresh successor 44f2dc5c report passed in 244.758s, digest e5246f6040e7d9360b53eaf51ffd9d173ae006a9dbb02111e2487d111590a46d, with zero introduced compatibility findings. Its sole declaration change from the parent is the internal optional onReadAdmitted callback; dependent closure hashes follow that change. Release-wide main-owned removals of the persistent-dedupe migration functions/types from #165288 remain outside this PR's API delta; no function-specific removal record was found, and this report is not blanket approval of upstream release compatibility.

Parent 11c4881 package/integrity passed in 669s, tarball SHA-256 5c588e42f960f3e5ad41869eeac2e6e0cd028d2e5cb063e653d6991fdf64028e. Its published-2026.9.8-driver update cell passed in 456s. Candidate, durable after-record and live service agree on 2026.9.8-11c4881282ee-2026-10-05T16-35-24.857Z, distinct from the release. Readiness was 200, the service settled, durable history was unchanged, incognito history was empty (1,073 files/six databases scanned), and PID replacement/orphan-sidecar assertions passed. The lease is released. Update/service/bootstrap/schema/wire/packaging owners and harness inputs are unchanged by the five-file repair; this remains evidence for the named parent artifact, not a newly built successor.

Earlier failure disposition and follow-up debt

Main was merged for independently proven failures. The dead policy-wrapper export was reproduced on pristine main and repaired in d5fbbe86 (all three Knip scans, 57 policy/state tests and P2 passed); #165631 supplied the obsolete media-facade export repair. The missing wrapper inventory module was independently fixed by #165572. The RPC exporter fixture failed 5/5 on head and 5/5 on main after main removed descriptor fallback; registration was repaired through the production descriptor owner. A lander-introduced incomplete descriptor type was corrected in 248f3812; main independently supplied its equivalent in b9f2ea649750. Current integration retains main's canonical implementation and assertions.

The inherited projection fixture exceeded its unchanged deadline in all five head and five baseline controls. Setup now seeds 29 agents once per mode while retaining all six combinations, twelve requests, measured/warm pairs and count/probe assertions; the fix passed Linux and subsequent full checks. No timeout or budget was raised. Real async-caller, prepared-write, fixture-settlement and partial-module-mock defects were also repaired and reviewed. Main's BOOT/cron routing, catalog types, dead exports and obsolete ratchet entries were incorporated without weakening baselines.

Earlier reset-authority, Talk and usage failures were not conclusively attributed after the required controls. The reset group passed 198/198 and five full files on each head/base; no fix is inferred from those passes. Talk's one authorized diagnostic replay repeated its failure. A separate controlled probe proved premature cleanup of accepted preparation; the owner now joins it before restoring shared state, and all eight cases plus the 297-case group pass, without claiming conclusive attribution of the original stale-row error. Usage's five head/base files and one replay passed; its original failure remains unproven. Current-head CI remains independently required.

Original authority/lifecycle proof includes foreign commits, physical-source replacement, post-await revocation, close-prelude draining and maintenance; the final-anchor regression fails before repair. Historical CI run 37231973459 used 8,882 summed Node-test runner-seconds including co-sharded tests/setup, not incremental PR cost. Focused wall times include the native wrapper, transforms and real storage/worker setup.

Legacy synchronous placement preservation remains debt at src/gateway/server-worker-placement-startup.ts:384 → src/gateway/worker-environments/placement-store.ts:382. Existing short indexed reads of other owners may retain live revocation checks inside a worker grant; no zero-host-SQL assertion is imposed on them. Worker read amplification is a separate follow-up. This PR does not remove every Gateway-thread session read.

… workers

Move current chat admission, reply authority, lifecycle preparation, verbosity, and maintenance reads through existing workers. Retain physical source identity and foreign-commit freshness, preserve accepted lifecycle settlement through close, and carry prepared transcript selection facts.
Join accepted event batches and listener settlement in fixtures. Keep restart metadata preparation with the work-admission owner and make callback this contracts explicit.
@clawsweeper

clawsweeper Bot commented Oct 4, 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 docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: XL labels Oct 4, 2026
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 1:50 PM ET / 17:50 UTC (Revision 32).

ClawSweeper review

What this changes

Moves session reads for reply delivery, restart recovery, lifecycle persistence, progress visibility, and maintenance admission into existing workers while preserving synchronous plugin callbacks.

Merge readiness

✅ Ready for maintainer review

The broader worker migration remains useful on current main. The committed fence repair and recorded qualification address the previous ACP blocker; no actionable correctness or security findings remain.

Priority: P2
Reviewed head: 44f2dc5c239e8bdc5d3c6fd9b9c4347ba5c9c132

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent worker cutover with substantial source-bound evidence and the previous concrete blocker resolved.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Recorded Gateway workload observations exercise the migrated session readers and lifecycle owners; the published-driver cell verifies real runtime recovery and durable-state preservation for the named parent artifact. The successor fence change has fresh real-storage/worker and ACP qualification, with earlier evidence retained under its original identity. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Recorded Gateway workload observations exercise the migrated session readers and lifecycle owners; the published-driver cell verifies real runtime recovery and durable-state preservation for the named parent artifact. The successor fence change has fresh real-storage/worker and ACP qualification, with earlier evidence retained under its original identity. No stored-data contract changes.
Evidence reviewed 8 items Pinned introduction and review continuity: Reviewed the merge-base-to-head changes and the five-file successor against previously reviewed parent 11c4881. The successor commits the previously outstanding fence repair without weakening the ACP assertions or increasing retry allowances. The supplied test merge is stale and was not used to infer removal of main behavior.
Publication fence preserves fresh membership: The ordered reader validates retained sources after acquiring all writer admissions, invokes the caller fence immediately before snapshot capture, and retains publication and native-mutation checks through synchronous consumption. The new regression performs real membership writes before admission and requires current members plus exactly one consumption.
Current main still needs the broader cutover: Pinned main contains the narrow fence repair as d511ab9, but lifecycle persistence still calls synchronous loadSessionEntry and server-chat still performs synchronous restart-recovery lookups. Local main-blob inspection encountered an HTTP 403 during lazy retrieval; exact-revision GitHub contents reads successfully supplied the source instead.
Findings None None.
Security None None.

How this fits together

The Gateway uses stored session facts to authorize turns, deliver replies, and persist lifecycle outcomes. Existing database workers prepare those facts while Gateway owners retain current authority and join accepted work before shutdown.

flowchart TD
  A[Incoming turns and lifecycle events] --> B[Gateway session owners]
  B --> C[Retained store discovery]
  C --> D[Ordered database worker reads]
  D --> E[Current authority checks]
  E --> F[Reply delivery and lifecycle writes]
  F --> G[Accepted work settles before shutdown]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +452, Tests +1083, Docs +11, Other -10. Total +1536 across 77 files.

View PR surface stats
Area Files Added Removed Net
Source 29 679 227 +452
Tests 46 1916 833 +1083
Docs 1 11 0 +11
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 10 -10
Total 77 2606 1070 +1536

Review metrics

Metric Value Why it matters
Production versus test growth production net +452 lines; tests and support net +1,083 lines Production growth implements retained reader custody, event ordering, and lifecycle settlement through existing owners.

Technical review

Best possible solution:

Keep session reads with existing workers, preserve current authority at consumption and commit, and settle accepted lifecycle work before teardown.

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

Not applicable to the performance migration itself; the repaired fence failure has a concrete real-membership regression and recorded failing-before/passing-after qualification.

Is this the best way to solve the issue?

Yes. The patch extends existing worker and lifecycle owners, retains released callbacks, and couples final reply decisions to one current snapshot.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded runtime performance and ownership improvement with the prior ACP interaction repaired.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Recorded Gateway workload observations exercise the migrated session readers and lifecycle owners; the published-driver cell verifies real runtime recovery and durable-state preservation for the named parent artifact. The successor fence change has fresh real-storage/worker and ACP qualification, with earlier evidence retained under its original identity. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded Gateway workload observations exercise the migrated session readers and lifecycle owners; the published-driver cell verifies real runtime recovery and durable-state preservation for the named parent artifact. The successor fence change has fresh real-storage/worker and ACP qualification, with earlier evidence retained under its original identity. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduction and review continuity: Reviewed the merge-base-to-head changes and the five-file successor against previously reviewed parent 11c4881. The successor commits the previously outstanding fence repair without weakening the ACP assertions or increasing retry allowances. The supplied test merge is stale and was not used to infer removal of main behavior. (src/config/sessions/session-entry-read-ordered.ts:126, 44f2dc5c239e)
  • Publication fence preserves fresh membership: The ordered reader validates retained sources after acquiring all writer admissions, invokes the caller fence immediately before snapshot capture, and retains publication and native-mutation checks through synchronous consumption. The new regression performs real membership writes before admission and requires current members plus exactly one consumption. (src/gateway/session-utils-store-lookup.freshness.test.ts:12, 44f2dc5c239e)
  • Current main still needs the broader cutover: Pinned main contains the narrow fence repair as d511ab9, but lifecycle persistence still calls synchronous loadSessionEntry and server-chat still performs synchronous restart-recovery lookups. Local main-blob inspection encountered an HTTP 403 during lazy retrieval; exact-revision GitHub contents reads successfully supplied the source instead. (src/gateway/session-lifecycle-state.ts:362, d511ab92b63a)
  • Lifecycle and final-effect authority: Lifecycle writes retain captured physical sources and canonical targets, serialize aliases, and compose live run authority into the existing writer guard. Final reply decisions consume lifecycle and transcript anchors in one retained snapshot. Inspected coverage rejects retired claims, foreign lifecycle changes, replaced maintenance sources, and transcript branch changes; the real Gateway close case joins accepted preparation before closing databases. (src/gateway/session-lifecycle-persistence-owner.ts:93, 44f2dc5c239e)
  • Complete captured body and completed qualification: The full GitHub body matches captured SHA-256 70c657e7f1d5e02f1990c61f011dcaabefd4a6295dea25ff366883691e1f4cbf, including the omitted tail. It records the exact successor tree passing the freshness regression, all 12 ACP completion cases, and all 250 cases in the originally failing group on Linux/Node 24.19.0: https://crabbox.openclaw.ai/portal/runs/run_02e7e3313ddea7e74d9bd8c1bcda8367. Parent full changed checks passed in 2,668 seconds; successor static checks and SDK comparison are recorded separately, satisfying the prior concrete rank-up request without relabeling parent CI. (44f2dc5c239e)
  • Runtime, released SDK, and update evidence: The captured body retains original Gateway-workload measurements and authority/lifecycle observations, explicitly identifying them as historical rather than current latency results. The published v2026.9.8 driver successfully updated to parent 11c4881 with HTTP 200 readiness, matching running-build identity, preserved durable history, empty incognito history, and settled service cleanup: https://crabbox.openclaw.ai/portal/runs/run_37bc3c908b6e0c7ccb3cf032c5fadc7a. The successor does not change schema, stored formats, updater, service, or packaging owners; its refreshed SDK report records zero introduced compatibility findings. (11c4881282ee)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (31 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-05T14:14:50.026Z sha 248f381 :: blocked before merge. :: none
  • reviewed 2026-10-05T14:37:07.495Z sha 4c14deb :: blocked before merge. :: none
  • reviewed 2026-10-05T15:24:16.199Z sha 20d3090 :: blocked before merge. :: none
  • reviewed 2026-10-05T15:37:50.996Z sha c487ead :: blocked before merge. :: none
  • reviewed 2026-10-05T15:58:45.015Z sha c487ead :: blocked before merge. :: none
  • reviewed 2026-10-05T16:21:09.032Z sha c487ead :: needs changes before merge. :: none
  • reviewed 2026-10-05T16:33:07.009Z sha 11c4881 :: needs changes before merge. :: none
  • reviewed 2026-10-05T17:32:24.796Z sha 11c4881 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Oct 4, 2026
Merge main to resolve session admission and event-test conflicts. Preserve the qualified worker-backed admission owner from #164682 and main's consolidated tests, awaiting asynchronous event handling where required. Reuse internal-effects filtering across both Gateway read paths.\n\nThe complete candidate is clean through P2 autoreview. Focused conflict tests and remaining changed-check and published-driver update gates are tracked on #165028.
Use the existing async-aware event subscription helper in the consolidated
verbosity test. The previous merge retained the plain unsubscribe callback
while awaiting its drain method, causing a TypeError before the assertions.

The corrected event-handler file passes all 82 tests. Together with the four
unchanged passing files, the integrated focused group covers 163 cases.
The one-line fixture correction is clean through P2 autoreview.
@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. and removed 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. labels Oct 4, 2026
Merge main's transcript-context lane while retaining its prepared-start
validation and released callback compatibility. Use the captured session
initialization binding instead of a caller-thread session read, and combine
context validation with lifecycle facts in the final anchor snapshot.

Focused reply, anchor, context, runtime-build and import checks pass. P2 review
raised a conditional global-alias concern, rejected after independent source
tracing: the final read uses an admission receipt created from the selected
stored key, and mismatched admission/session keys are refused beforehand.
No actionable review finding remains.
Await asynchronous agent-event consumers and projection disposal. Move lifecycle fault injection to prepared callbacks, and track accepted writes through owner-controlled persistence before fixture cleanup. Initialize runtime config before observing row publications.
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

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: 🦐 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. labels Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Oct 5, 2026
Incorporate the media facade cleanup from #165631 and the independently
reproduced activation-wrapper export fix. Preserve the session-authority
cutover alongside main's accepted message-injection settlement and fresh
user-turn input custody. All policy assertions stay intact.

The full candidate P2 and independent integration reviews are clean.
The resulting tree is identical to the reviewed candidate; the published
main repair is retained as the second parent. Refreshed qualification follows.
@steipete

steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

A row publication before ordered FIFO admission describes state the coming
snapshot will include. Starting the outer fence earlier can exhaust its
refresh budget and reject current sharing facts before dispatch starts.

Validate retained discovery and begin the caller fence after every selected
FIFO is admitted, before the first snapshot. Keep physical-store, alias,
source, and revocation fencing active during capture and consumption. The
new callback is internal and performs no SQL or database admission.

A real-membership regression fails on the previous owner and passes after
this change. Existing lookup, ordered-read, and pending-input owner suites
pass, as do all 12 ACP completion cases locally. The isolated regression takes
11.98s wall time including wrapper setup; no timeout, retry, or assertion was
weakened. Scoped lint, types, and P2 review pass.
@steipete

steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 4bd8ee5 into main Oct 5, 2026
189 of 190 checks passed
@steipete
steipete deleted the dbasync/sessauthtail branch October 5, 2026 17:59
@steipete

steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
Populate gateway method descriptors from the fixture's existing lazy handlers.
The dispatcher now consumes descriptors, so the handler-only fixture rejects
its synthetic method before reaching lazy preparation. Keep admin scope,
timing, exporter, authorization, and cleanup assertions unchanged.

Found while qualifying openclaw#165028; the original failure reproduced in all five
runs on its head and all five runs on the incorporated main baseline.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
… workers (openclaw#165028)

* perf(sessions): serve remaining per-turn session authority reads from workers

Move current chat admission, reply authority, lifecycle preparation, verbosity, and maintenance reads through existing workers. Retain physical source identity and foreign-commit freshness, preserve accepted lifecycle settlement through close, and carry prepared transcript selection facts.

* refactor(sessions): finish async admission cutover

Join accepted event batches and listener settlement in fixtures. Keep restart metadata preparation with the work-admission owner and make callback this contracts explicit.

* test(sessions): drain the merged event subscription fixture

Use the existing async-aware event subscription helper in the consolidated
verbosity test. The previous merge retained the plain unsubscribe callback
while awaiting its drain method, causing a TypeError before the assertions.

The corrected event-handler file passes all 82 tests. Together with the four
unchanged passing files, the integrated focused group covers 163 cases.
The one-line fixture correction is clean through P2 autoreview.

* test(gateway): finish async lifecycle fixture cutover

Await asynchronous agent-event consumers and projection disposal. Move lifecycle fault injection to prepared callbacks, and track accepted writes through owner-controlled persistence before fixture cleanup. Initialize runtime config before observing row publications.

* test(gateway): preserve lifecycle fixture module exports

Use partial mocks for lifecycle preparation, session entry writes, and worker reads. Remove the three obsolete mock-factory baseline entries. The five affected tests, typed core lint, mock-export scanner, and P2 review pass.

* test(gateway): serialize malformed-row fixture writes

Join the physical-store writer queue before inserting the malformed fixture
row. Session replacement starts asynchronous maintenance; an uncoordinated
synchronous host write can block the admission callback a worker needs to
release its SQLite lock.

Preserve the raw bytes, post-admission position, lack of publication, and
all assertions. The original lock reproduced in CI and one of five head
controls; the targeted repaired case, typed lint, formatting, and P2 review
pass. The separate slow handle-cap case remains recorded in local controls.

* test(gateway): settle Talk fixture lifecycle work before reseeding

Join observed request and root work, accepted lifecycle preparation, and
transcript publication before clearing the shared Talk fixture. Writer
queue draining alone cannot see preparation still waiting on worker reads.
Reuse the existing observer and preparation tracker; preserve every Talk
behavior assertion and the real persistence path.

A controlled probe showed cleanup could outpace accepted preparation, but
did not identify the exact CI conflicting writer. The repaired Node 24
full file passes all eight cases; its exact CI merge/shard composition
passes all 297 tests. Typed lint, formatting, and P2 review pass. No timer,
retry, production API, or per-test Gateway boot is added.

* test(reply): isolate Slack lease cleanup from admission readiness

Keep request admission on its real scheduler and control only post-resolver handoff and final settlement with fake time. Replace the one-second resolver poll with an explicit owned gate, preserve delivery assertions, and verify lease release at its configured 25 ms bound. Move the unchanged Slack fixture into the existing harness to satisfy the line cap. All 132 dispatch cases pass; an omitted final release still fails the lease assertion; P2 review is clean.

* test(gateway): share private completion recorder assertions

Move the unchanged recorder checks into existing private-completion fixture support while preserving the parent callback and current-session binding. This resolves the Testbox line-cap failure without removing assertions or changing deadlines. Full private-completion proof passes 23 cases in 338.21 seconds; typed lint, line cap, formatting, and P2 review pass.

* refactor(meetings): keep fixture-only types in test support

* test(gateway): reuse session projection fixture seeds

* test(gateway): construct complete exporter method descriptors

Use the production plugin descriptor constructor so the synthetic RPC fixture
supplies the required profileAccess contract. The handler-map conversion helper
returns input descriptors intended for later normalization, not the completed
descriptors stored by the plugin registry.

Keep the same lazy handlers, method names, admin scope, and runtime assertions.
The exact failing root-test type graph and all ten method-registry cases pass.

* test(gateway): align projection fixture comment with main

* fix(sessions): fence sharing snapshots after writer admission

A row publication before ordered FIFO admission describes state the coming
snapshot will include. Starting the outer fence earlier can exhaust its
refresh budget and reject current sharing facts before dispatch starts.

Validate retained discovery and begin the caller fence after every selected
FIFO is admitted, before the first snapshot. Keep physical-store, alias,
source, and revocation fencing active during capture and consumption. The
new callback is internal and performs no SQL or database admission.

A real-membership regression fails on the previous owner and passes after
this change. Existing lookup, ordered-read, and pending-input owner suites
pass, as do all 12 ACP completion cases locally. The isolated regression takes
11.98s wall time including wrapper setup; no timeout, retry, or assertion was
weakened. Scoped lint, types, and P2 review pass.
steipete added a commit that referenced this pull request Oct 9, 2026
Retain the prompt admission through terminal emission and join its accepted
terminal writes before finalization seals the saved continuation. Explicit
close and replacement still revoke immediately.

The asynchronous lookup introduced by #165028 let sealing overtake the
cancellation write. The unchanged Gateway regression passes on the parent,
fails on that commit, and passes with this fix.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 10, 2026
)

Retain the prompt admission through terminal emission and join its accepted
terminal writes before finalization seals the saved continuation. Explicit
close and replacement still revoke immediately.

The asynchronous lookup introduced by openclaw#165028 let sealing overtake the
cancellation write. The unchanged Gateway regression passes on the parent,
fails on that commit, and passes with this fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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