Skip to content

fix(sessions): prevent stranded writers after abort and restart - #146792

Merged
steipete merged 1 commit into
mainfrom
steipete/upd-abort-restart-stranded-session
Sep 13, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/upd-abort-restart-stranded-session

Conversation

@steipete

@steipete steipete commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #146692

What Problem This Solves

Fixes sessions retaining an interrupted writer after an acknowledged abort is followed immediately by a Gateway restart, and recovery being blocked by a failed startup store scan.

User Impact

A successful sessions.abort waits for terminal session persistence. Healthy stores can recover while another store retries, and status/Doctor show outstanding startup recovery failures. sessions.recover can reconcile an orphaned writer with an unfinished recovery cycle in the same session, preserving its key and transcript. Live owners and unsettled worker placements still prevent recovery.

No configuration, dependency, database schema, or retention changes are required. The candidate startup path reads existing session state, including after an older updater restarts the Gateway.

Why This Change Was Made

The abort RPC now joins the existing lifecycle persistence owner; embedded-only aborts use that same lifecycle projection with exact writer fencing. Startup and explicit recovery share one orphan planner, and the run registry owns the liveness fact used to protect active work. Marking clears the interrupted writer, checkpoints only successful stores, and leaves failed targets eligible for the existing scheduled retry budget. Failure diagnostics belong to the current Gateway generation and clear when the store scan succeeds.

Reported by @desksk (#146692) with a full trace of the admission and startup-mark paths.

Evidence

  • The real-process rig used isolated state, a local mock provider, real WebSocket RPCs, and the actual SQLite writer queue. A first SIGKILL and automatic resume produced the reported revision-4 / charged-1 / started-1 recovery row without fabricating it.
  • Before: abort acknowledged while its terminal write was held; immediate SIGKILL retained status: running, the dead writer/lifecycle IDs, and the unfinished recovery cycle. The durability assertion failed (running instead of killed).
  • After: no acknowledgment arrived during the held writer; after release, abort acknowledged and SIGKILL followed in the same millisecond. The reopened row was killed with lifecycle/recovery cycle cleared, and the first post-restart turn replied and persisted done.
  • node scripts/check-changed.mjs --staged passed, including strict production/test types, lint, unused exports, schema guards, and runtime import cycles.
  • pnpm build passed on the final source (6m 18s). The final projection/recovery verification passed 74 tests across three files; the seven abort durability cases also passed again.
  • Regressions also failed before the fixes for cross-store starvation, a live registry owner being overwritten, and sessions.recover refusing the no-tombstone shape. Focused abort tests passed (85); recovery, registry, lifecycle, status, and Doctor suites passed (435).

The reported per-store swallowed-error/checkpoint explanation does not match this baseline or cited source commit; the reproducible current defect is cross-store starvation. A healthy baseline startup eventually recovered the process-rig row, so this proof does not claim permanent stranding on a healthy boot. Windows-specific volume contention and discovery-level corruption were not exercised; discovery errors retain the existing retry/log path. The abort-terminal row can retain its writer ID until the next writer claims it; its terminal status and cleared recovery cycle prevent the admission wedge.

Current verification

Current head: e888ccbb3cdbf8800975ca6021936e9aaab077d5, rebased cleanly onto 4883e4699ee3f265762ce779d0914f40b9d5d1bf. Normalized zero-context patches remain byte-identical to the approved implementation across all 23 files.

CI run 34754984528 passed on this exact head without retries. The checkout log records merge ref 7136b5c3ba528efa537151a9ae38757888af7da7: main parent 14527ca041948939b7a87ff6e926c6ea0bc0ef16 and PR parent e888ccbb3cdbf8800975ca6021936e9aaab077d5 both descend from 912685f4422.

Local verification before the final mechanical rebase passed:

  • node scripts/check-changed.mjs --base 2acbeee461474b6ba41f5186ae1a4e0e80f4087a --head HEAD --timed: formatting, production/test types, lint, unused exports, and repository guards.
  • pnpm test with all seven PR test files, including Doctor: 283 tests passed across four routed shards.
  • git diff --check: passed again after the final rebase.

Earlier CI encountered an inherited shard-capacity assertion; the fresh merge-ref run includes the main repair and passes.

ClawSweeper review

The latest review covers e888ccbb3cdbf8800975ca6021936e9aaab077d5 and identifies no blocking code defects. No code/test fixups were required.

Skipped the request for additional Windows storage-contention and discovery-corruption proof: that limitation is already documented above and was accepted in the maintainer's scoped review and landing decision. The demonstrated repair covers abort persistence, per-store recovery starvation, and explicit orphan reconciliation; the original host's permanent-stranding cause remains unverified. The mechanical rebases preserve the reviewed implementation and evidence.

@clawsweeper

clawsweeper Bot commented Sep 13, 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 commands Command implementations agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Sep 13, 2026
@steipete
steipete marked this pull request as ready for review September 13, 2026 06:14
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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 Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 8:02 AM ET / 12:02 UTC (Revision 7).

ClawSweeper review

What this changes

The PR makes session aborts await durable cancellation, isolates startup recovery failures, restores orphaned sessions without replacing their transcripts, and displays recovery warnings in status and Doctor.

Merge readiness

✅ Ready for maintainer review

Keep open as a useful, well-supported fix that is still absent from current main. No blocking code defects were found; the prior Windows-specific coverage limitation does not justify another merge blocker.

Priority: P1
Reviewed head: e888ccbb3cdbf8800975ca6021936e9aaab077d5

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong process-level before/after evidence and focused ownership regressions support a coherent repair with no blocking findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The captured PR body reports the actual Gateway abort RPC and SQLite writer queue exercised across forced process termination: acknowledgment waited for persistence, cancellation survived reopening, and the next turn completed. Focused regressions supplement this evidence for store isolation and in-place recovery; the separately documented Windows/discovery limitation does not invalidate the demonstrated repair.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured PR body reports the actual Gateway abort RPC and SQLite writer queue exercised across forced process termination: acknowledgment waited for persistence, cancellation survived reopening, and the next turn completed. Focused regressions supplement this evidence for store isolation and in-place recovery; the separately documented Windows/discovery limitation does not invalidate the demonstrated repair.
Evidence reviewed 9 items Pinned patch and current necessity: Reviewed the merge-base-to-head changes at e888ccb. Comparing the central abort and recovery owners with fetched main 5336983 confirms main still lacks the persistence join and in-place orphan-reconciliation branch. Base-only computer-use and Feishu changes were excluded from PR ownership.
Cancellation durability and replacement fencing: Controller-backed aborts await their existing terminal-persistence owner. Embedded-only aborts use the lifecycle writer with expected run, session, and lifecycle revision checks; the regression cases cover held writes, persistence failure, and replacement writers.
Recovery retains one owner and commit-time guards: Startup and explicit recovery share the orphan planner. It rechecks registry liveness immediately before committing; explicit recovery additionally preserves session identity, plugin ownership, active-admission, and worker-placement checks. The SQLite replacement owner compares authoritative row contents before invoking the guard and writing.
Findings None None.
Security None None.

How this fits together

The Gateway’s session lifecycle connects cancellation and restart events to persisted conversation state. Its recovery owner checks whether work is still alive before allowing an interrupted conversation to continue.

flowchart TD
  A[Abort request] --> B[Lifecycle persistence]
  B --> C[Durable cancellation acknowledgment]
  D[Startup or explicit recovery] --> E[Check live owners and session identity]
  E --> F[Reconcile orphaned session]
  F --> G[Continue existing conversation]
  E --> H[Recovery warning in status and Doctor]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +385, Tests +648, Docs +15. Total +1048 across 23 files.

View PR surface stats
Area Files Added Removed Net
Source 15 533 148 +385
Tests 7 658 10 +648
Docs 1 15 0 +15
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 23 1206 158 +1048

Review metrics

Metric Value Why it matters
Production versus regression coverage production +385 net lines; tests +648 net lines Production growth supports persistence coordination, shared orphan recovery, and diagnostics; the larger test delta covers failure ordering and ownership protection.

Technical review

Best possible solution:

Preserve cancellation intent durably and reconcile genuinely ownerless sessions through the existing recovery owner while retaining their conversation history.

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

Yes for the bounded abort-persistence race: hold the terminal writer, abort, and terminate immediately after acknowledgment. Source and supplied process observations support that path; permanent stranding on the original Windows host remains unverified.

Is this the best way to solve the issue?

Yes. The patch extends existing persistence and recovery owners, preserves current authorization and writer fences, and requires no new configuration or stored format.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: The patch addresses a reported broken conversation workflow after abort and restart, with a demonstrated cancellation-durability race.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured PR body reports the actual Gateway abort RPC and SQLite writer queue exercised across forced process termination: acknowledgment waited for persistence, cancellation survived reopening, and the next turn completed. Focused regressions supplement this evidence for store isolation and in-place recovery; the separately documented Windows/discovery limitation does not invalidate the demonstrated repair.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured PR body reports the actual Gateway abort RPC and SQLite writer queue exercised across forced process termination: acknowledgment waited for persistence, cancellation survived reopening, and the next turn completed. Focused regressions supplement this evidence for store isolation and in-place recovery; the separately documented Windows/discovery limitation does not invalidate the demonstrated repair.

Evidence

What I checked:

  • Pinned patch and current necessity: Reviewed the merge-base-to-head changes at e888ccb. Comparing the central abort and recovery owners with fetched main 5336983 confirms main still lacks the persistence join and in-place orphan-reconciliation branch. Base-only computer-use and Feishu changes were excluded from PR ownership. (src/gateway/server-methods/sessions-abort.ts:336, e888ccbb3cdb)
  • Cancellation durability and replacement fencing: Controller-backed aborts await their existing terminal-persistence owner. Embedded-only aborts use the lifecycle writer with expected run, session, and lifecycle revision checks; the regression cases cover held writes, persistence failure, and replacement writers. (src/gateway/server-methods/sessions.abort-durability.test.ts:48, e888ccbb3cdb)
  • Recovery retains one owner and commit-time guards: Startup and explicit recovery share the orphan planner. It rechecks registry liveness immediately before committing; explicit recovery additionally preserves session identity, plugin ownership, active-admission, and worker-placement checks. The SQLite replacement owner compares authoritative row contents before invoking the guard and writing. (src/agents/main-session-recovery/main-session-restart-recovery-marking.ts:331, e888ccbb3cdb)
  • Failure isolation and diagnostic privacy: Only successful stores receive startup checkpoints; failed targets remain eligible for scheduled retries while healthy stores continue. Diagnostic details are redacted, terminal-sanitized, bounded, generation-scoped, and omitted for non-admin status readers. (src/agents/main-session-recovery/main-session-restart-recovery-diagnostics.ts:28, e888ccbb3cdb)
  • Real-process evidence and review continuity: The supplied PR body, captured under sourceRevision ac5957fda2393c28c00f5c50032713396f703475bf741851011b3e98ae938e74, reports real WebSocket RPCs and the actual SQLite writer queue in isolated Gateway processes. Before the fix, acknowledgment preceded the held terminal write; afterward acknowledgment waited, immediate SIGKILL preserved killed state, and a post-restart turn completed. The previous review at this same head had no findings or published rank-up moves. The updated body explicitly addresses the earlier Windows/discovery proof request and limits its claims; that historical caveat is not a new required action. (e888ccbb3cdb)
  • Reporter follow-up identifies the affected state: The reporter’s follow-up supplies the unfinished recovery-cycle shape and admission rejection, while acknowledging that missing startup logs cannot distinguish discovery failure from a failed marking write. The PR correctly separates this evidence from its reproduced cross-store starvation mechanism: [Bug]: sessions.abort + gateway restart strands activeWriterRunId, wedging session forever (SESSION_WORK_START_CHANGED) #146692 (comment).

Likely related people:

  • Peter Steinberger: 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 (6 earlier review cycles)
  • reviewed 2026-09-13T06:20:44.781Z sha 87de1ae :: needs maintainer review before merge. :: none
  • reviewed 2026-09-13T07:01:14.816Z sha 87de1ae :: needs maintainer review before merge. :: none
  • reviewed 2026-09-13T07:23:39.113Z sha 87de1ae :: blocked before merge. :: none
  • reviewed 2026-09-13T08:37:03.665Z sha 945390c :: blocked before merge. :: none
  • reviewed 2026-09-13T08:53:16.450Z sha 945390c :: needs maintainer review before merge. :: none
  • reviewed 2026-09-13T11:45:50.637Z sha e888ccb :: blocked before merge. :: none

@steipete
steipete force-pushed the steipete/upd-abort-restart-stranded-session branch from 87de1ae to 945390c Compare September 13, 2026 08:28
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 13, 2026
Fixes #146692

Reported by @desksk (#146692) with a full trace of the admission and startup-mark paths.
@steipete
steipete force-pushed the steipete/upd-abort-restart-stranded-session branch from 945390c to e888ccb Compare September 13, 2026 11:38
@steipete
steipete merged commit bac4218 into main Sep 13, 2026
187 checks passed
@steipete
steipete deleted the steipete/upd-abort-restart-stranded-session branch September 13, 2026 12:05
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (1537 commits)
  test: align plugin fixtures with current runtime contracts (#147000)
  refactor(browser): separate session tab tracking from cleanup (#146973)
  fix(tests): make systemd clock fixtures private (#146990)
  fix(linux): retire sleep guards when logind disconnects (#146046)
  refactor(matrix): share draft fallback delivery (#144840)
  fix(sessions): preserve cross-agent replies after reload (#146799)
  test(models): cover quota recovery during catalog discovery (#146708)
  fix(macos): recover browser sign-in when no browser opens (#146787)
  fix(process): prevent one-shot agents exiting while polling (#144268)
  fix(status): label the session inventory as stored (#146979)
  fix: avoid repeated background reads while loading chat (#146953)
  refactor(ui): narrow Skill Workshop proposal context (#146977)
  perf(sessions): keep cleanup responsive and reuse workers (#140897)
  fix(sessions): prevent stranded writers after abort and restart (#146792)
  refactor: reuse deferred owners in Gateway and infra fixtures (#146809)
  fix: prevent queued conversation replies from switching storage (#146984)
  test(ui): preserve nested failure summaries in CI logs (#146864)
  fix(test): respect process memory limits in local scheduling (#146298)
  fix: validate large media data URLs without regexp stack exhaustion (#146972)
  fix(ui): label model usage contributions as messages (#146735)
  ...
vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (30 commits)
  test: align plugin fixtures with current runtime contracts (#147000)
  refactor(browser): separate session tab tracking from cleanup (#146973)
  fix(tests): make systemd clock fixtures private (#146990)
  fix(linux): retire sleep guards when logind disconnects (#146046)
  refactor(matrix): share draft fallback delivery (#144840)
  fix(sessions): preserve cross-agent replies after reload (#146799)
  test(models): cover quota recovery during catalog discovery (#146708)
  fix(macos): recover browser sign-in when no browser opens (#146787)
  fix(process): prevent one-shot agents exiting while polling (#144268)
  fix(status): label the session inventory as stored (#146979)
  fix: avoid repeated background reads while loading chat (#146953)
  refactor(ui): narrow Skill Workshop proposal context (#146977)
  perf(sessions): keep cleanup responsive and reuse workers (#140897)
  fix(sessions): prevent stranded writers after abort and restart (#146792)
  refactor: reuse deferred owners in Gateway and infra fixtures (#146809)
  fix: prevent queued conversation replies from switching storage (#146984)
  test(ui): preserve nested failure summaries in CI logs (#146864)
  fix(test): respect process memory limits in local scheduling (#146298)
  fix: validate large media data URLs without regexp stack exhaustion (#146972)
  fix(ui): label model usage contributions as messages (#146735)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
…claw#146792)

sessions.abort now waits for the lifecycle owner to persist the terminal session row before acknowledging cancellation, so an immediate Gateway restart cannot restore the acknowledged run as active. Embedded runs use the same persistence owner with exact writer fencing.

Startup recovery continues across healthy stores while failed stores remain eligible for retry. Explicit recovery repairs orphaned sessions with an unfinished no-tombstone cycle through the shared recovery owner, preserving the session and transcript. Live run and worker-placement checks still prevent recovery of active work. Status and Doctor expose outstanding startup recovery failures.

Verified with real Gateway WebSocket RPCs and the SQLite writer queue: before the fix, held terminal persistence allowed an early abort acknowledgement and SIGKILL retained a running row; afterward acknowledgement waited, SIGKILL preserved the killed row, and the next post-restart turn completed. Focused regressions, build, changed-file checks, and exact-head CI passed. Windows-specific storage contention was not exercised.

Fixes openclaw#146692

Reported by @desksk (openclaw#146692) with a full trace of the admission and startup-mark paths.
steipete added a commit that referenced this pull request Oct 15, 2026
…ply text (wave-4 bundle) (#172669)

* refactor(infra): remove redundant replay and freshness machinery

Trust successful migration statements inside their synchronous transactions,
reuse unchanged approval parses, share canonical package-root discovery,
namespace directory caches by plugin identity, and simplify ephemeral presence,
OS facts and suspension timer bookkeeping. Keep source validation, conflicts,
transaction durability, postcommit checks, security authority and write settlement.

Best-effort tradeoffs accepted

- Node-host own-write verification (#108457): no human successful-SQL-loss report; SQL errors still roll back, and independent source retirement checks remain.
- Workspace setup/attestation replay (#109147): no human driver-rewrite report; trust successful writes while retaining fingerprints and later source checks.
- APNs expected-ID replay (#108543): no human silent-insert-loss report; canonical parsing, tombstones and receipts remain.
- Device-auth presence assertion (#112663): no human successful-upsert-loss report; credential validation and transaction failure handling remain.
- Device-identity replay (#110392): no human silent-row-rewrite report; preserve independent post-await verification before source deletion.
- MCP OAuth replay (#161219): no human silent-write-loss report; canonical/source parsing and worker admission remain.
- Exec-approval read/parse/deep-compare replay (#114063): no human successful-driver-rewrite report; malformed policy stays fail-closed and actual authority is unchanged.
- Shared-auth target reread (#123349): no human silent-row-rewrite report; return the known SQL postimage and keep independent copy/flip/cleanup checks.
- Identical authored approval bytes (#168094) reuse the existing parse; changed normalized bytes still parse before publication.
- Plugin metadata fingerprinting (353d778): no human in-place metadata-mutation report; distinct objects remain isolated, and same-object edits use TTL/reset.
- Duplicate asset ancestor search (7224585): no human cached-miss incident; canonical realpath/wrapper discovery remains, while newly appearing packages need owner invalidation/restart.
- Presence logical clock (#134737): provenance is synthetic rollback/suspend tests; clock correction may temporarily retain or hide display rows until full update/reconnect, wall time catches up, or restart. TTL, capacity and connection privacy remain.
- Suspension timer generation (#130003): the removed test directly called a canceled callback; native timer cancellation and current-entry authority remain. An out-of-contract timer implementation could resume a renewed lease early.
- OS tuple-keyed cache (#135911): keep measured probe sharing and sticky labels; hot-patching OS identity needs restart rather than another namespace.
- Presence list type guards (409a160): callers supply validated arrays; existing normalization still owns their values.

Production +40/-228, net -188. Focused migration, asset/cache, presence/caller,
approval-publication and suspension/OS tests pass, as do production and infra-test
types, changed-file lint, assertion and suppression checks, and zero-cycle checks.
Independent final review has no actionable P0-P2 findings. No schema, durability,
retention, indexing, permission, recovery or public SDK change is intended.

Broad changed-check is not claimed green: the original base reproduces the
455-versus-454 environment budget failure. The initial Web Push Doctor timeout
remains unattributed; all Web Push production hunks were dropped and its exact
test passed on restored source. Full build and hosted CI remain unrun.

* refactor(agents): simplify reply preparation and refresh bookkeeping

Share typed actor-store adapters and prepared async auth reads. Reuse the
admitted memory-flush plan, retain last-good catalog views by provider, and
remove unused metadata bookkeeping and config projections. Preserve live
credential/effect authority, FIFO, transcript durability, and ordinary write
settlement. Net production reduction: 303 lines.

Best-effort tradeoffs accepted:
- Plugin-drain successors (#162301, synthetic): wait the current drain once;
  a later reload owns its own publication and recovery.
- A changed memory-flush plan during preparation (#162177/#121157, synthetic):
  finish with the admitted plan; the next turn resolves again.
- Per-row catalog freshness (#158113, synthetic): failed discovery retains
  the provider's last-good configured and supplemental overlays until success.
  Existing auth/profile/source gates and successful-empty replacement remain.
- MCP sibling invalidation during discovery (#138694, synthetic): a listing
  may briefly be stale; the next read observes the invalidation.
- Passive context metadata supersession (#119607, synthetic): late discovered
  metadata may win until refresh. Keep the single current-promise check before
  replacing configured limits, preserving the human capacity fix (#39857).
- Registration-time question answers (#110372/#134003, synthetic): a prompt
  can briefly race the answer; its terminal signal closes delivery.
- Duplicate or never-attached internal question registrations: both real
  producers attach once synchronously. Unsupported misuse loses its extra
  diagnostic/disposal wakeup; ordinary lifecycle rejection remains.
- Cancellation publication once/must-consume flags (#161124, synthetic): the
  sole internal producer invokes once. Keep active-scope/effect authority.
- In-flight placement-service replacement (#164744, synthetic): use the
  captured startup service, with its observation and writer authority intact.
- Compaction callback rebinding (#146732/#163264, synthetic): current work
  retains its captured callbacks and live assertion; later work captures anew.
- Re-entrant logging between synchronous run-owner checks: #162227 removed
  the awaited retry, making the second check redundant. Real post-await and
  mutation-effect checks remain.
- Startup diagnostic admission (#146792): the sole producer checks lifecycle
  immediately before recording. Remove only the recorder's duplicate check;
  preserve the human abort/recovery fix (#146692), reset, and admin redaction.

Release-note context: verbose diagnostics no longer include suppressed reply
text or background bash command contents. Execution and user replies remain
unchanged. Config show uses the same schema-aware redactor without cloning
an already detached result or redacting unused snapshot views.

Validation: touched core, messaging and Gateway-method type graphs passed;
49 changed TypeScript files passed targeted lint/format; runtime and Madge
cycles are both zero. Auth reader, question authority, memory flush, restart
claim, catalog worker, cancellation and compaction boundary proof is recorded
in the lane ledger. Final supplemental run: 392 tests passed, four failed
across 28 files, with final source verification. All 120 agents-support tests
passed, including refresh coalescing, publication, run-wait and compaction.
The four failures were an unchanged 120s ACP reset deadline and three MCP
fixtures settling before child startup markers (empty logs, existing 1-2s
connection/4s catalog deadlines). Narrow failed-case replay passed ACP reset
and two MCP cases; the one-second MCP retirement fixture still failed before
its first child marker. Clean lane-base comparison could not reach assertions:
the temporary checkout lacked workspace-local dependency links for worker
compilation. That case is unresolved, not proven inherited; coordinator-bundle
CI must adjudicate it. No deadline, retry, skip or assertion was weakened.
The final selected real-dispatch suppressed-reply logging regression passed
with completed source verification (one selected case, 202.58s wrapper).

Independent P0-P2 review completed four passes. Declined duplicate findings
about unsupported placement-service hot-swap (real observation/database/writer
authority remains) and alleged run-wait awaits (only synchronous logging lies
between the checks; real mutation and post-await checks remain).

Broad check-changed is NOT green: env-name budget 455/454 also fails on the
unchanged lane-base index, with no added env names; production/full-tree Knip
hit their existing 600s budget; the silent legacy-store scan was interrupted
after 782s. Those two scans are missing proof, not attributed inherited reds.
Hosted coordinator-bundle CI remains the broad gate. Owned mock/type/legacy
fixture findings were corrected and their targeted replays pass.

No changelog, dependency, database schema, durability, retention, permission,
or public API change is included. BELOW-500 branch-only coordinator handoff;
no lane PR or merge.

* chore: shrink stale reply assertion allowance

* test: align catalog publication calls with current contract
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 15, 2026
…ply text (wave-4 bundle) (openclaw#172669)

* refactor(infra): remove redundant replay and freshness machinery

Trust successful migration statements inside their synchronous transactions,
reuse unchanged approval parses, share canonical package-root discovery,
namespace directory caches by plugin identity, and simplify ephemeral presence,
OS facts and suspension timer bookkeeping. Keep source validation, conflicts,
transaction durability, postcommit checks, security authority and write settlement.

Best-effort tradeoffs accepted

- Node-host own-write verification (openclaw#108457): no human successful-SQL-loss report; SQL errors still roll back, and independent source retirement checks remain.
- Workspace setup/attestation replay (openclaw#109147): no human driver-rewrite report; trust successful writes while retaining fingerprints and later source checks.
- APNs expected-ID replay (openclaw#108543): no human silent-insert-loss report; canonical parsing, tombstones and receipts remain.
- Device-auth presence assertion (openclaw#112663): no human successful-upsert-loss report; credential validation and transaction failure handling remain.
- Device-identity replay (openclaw#110392): no human silent-row-rewrite report; preserve independent post-await verification before source deletion.
- MCP OAuth replay (openclaw#161219): no human silent-write-loss report; canonical/source parsing and worker admission remain.
- Exec-approval read/parse/deep-compare replay (openclaw#114063): no human successful-driver-rewrite report; malformed policy stays fail-closed and actual authority is unchanged.
- Shared-auth target reread (openclaw#123349): no human silent-row-rewrite report; return the known SQL postimage and keep independent copy/flip/cleanup checks.
- Identical authored approval bytes (openclaw#168094) reuse the existing parse; changed normalized bytes still parse before publication.
- Plugin metadata fingerprinting (f31bc71): no human in-place metadata-mutation report; distinct objects remain isolated, and same-object edits use TTL/reset.
- Duplicate asset ancestor search (40fb74f): no human cached-miss incident; canonical realpath/wrapper discovery remains, while newly appearing packages need owner invalidation/restart.
- Presence logical clock (openclaw#134737): provenance is synthetic rollback/suspend tests; clock correction may temporarily retain or hide display rows until full update/reconnect, wall time catches up, or restart. TTL, capacity and connection privacy remain.
- Suspension timer generation (openclaw#130003): the removed test directly called a canceled callback; native timer cancellation and current-entry authority remain. An out-of-contract timer implementation could resume a renewed lease early.
- OS tuple-keyed cache (openclaw#135911): keep measured probe sharing and sticky labels; hot-patching OS identity needs restart rather than another namespace.
- Presence list type guards (3965f6b): callers supply validated arrays; existing normalization still owns their values.

Production +40/-228, net -188. Focused migration, asset/cache, presence/caller,
approval-publication and suspension/OS tests pass, as do production and infra-test
types, changed-file lint, assertion and suppression checks, and zero-cycle checks.
Independent final review has no actionable P0-P2 findings. No schema, durability,
retention, indexing, permission, recovery or public SDK change is intended.

Broad changed-check is not claimed green: the original base reproduces the
455-versus-454 environment budget failure. The initial Web Push Doctor timeout
remains unattributed; all Web Push production hunks were dropped and its exact
test passed on restored source. Full build and hosted CI remain unrun.

* refactor(agents): simplify reply preparation and refresh bookkeeping

Share typed actor-store adapters and prepared async auth reads. Reuse the
admitted memory-flush plan, retain last-good catalog views by provider, and
remove unused metadata bookkeeping and config projections. Preserve live
credential/effect authority, FIFO, transcript durability, and ordinary write
settlement. Net production reduction: 303 lines.

Best-effort tradeoffs accepted:
- Plugin-drain successors (openclaw#162301, synthetic): wait the current drain once;
  a later reload owns its own publication and recovery.
- A changed memory-flush plan during preparation (openclaw#162177/openclaw#121157, synthetic):
  finish with the admitted plan; the next turn resolves again.
- Per-row catalog freshness (openclaw#158113, synthetic): failed discovery retains
  the provider's last-good configured and supplemental overlays until success.
  Existing auth/profile/source gates and successful-empty replacement remain.
- MCP sibling invalidation during discovery (openclaw#138694, synthetic): a listing
  may briefly be stale; the next read observes the invalidation.
- Passive context metadata supersession (openclaw#119607, synthetic): late discovered
  metadata may win until refresh. Keep the single current-promise check before
  replacing configured limits, preserving the human capacity fix (openclaw#39857).
- Registration-time question answers (openclaw#110372/openclaw#134003, synthetic): a prompt
  can briefly race the answer; its terminal signal closes delivery.
- Duplicate or never-attached internal question registrations: both real
  producers attach once synchronously. Unsupported misuse loses its extra
  diagnostic/disposal wakeup; ordinary lifecycle rejection remains.
- Cancellation publication once/must-consume flags (openclaw#161124, synthetic): the
  sole internal producer invokes once. Keep active-scope/effect authority.
- In-flight placement-service replacement (openclaw#164744, synthetic): use the
  captured startup service, with its observation and writer authority intact.
- Compaction callback rebinding (openclaw#146732/openclaw#163264, synthetic): current work
  retains its captured callbacks and live assertion; later work captures anew.
- Re-entrant logging between synchronous run-owner checks: openclaw#162227 removed
  the awaited retry, making the second check redundant. Real post-await and
  mutation-effect checks remain.
- Startup diagnostic admission (openclaw#146792): the sole producer checks lifecycle
  immediately before recording. Remove only the recorder's duplicate check;
  preserve the human abort/recovery fix (openclaw#146692), reset, and admin redaction.

Release-note context: verbose diagnostics no longer include suppressed reply
text or background bash command contents. Execution and user replies remain
unchanged. Config show uses the same schema-aware redactor without cloning
an already detached result or redacting unused snapshot views.

Validation: touched core, messaging and Gateway-method type graphs passed;
49 changed TypeScript files passed targeted lint/format; runtime and Madge
cycles are both zero. Auth reader, question authority, memory flush, restart
claim, catalog worker, cancellation and compaction boundary proof is recorded
in the lane ledger. Final supplemental run: 392 tests passed, four failed
across 28 files, with final source verification. All 120 agents-support tests
passed, including refresh coalescing, publication, run-wait and compaction.
The four failures were an unchanged 120s ACP reset deadline and three MCP
fixtures settling before child startup markers (empty logs, existing 1-2s
connection/4s catalog deadlines). Narrow failed-case replay passed ACP reset
and two MCP cases; the one-second MCP retirement fixture still failed before
its first child marker. Clean lane-base comparison could not reach assertions:
the temporary checkout lacked workspace-local dependency links for worker
compilation. That case is unresolved, not proven inherited; coordinator-bundle
CI must adjudicate it. No deadline, retry, skip or assertion was weakened.
The final selected real-dispatch suppressed-reply logging regression passed
with completed source verification (one selected case, 202.58s wrapper).

Independent P0-P2 review completed four passes. Declined duplicate findings
about unsupported placement-service hot-swap (real observation/database/writer
authority remains) and alleged run-wait awaits (only synchronous logging lies
between the checks; real mutation and post-await checks remain).

Broad check-changed is NOT green: env-name budget 455/454 also fails on the
unchanged lane-base index, with no added env names; production/full-tree Knip
hit their existing 600s budget; the silent legacy-store scan was interrupted
after 782s. Those two scans are missing proof, not attributed inherited reds.
Hosted coordinator-bundle CI remains the broad gate. Owned mock/type/legacy
fixture findings were corrected and their targeted replays pass.

No changelog, dependency, database schema, durability, retention, permission,
or public API change is included. BELOW-500 branch-only coordinator handoff;
no lane PR or merge.

* chore: shrink stale reply assertion allowance

* test: align catalog publication calls with current contract
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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.

[Bug]: sessions.abort + gateway restart strands activeWriterRunId, wedging session forever (SESSION_WORK_START_CHANGED)

1 participant