Skip to content

fix(gateway): serve startup reads while sessions resume - #195987

Merged
steipete merged 6 commits into
mainfrom
steipete/perf-micro-readiness-waits-on-restart-resume-20260919
Nov 9, 2026
Merged

steipete merged 6 commits into
mainfrom
steipete/perf-micro-readiness-waits-on-restart-resume-20260919

Conversation

@steipete

@steipete steipete commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Gateway readiness and startup reads waited for every interrupted session's recovered input to enter its queue. Connected dashboards received repeated startup UNAVAILABLE responses even when their data owners were ready.

User Impact

Readiness and owner-ready models.list, mentions.list, and sessions.github.options now proceed while interrupted sessions resume. Unrelated sessions can accept turns; fresh input for a recovering session waits behind its resumed turn and retained FIFO inputs. No runtime configuration or schema change is required.

Why This Change Was Made

The existing database startup observation now owns waits keyed by physical agent and canonical session. Discovery installs them before startup unlock, and deferred preparation installs them before native write admission. Input entry points resolve their session and wait before reading mutable session state or persisting fresh input. The router's agent-wide recovery rejection is removed. Database readiness, live authority, failure settlement and shutdown stay with their existing owners.

Control UI already backs off startup failures from 500 ms through eight seconds (#190159); no UI runtime change was needed. Production code is net +136 lines for session completion/lifetime bookkeeping and the admission callers. The 316 added test lines have an exact per-change allocation under the documented policy; the shared scalar is unchanged.

Bare-key FIFO correction

The held P2 finding was real at 112c36ecd9b502117365f0d4f252175d6303df77: admission expanded main aliases but failed to qualify an ordinary bare session key. It could miss the recovery promise keyed by the canonical persisted session and let fresh input overtake resume. Admission now reuses resolveSessionStoreKey for requests carrying config and its existing canonicalizeSessionKeyForAgent helper for config-less channel/recovery paths. The separate normalization is removed; logical session identity remains separate from physical store ownership. All chat, agent-routing, command, channel, cron and auto-reply callers were checked.

The existing real-Gateway regression holds recovery for agent:main:startup-resuming, then sends chat.send with agentId: "main" and sessionKey: "startup-resuming". It fails on 112c36ec because the fresh input is persisted before recovery is released, and passes with the repair. Readiness, the three reads, unrelated-session progress and resumed-before-fresh transcript/provider ordering remain covered. All 59 selected tests passed, including shared-store/main-alias/failure/cancellation and caller suites. Codex autoreview is scoped-clean through P2. The correction-scope pnpm check:changed --base 112c36ec --timed completed: production and all core-test typechecks, format, lint, database, boundary and architecture checks passed; its only failures were the same archived-changelog attribution and unused authorDisplayName export failures attributed below. This correction is production LOC-neutral and extends the existing regression by one line, covered by its exact allocation; it adds no test boot, config, schema or cache.

The PR remains held and unmerged; auto-merge stays disabled. The performance measurements below are retained evidence from the earlier runtime head and were not rerun for this key-identity correction. Prior-head green CI is not claimed as correction-head proof.

Wrapper closure correction

The wrapper closure test passes on current main b76460823ef0 and reproduces the 159 missing-file failure at a12c5796. All 159 were reached through the canonical-resolver import added by that bare-key correction: four Gateway session modules and 155 protocol modules pulled in by session-request-error.ts importing the protocol barrel. The startup benchmark scripts were not the cause.

The error adapter now imports the same ErrorCodes and errorShape values directly from their existing owners, keeping ErrorShape type-only. That removes 151 unnecessary protocol files from the new closure. The wrapper inventory explicitly adds the eight remaining runtime inputs. Both the failing dynamic-closure test and eager wrapper inventory test pass; 27 session-key/request-agent tests, production typechecks, targeted lint and formatting pass. Codex autoreview is scoped-clean through P2. No test assertions or workflow gates were weakened. This repair is production LOC −2, inventory +8; total PR production delta is now +136.

ClawSweeper’s open P2 filed on a859d606 is the bare-session-key FIFO issue fixed by a12c5796; this closure repair preserves that fix. The actual prior UI log reaches Chromium tests: chat-transcript-geometry-updates.browser.test.tsx > holds deferred reader compensation without interrupting native scrolling expected scroll position 510 and received 480. The FetchTimeout matches were printed checkout-helper source, not the terminal failure. This transcript-area failure is outside the authorized repair scope and is not claimed as inherited or fixed. Exact-head CI run 42659606400 is pending on 1d9b42b618649334ce824f9325d430c5e986f956. Its build is queued for blacksmith-4vcpu-ubuntu-2404 with no runner assigned; the tooling and UI shards are still queued. Green CI is not yet verified, and the PR must stay unmerged.

Evidence

The real public-Gateway regression fails on exact parent 7c78826284047427953b13ed70006e24b4ec5709 with readiness 503 while resume authority is held. It passes here, proving the three reads, unrelated-session progress, and resumed-before-fresh ordering in both provider requests and persisted transcript. Exact-key/session-ID regressions also fail on the parent before reading recovered state and pass here. Focused recovery, routing, startup, state, cron and transport tests, affected Chromium post-deploy tests, and the signed-in retained-input FIFO E2E passed.

Acceptance: readiness must progress while resume admission is held, owner-ready reads must stop receiving startup refusals, all nine roots must recover, and same-session FIFO must hold. CPU and memory use are compared at a matched completion endpoint.

Five interleaved synthetic A/B pairs plus four unchanged-parent controls used 10,000 sessions across eight agents, a 35.093 GiB agent DB, 12.032 GiB shared state, 62,000 workspace files/1.100 GiB, 46 synthetic plugins, nine interrupted roots and 155 stale rows. Inference was local and synthetic; probes ran every 500 ms. Each successful boot resumed nine roots, skipped 155 stale rows, reached nine inference requests and shut down cleanly. CPU/RSS cover the same recovery, inference and maintenance endpoint.

Metric, five successful paired boots per arm Parent Candidate
Median readiness 21.427 s 17.238 s (−19.6%)
Readiness p95/max, n=5 26.224 s 20.126 s
Median final ready phase 2,748.2 ms 80.8 ms
Startup UNAVAILABLE, five boots total 156 0
All UNAVAILABLE, five boots total 156 7
Median process-tree CPU 36.990 s 36.010 s
Median peak RSS 2,135.3 MiB 2,157.4 MiB

The seven remaining responses were model-catalog revision retries. Initial A/A readiness was 22.063/19.726 s; closing controls were 20.164/20.286 s. CPU and RSS are near-neutral observations, not a resource-optimization claim. With five samples, p95 is the maximum. One failed candidate timing boot is retained separately, so the table is conditional on successful startup.

Workload: node --import ./scripts/tsx.mjs scripts/bench-gateway-startup.ts --case teamBoot --team-scale --restart-sessions 9 --fixture-root <fixture> --entry <pinned-dist/entry.js> --gateway-runtime <node> --runs 1 --warmup 0. Both arms used matching production builds, fresh processes and disabled compile caches. Native qualification after each APFS clone was recorded separately and excluded from startup. Cloning also invalidated credential bindings, so both arms performed existing credential repair/integrity work. APFS restored-state measurements do not predict an exact production btrfs saving. These measurements use runtime 00ef8ccd; the subsequent bare-key identity correction was not benchmarked again. Saved measured-runtime artifacts were restored and hash-verified after the earlier test builds.

Allocation proof is partial: two parent controls sampled 4.563/4.538 GB of main-isolate allocation volume; two paired parents sampled 4.526/4.525 GB and candidates 4.476/4.475 GB. The candidate observations encountered host contention and a seven-minute post-qualification delay. A separately labeled immediate-start repeat sampled 4.486 GB and removed the long pre-Gateway delay. The original observations remain recorded; there is no completed five-pair allocation or precise allocation-improvement claim. The parent CPU profile covers 31 isolates; candidate profiling failed before bind, and a final qualified diagnostic failed native temp-root setup. Complete candidate post-resume CPU-profile coverage is unavailable.

Checks and Remaining Limitations

pnpm check:changed ran fully; own type errors were corrected and affected checks rerun. Core test types, scripts types, targeted lint/format and the exact test-line budget pass. SQLite T1 calls remain 167 → 167, with no portability violations or runtime import cycles. Codex autoreview of the production change and later corrections is clean through P2.

CI exposed and this PR repairs missing wrapper source dependencies, the Workshop mock's missing onPrepared callback, and two older fixture mismatches. The signed-in FIFO fixture needed its existing graceful-stop option (#192444). The finalizer fixture still expected state refusal despite #195902 deliberately preserving accepted-finalizer access; the exact parent reproduces that assertion mismatch. The existing owner test passes for both admission during drain and refusal after host closure. Both Workshop cases pass on the pinned Bun runtime; its following registry-change error did not recur.

The focused macOS finalizer E2E remains locally red on unchanged shutdown checks: SIGTERM took 11.694 s against ten (the exact parent also took 10.659 s), and a later managed stop stalled in final shared-state retirement after the clean-shutdown log. These are unresolved observations, not claimed fixed or attributed as inherited. Thresholds remain unchanged. The earlier Linux CI run failed the stale finalizer expectation but not those timing assertions. Prior-head CI run 42641889584 passed on 112c36ecd9b502117365f0d4f252175d6303df77, including openclaw/ci-gate.

Separate main defects have exact-parent reproduction and inspected introducing changes: archived changelog attribution (#194364, 266a7aa0fe69), dead dashboard export (#194455, cde34f111b4d), and pre-bind SQLite cold admission (#157413, 8b16e5328ecd). In the latter, successful preparation exhausts a five-second budget, leaving the first lease write with busyTimeoutMs=0 against a concurrent writer. Failed boots on both arms remain in the evidence; no timeout policy, schema, or filesystem safety guard was changed to bypass them.

This PR remains held for review of the correction and must stay unmerged; auto-merge is disabled.

Install per-session recovery admission before readiness unlock so fresh turns preserve resume and retained-input ordering without holding unrelated sessions. Let catalog reads use owner readiness and remove the agent-wide recovery rejection. Include synthetic restart benchmarking and real Gateway ordering regressions.
@clawsweeper

clawsweeper Bot commented Nov 9, 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 app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling size: XL labels Nov 9, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR replaces agent-wide restart-recovery blocking with session-specific admission waits so reads and unrelated conversations can proceed.

Example: agent:main:startup-resuming is recovering while agent:main:startup-healthy receives a message.

  • Before: Recovery holds Gateway readiness and unrelated input behind recovered admissions.
  • After: Reads and the healthy conversation proceed while fresh input to the recovering conversation waits.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful owner-approved direction and meaningful integration coverage, with a concrete session-alias ordering defect blocking correctness.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its supplied evidence describes an in-process real-Gateway regression with synthetic inference, while runtime and performance verification remain explicitly pending.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: After restarting, users encounter a dark startup window and repeated unavailable responses while interrupted conversations resume.
Reason: The maintainer-authored direction restores independent conversation availability using the existing admission owner.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this maintainer-owned startup fix is useful, but bare session aliases bypass the new recovery barrier.

Priority: P2
Reviewed head: a859d606d5406a3a95cbbde61bc29e80eac6da1d

Before merge

  • [P2] Canonicalize bare session keys before recovery lookup (P2) - Hold recovery for agent:main:startup-resuming, then send chat.send with agentId: "main" and sessionKey: "startup-resuming". The new wait preserves that bare key because canonicalizeMainSessionAlias only handles main aliases, so the exact recovery-map lookup finds no promise. The subsequent Gateway session loader qualifies it to the recovering conversation, allowing fresh queue admission and transcript persistence before recovery. A later command-level wait cannot restore those queue positions. Resolve the key through the existing canonical routing owner before lookup and cover the bare address in the Gateway ordering regression.

Findings

  • [P2] [P2] Canonicalize bare session keys before recovery lookup — src/state/agent-database-preparation-context.ts:124-129

Tests

  • Missing end-to-end proof: The declared pinned-runtime, signed-in retained-input FIFO, and serial benchmark runs remain in progress; no completed shipped-entry-point result for this head was supplied.
Agent review details

How this fits together

Gateway startup discovers interrupted sessions, registers recovery waits with the database startup owner, and admits recovered and fresh inputs into the existing session queues.

flowchart TD
  A[Gateway startup] --> B[Recovery discovery]
  B --> C[Database startup owner]
  D[Incoming reads and turns] --> C
  C --> E[Ready reads and unrelated sessions]
  C --> F[Recovering session wait]
  F --> G[Existing session queue]
Loading

Technical review

Best possible solution:

Use the existing canonical session-routing owner before recovery lookup so every supported address for a conversation joins the same wait.

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

Current main visibly waits for recovery before unlocking input; source also establishes the introduced alias bypass without running target code.

Is this the best way to solve the issue?

Session-specific waits fit the existing startup owner and preserve the intended ordering contract once lookup uses the same canonical identity as session routing.

Full review comments:

  • [P2] [P2] Canonicalize bare session keys before recovery lookup — src/state/agent-database-preparation-context.ts:124-129
    Hold recovery for agent:main:startup-resuming, then send chat.send with agentId: "main" and sessionKey: "startup-resuming". The new wait preserves that bare key because canonicalizeMainSessionAlias only handles main aliases, so the exact recovery-map lookup finds no promise. The subsequent Gateway session loader qualifies it to the recovering conversation, allowing fresh queue admission and transcript persistence before recovery. A later command-level wait cannot restore those queue positions. Resolve the key through the existing canonical routing owner before lookup and cover the bare address in the Gateway ordering regression.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/gateway/server-startup-resume.test.ts --maxWorkers=1
  • pnpm test src/agents/command/session.exact-target.test.ts src/gateway/session-restart-resume.test.ts --maxWorkers=1
  • Verify the bare-key ordering regression fails on the pre-repair PR head and passes after repair.
  • Run targeted typecheck, lint, and format checks for the repaired files.

What I checked:

  • Current main retains the global startup wait: The startup observer awaits resumeMarkedSessions before unlocking external input; this PR moves that unlock after recovery waits are registered. (src/gateway/server-startup-observers.ts:69, 11a13b63d492)
  • Recovery lookup misses bare aliases: Input admission normalizes structural casing and main aliases, but does not qualify an ordinary bare key; the observation then performs an exact lookup against persisted session keys. (src/state/agent-database-preparation-context.ts:124, a859d606d540)
  • Existing routing accepts qualified and bare addresses: resolveSessionStoreKey qualifies ordinary bare keys for the selected agent, while resolveChatSendSessionKey leaves those keys unchanged before the new wait. (src/gateway/session-store-key.ts:138, a859d606d540)
  • Fresh input can persist before downstream command preparation: Chat admission registers the canonical session queue source, and local fresh input is persisted before agent dispatch; a later command-level wait cannot restore that ordering. (src/gateway/server-methods/chat-send-input-dispatch.ts:401, a859d606d540)
  • Relevant regression covers qualified keys: The added Gateway harness exercises readiness, all three reads, unrelated input, and model/transcript ordering, but sends fresh input using the fully qualified recovery key. (src/gateway/server-startup-resume.test.ts:23, a859d606d540)
  • Discussion and supplied proof inspected: The PR remains draft with runtime, signed-in FIFO, and performance results explicitly in progress; its comments contain bot status only, and the four prepared images depict the related dashboard change. (a859d606d540)

Likely related people:

  • Shakker: Raw commit 9bf3231 adds src/state/agent-database-startup-observation.ts:19 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9bf3231d2535; files: src/state/agent-database-startup-observation.ts)

PR surface

Source +138, Tests +312, Docs +7, Other +349. Total +806 across 35 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 19 408 270 +138
Tests 13 331 19 +312
Docs 1 12 5 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 2 356 7 +349
Total 35 1107 301 +806

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Benchmark CLI option 1 new flag: --restart-sessions Adds a synthetic recovery workload to the existing startup benchmark without introducing a Gateway configuration setting.

Labels

Label changes:

  • add P2: The change improves restart availability, with a focused alias-ordering defect requiring repair.
  • add merge-risk: 🚨 session-state: A bare session address can admit and persist fresh input before that conversation's recovered inputs obtain their queue positions.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: The change improves restart availability, with a focused alias-ordering defect requiring repair.
  • merge-risk: 🚨 session-state: A bare session address can admit and persist fresh input before that conversation's recovered inputs obtain their queue positions.
  • 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 execution lanes are retired.

Reviewed November 9, 2026, 8:26 AM ET / 13:26 UTC.

The signed-in restart fixture introduced in #192444 canceled process-tree custody while expecting a clean Gateway exit. Select the existing bounded graceful-stop path so the unchanged exit, marker, authority and FIFO assertions exercise restart recovery. The original failure reproduces on parent 7c78826; the corrected full flow passes.
@steipete
steipete marked this pull request as ready for review November 9, 2026 14:01
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T16:58:43.973226Z 1d9b42b New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 1d9b42b618649334ce824f9325d430c5e986f956
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/gateway/methods/core-descriptors.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server-methods/request-authorization.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 00ef8ccdb7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +127 to +129
if (sessionKey && options.cfg) {
const { canonicalizeMainSessionAlias } = await import("../config/sessions/main-session.js");
sessionKey = canonicalizeMainSessionAlias({ cfg: options.cfg, agentId, sessionKey });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Canonicalize ordinary session aliases before recovery lookup

When agent:main:resuming is recovering, a supported chat.send request with agentId: "main" and sessionKey: "resuming" bypasses this barrier: canonicalizeMainSessionAlias leaves ordinary bare keys unchanged, so the recovery map lookup for resuming finds nothing. The subsequent session loader resolves that same key to agent:main:resuming, and chat-send-input-dispatch.ts can durably persist the fresh input before recovery admits its resume and retained FIFO inputs. The later canonical-key wait during reply dispatch is too late to prevent that persistence. Resolve the key through the same canonical store-key owner used by the session loader before selecting the recovery promise.

AGENTS.md reference: AGENTS.md:L97-L97

Useful? React with 👍 / 👎.

Include the two session-key modules reached by startup admission in the materialized PR wrapper. Allocate exactly 312 regression-test lines for distinct Gateway readiness/FIFO, session-ID hydration, and shared-store admission contracts; leave the shared test budget scalar unchanged.
…ners

Signal discovery completion from the Workshop startup mock. Expect accepted finalizers to retain state access during drain, matching the documented change in #195902, while preserving terminal refusal and shutdown timing checks. Extend the exact per-change test allocation by the three added mock lines.
@steipete

steipete commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Landing note (maintainer review). Team r302 (2026-11-09 12:05Z) spent 8.9 s of readiness waiting for startup restart resume. It rejected 181 requests as startup UNAVAILABLE meanwhile (incl. 9 chat.send). Readiness and startup methods now unlock once resume discovery has prepared each marked session. Fresh turns wait only behind their own session's recovery, with per-session FIFO preserved across chat.send, agent routing, channels, cron and auto-reply. Owner-ready reads proceed immediately. Synthetic: ready phase 2,748 → 81 ms, startup UNAVAILABLE 156 → 0.
ClawSweeper's P2 on a859d60 (bare session keys bypass the recovery wait) is fixed at a12c579: admission resolves keys through the canonical store-key resolver used by recovery registration, and the exact scenario is a regression test that fails before the fix. The wrapper-closure inventory regression was fixed at 1d9b42b by narrowing a protocol import. Production +136 lines; exact-head CI green.

@steipete
steipete merged commit 585ba38 into main Nov 9, 2026
146 checks passed
@steipete
steipete deleted the steipete/perf-micro-readiness-waits-on-restart-resume-20260919 branch November 9, 2026 17:58
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 10, 2026
)

* fix(gateway): serve startup reads while sessions resume

Install per-session recovery admission before readiness unlock so fresh turns preserve resume and retained-input ordering without holding unrelated sessions. Let catalog reads use owner readiness and remove the agent-wide recovery rejection. Include synthetic restart benchmarking and real Gateway ordering regressions.

* test(gateway): use graceful shutdown for retained-input restart proof

The signed-in restart fixture introduced in openclaw#192444 canceled process-tree custody while expecting a clean Gateway exit. Select the existing bounded graceful-stop path so the unchanged exit, marker, authority and FIFO assertions exercise restart recovery. The original failure reproduces on parent 0d97c79; the corrected full flow passes.

* chore(gateway): complete startup admission proof inventories

Include the two session-key modules reached by startup admission in the materialized PR wrapper. Allocate exactly 312 regression-test lines for distinct Gateway readiness/FIFO, session-ID hydration, and shared-store admission contracts; leave the shared test budget scalar unchanged.

* test(gateway): align startup and finalizer fixtures with lifecycle owners

Signal discovery completion from the Workshop startup mock. Expect accepted finalizers to retain state access during drain, matching the documented change in openclaw#195902, while preserving terminal refusal and shutdown timing checks. Extend the exact per-change test allocation by the three added mock lines.

* fix(gateway): canonicalize session keys before recovery admission

* fix(gateway): keep canonical session routing wrapper closure complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts security-sensitive-changed 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