Skip to content

fix(telegram): keep empty binding archive failures from blocking updates - #162290

Merged
steipete merged 1 commit into
mainfrom
upd/l1335-archive-advisories
Oct 1, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/l1335-archive-advisories

Conversation

@steipete

@steipete steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Refs #161795

Builds on #161832 by @ericcaiwx-star, landed as 646ac9a9cc67d75cad95d88d7115fedf8c659d48.

What Problem This Solves

Doctor can still abort an update when archiving a verified empty Telegram thread-bindings file fails. Refusals for retained data also lose their data-risk explanation and repair command when the private path is sanitized.

User Impact

An empty-file archive failure now produces a recoverable warning and preserves the source for a later retry. Nonempty or uncertain state still refuses migration, with the data at risk and the backup/bridge-release recovery instructions visible after sanitization.

Why This Change Was Made

The Telegram migration owner separates archive advisories from refusing warnings and reports refusing warnings first in mixed batches. It grants a recoverable disposition only when no refusing warning remains. The diagnostic producer places the data-risk explanation and repair guidance before the private path, preserving the existing redaction boundary.

The strict empty-file predicate and successful-archive behavior remain unchanged. No configuration options, dependencies, database schemas, or Gateway restart policy change.

Evidence

Validated exact head e3751d143687b600ec922846d5f449695594ff48 on Blacksmith Testbox tbx_01m3thddjtj7423m839mqyhg5f (lease run). The fresh checkout fetched that pushed SHA and ran pnpm install --frozen-lockfile; no local tree sync was used.

  • Pre-fix control: replacing only the production migration with the parent revision made all three new regression cases fail for the intended reasons: empty archive failure refused, retained-data diagnostics disappeared, and an archive warning masked the real refusal in a mixed batch. Wall time: 2.54 s.
  • Required three passes: 33 tests passed per pass, with wall times 52.83 / 36.26 / 37.05 s. These cover the Telegram owner suite, the new receipt/sanitization regression, real Doctor plugin execution, and shared plugin migration behavior. Direct and one-barrel import discovery found no additional consumer suite.
  • Standalone cost with pnpm test <file> --maxWorkers=1: new regression 3 passed, 1.65 s wall / 714 ms Vitest; changed Telegram owner suite 7 passed, 1.61 s wall / 702 ms Vitest. The longest test in the required passes was the existing real Doctor-entry case at 9.27 s. No flaky or slow-test failure was encountered; hosted CI timing is not yet available.
  • node scripts/check-changed.mjs --base origin/l1335-proof-base completed all selected checks, including Doctor contract tests, typechecks, normal core/extension lint, and repository guards. Wall time: 1475.67 s, largely sequential typecheck work. Both lint steps reported 0 warnings and 0 errors; the final guard reported 0 runtime value cycles. The Mac-side SSH connection remained stale after the remote process exited; its complete GNU time log contained no nonzero/signal report, and the result was reconciled through a fresh connection without rerunning the gate.
  • Fresh direct OpenAI API Codex P1 review of this commit: scoped-clean, exit 0, no findings. git diff --check passed.

Commands for the three passes:

pnpm test extensions/telegram/src/state-migrations.test.ts \
  src/infra/state-migrations.telegram-retired.test.ts \
  src/infra/state-migrations.caller-mode.plugin-execution.test.ts \
  src/infra/state-migrations.plugin-doctor.test.ts --maxWorkers=1

Production LOC: +13/-3; tests: +94/-1; docs: +3/-1. Proof here is the Linux migration/Doctor boundary; no new published-driver or macOS LaunchAgent upgrade run is claimed for this follow-up.

Separate named follow-up: --no-restart failure recovery may wait for an unrequested Gateway. The owner is src/cli/update-cli/update-command-failure-recovery.ts:30, called from update-command-post-update.ts:388. Startup waiting should depend on an actual owned start/restart or recovery effect; absent that intent, use the existing one-shot observation. This patch does not change that behavior.

Follow up #161832 without changing its empty-file predicate. Keep archival warnings recoverable only when no retained state refuses migration, and place the refusal before advisories. Put data-at-risk and bridge-repair guidance before private paths so sanitized Doctor failures remain useful.

Retain byte-preservation and mixed-warning regressions at the registered Telegram Doctor contract and core receipt boundary. Refs #161795.
@clawsweeper

clawsweeper Bot commented Oct 1, 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 channel: telegram Channel integration: telegram size: S labels Oct 1, 2026
@steipete
steipete marked this pull request as ready for review October 1, 2026 02:12
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 30, 2026, 10:18 PM ET / October 1, 2026, 02:18 UTC.

ClawSweeper review

What this changes

Telegram’s Doctor migration makes verified empty-file archive failures recoverable and keeps retained-data recovery guidance visible after private paths are redacted.

Merge readiness

⛔ Blocked before merge - 2 items remain

This remains a useful follow-up: current main still refuses empty-file archive failures, and the merged predecessor does not cover the diagnostic repair. No actionable patch defect was found.

Likely related people: Eric Cai (high confidence) and steipete (medium confidence).

Priority: P1
Reviewed head: e3751d143687b600ec922846d5f449695594ff48

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The repair is focused and has meaningful regression evidence, but the required updater-boundary proof remains incomplete.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 9 items Pinned introduced behavior: The introduced patch separates archive warnings from retained-data refusals, orders refusals first, and grants recoverable disposition only when no refusing warning remains. The empty-file predicate and archive operation are unchanged.
Current main still needs this follow-up: Fetched main still collects archive failures in ordinary warnings and returns no recoverable disposition; its retained-state message also places recovery guidance after the private path. The latest release predates even the predecessor’s empty-file archival implementation.
Release behavior: v2026.9.7 preserves matching retired files without inspecting empty bindings and returns ordinary warnings; this follow-up is not implemented in that release.
Findings None None.
Security None None.

How this fits together

Telegram’s migration owner inspects retired local state during Doctor. Its warnings become migration receipts that determine whether update activation continues or stops.

flowchart TD
  A[Retired Telegram files] --> B[Telegram migration]
  B --> C{Verified empty bindings?}
  C -->|Yes| D[Archive or retain with advisory]
  C -->|No| E[Preserve with refusal]
  D --> F[Doctor migration receipt]
  E --> F
  F --> G[Continue or stop update]
Loading

Before merge

  • Resolve merge risk (P2) - The changed recoverable archive-failure result has not been demonstrated through a published updater installing this candidate; Doctor tests alone do not establish that activation finishes while the retained file remains.
  • Complete next step (P2) - Supply the required published-updater compatibility evidence for this candidate’s recoverable archive-failure behavior.
Agent review details

Security

None.

PR surface

Source +10, Tests +93, Docs +2. Total +105 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 13 3 +10
Tests 2 94 1 +93
Docs 1 3 1 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 110 5 +105

Review metrics

Metric Value Why it matters
Regression cost 3 new cases; reported standalone wall time 1.65 s The focused receipt and redaction coverage stays within the repository’s per-file test budget.

Merge-risk options

Maintainer options:

  1. Verify the shipped updater boundary (recommended)
    Provide a published-updater run against this candidate with archival failure, observing successful activation and unchanged retained bytes, with a nonempty refusal control.

Technical review

Best possible solution:

Keep the repair in Telegram’s existing migration owner and verify that shipped updaters continue activation with an archival advisory while retained-data refusals remain actionable.

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

Yes, from source: a directory occupying the empty binding file’s archive destination makes archival fail, and current main converts that warning into a refusal. This review did not execute tests.

Is this the best way to solve the issue?

Yes. Separating advisory archival failures at the Telegram producer and moving recovery guidance before private paths repairs the existing contracts without changing the strict empty-file predicate.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: A residual Doctor refusal can abort an existing installation’s update activation.
  • add merge-risk: 🚨 compatibility: This changes update-time warning disposition, and compatibility through a shipped updater remains unproven for the archive-failure case.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Label justifications:

  • P1: A residual Doctor refusal can abort an existing installation’s update activation.
  • merge-risk: 🚨 compatibility: This changes update-time warning disposition, and compatibility through a shipped updater remains unproven for the archive-failure case.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

What I checked:

  • Pinned introduced behavior: The introduced patch separates archive warnings from retained-data refusals, orders refusals first, and grants recoverable disposition only when no refusing warning remains. The empty-file predicate and archive operation are unchanged. (extensions/telegram/src/state-migrations.ts:95, e3751d143687)
  • Current main still needs this follow-up: Fetched main still collects archive failures in ordinary warnings and returns no recoverable disposition; its retained-state message also places recovery guidance after the private path. The latest release predates even the predecessor’s empty-file archival implementation. (extensions/telegram/src/state-migrations.ts:95, 45108214a076)
  • Release behavior: v2026.9.7 preserves matching retired files without inspecting empty bindings and returns ordinary warnings; this follow-up is not implemented in that release. (extensions/telegram/src/state-migrations.ts, c074824a27c9)
  • Production warning aggregation: The shared Doctor owner retains pending plugin work for any warning but distinguishes recoverable warnings from refusals. A separate refusing migration still prevents recoverable disposition. (src/infra/state-migrations.plugin-doctor.ts:344, e3751d143687)
  • Meaningful regression coverage: Three cases exercise the registered Telegram contract with real filesystem archival failure, retained nonempty bytes, and mixed warnings. They check receipt outcomes and sanitized failure facts rather than mocking archival success. The captured body reports all three fail with the parent production module and pass at this head; those runs were not repeated during this read-only review. (src/infra/state-migrations.telegram-retired.test.ts:30, e3751d143687)
  • Required update proof remains uncovered: Root policy requires a published-driver × candidate cell for Doctor/update changes. The captured body, source revision 96a8603dea2c81336decc43de83a684b49c755a93ee5d2a6521f7ffdb5138a73, expressly limits this head’s proof to Linux migration/Doctor tests and claims no new published-driver run. The predecessor’s published 2026.9.6 updater cells cover successful empty archival and nonempty refusal, not the newly recoverable archive-failure case. (AGENTS.md:84, e3751d143687)

Likely related people:

  • Eric Cai: Raw commit 646ac9a adds extensions/telegram/src/state-migrations.ts:16 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 646ac9a9cc67; files: extensions/telegram/src/state-migrations.ts)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add redacted terminal output or logs from a published updater installing this candidate with the empty-file archive failure and a nonempty refusal control; update the PR body for fresh review.

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.

@steipete
steipete merged commit 1b9d7e7 into main Oct 1, 2026
184 of 187 checks passed
@steipete
steipete deleted the upd/l1335-archive-advisories branch October 1, 2026 02:23
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 1, 2026
…tes (openclaw#162290)

Follow-up to openclaw#161832: when archiving a verified-empty retired Telegram bindings file fails (for example the .migrated target already exists), the migration records a recoverable warning instead of refusing the update; non-empty or uncertain sources keep the preservation refusal. Sanitized refusal messages keep their diagnostic text.

Refs openclaw#161795

Thanks @ericcaiwx-star for the base fix in openclaw#161832.
RomneyDa pushed a commit that referenced this pull request Oct 1, 2026
…tes (#162290)

Follow-up to #161832: when archiving a verified-empty retired Telegram bindings file fails (for example the .migrated target already exists), the migration records a recoverable warning instead of refusing the update; non-empty or uncertain sources keep the preservation refusal. Sanitized refusal messages keep their diagnostic text.

Refs #161795

Thanks @ericcaiwx-star for the base fix in #161832.

(cherry picked from commit 1b9d7e7)
RomneyDa added a commit that referenced this pull request Oct 1, 2026
* fix: preserve plugin settings through update recovery (#160344)

Keep incompatible local plugin configuration intact and complete deferred migration confirmation after unchanged package convergence. Use completion receipts to clear obsolete retry warnings without rewriting update history.

Fixes #159477. Thanks @EndeavorPioneer for the recovery report.

(cherry picked from commit 8e66b0b)

* fix: prevent duplicate Gateways during container onboarding (#160193)

* fix: prevent duplicate Gateways during container onboarding

* fix: keep QA cron controls scoped to the child

Drop inherited parent cron suppression while preserving explicit child runtime
settings. Cover the failing inheritance contract at the environment owner.

Await node-list RPC responses after acknowledged rename and reconnect events
without racing the existing RPC deadline against a separate polling timeout.

(cherry picked from commit 54b1b1b)

* fix: refuse incompatible Windows 9.4 schema upgrades (#160718)

* fix: refuse incompatible Windows 9.4 schema upgrades

Refuse shared-state migration during the shipped Windows 9.4 raw Doctor preflight while its recorded updater drivers have not positively stopped. Keep the existing delegated Doctor and 9.2 publication paths unchanged. Split manual recovery text so the shipped canary retains the reason and commands within its per-line capture limit. This contains the old callback failure; it does not complete automatic 9.4 updates.

* fix: refuse legacy Windows migration during package staging

* fix(update): load package lifecycle guard only at runtime

(cherry picked from commit 0703c21)

* fix(anthropic): prevent stuck turns after background Bash completes (#161260)

* fix(anthropic): release backgrounded Bash hold on task-notification result

* fix(anthropic): settle background replies without stalled or prematurely closed turns

Keep native Bash, agent, and workflow completions attached until consumed. Correlate queued and inline acknowledgements, preserve failure retirement, and distinguish automatic Bash timeouts from explicit background requests using authorized input. Add transport regressions; verify real Claude producer ordering and patched warm-session reuse.

Co-authored-by: VACInc <[email protected]>

---------

Co-authored-by: VACInc <[email protected]>
(cherry picked from commit 38dd3c2)

* fix: preserve maintenance leases during SQLite contention (#160702)

(cherry picked from commit 3328283)

* fix(gateway): preserve proxy policy in local TLS health probes (#161946)

(cherry picked from commit 649b19f)

* fix(telegram): prevent empty retired bindings from blocking updates (#161832)

* test(telegram): cover empty retired bindings migration

* test(doctor): cover empty Telegram migration receipt

* fix(telegram): archive verified empty retired bindings

Co-authored-by: ericcaiwx-star <[email protected]>
(cherry picked from commit 646ac9a)

* fix(doctor): keep session repair iterative on deep canonical owner chains (#162321)

Doctor's session-repair step overflowed the stack (RangeError: Maximum call stack size exceeded) on large but healthy agent databases during 2026.9.7 update activation: canonical-owner resolution followed canonicalOwnerSessionKey alias chains recursively, and row-count-sized spreads sat on the same path. Resolution is now iterative with the same terminal-owner, missing-owner, and cycle outcomes, and the spreads are linear reductions with unchanged empty-input behavior. A healthy 12,000-owner / 200,000-event fixture fails pre-fix and passes post-fix; the published-driver upgrade preserved transcript bytes.

Closes #161979

(cherry picked from commit 9fb7ba2)

* fix(launcher): keep the Node compile-cache path short on Windows (#162841)

2026.9.7 lengthened the compile-cache marker from <mtime>-<size> to build-<buildId>, which pushed cache paths on Windows into the directory-length window where Node 24's module.enableCompileCache() never returns (nodejs/node#66438); every OpenClaw process start could then spin at full CPU. The shared cache owner now uses a 16-character hash of the full build id as the marker, refuses Windows cache paths over 200 characters with a recorded warning (cache off for that process), and no longer propagates an unsafe inherited cache path to children. Legacy namespace handling and POSIX behavior are unchanged; native Windows/Node 24.18 completes the packaged CLI with a 220-character TEMP in 2.4 s.

Closes #162821

(cherry picked from commit 6e987af)

* fix(codex): prevent Gateway heap exhaustion with large agent fleets (#162912)

Closes #162802

## What Problem This Solves

Fixes Gateway heap exhaustion during Codex session discovery on large agent fleets. Thanks to @609NFT for the report and allocation profiles.

## User Impact

Large fleets can finish startup and retain their native Codex session catalog without retaining a whole fleet configuration for every agent/home pair. No schema, stored-data, configuration, or catalog-output changes are required.

## Why This Change Was Made

The existing config-identity cache now owns one captured configuration per generation. Agent/home entries keep their separate directories and cloned connection options, but share that captured configuration. Config reload isolation and source-specific backoff remain unchanged.

No overlap with Pash/Sarah changes.

Codex source inspection: `codex-rs/app-server/src/request_processors/thread_processor.rs:2524–2608` in the sibling Codex checkout confirms that `thread/list` consumes pagination and filter parameters; the fleet configuration capture being repaired belongs to OpenClaw, not the native listing protocol.

## Evidence

Compared baseline `7ef388bac8f607eb03510189922d1c6a4d786b52` with candidate `f0ae922f60922f2b357bc3d5af22a2142799fbe0` in isolated Linux arm64 Docker containers, Node 24.21.0. The synthetic profile contained 739 agents, eight explicit Codex homes, and three native sessions (380,439 bytes of configuration).

| Check | Baseline | Candidate |
| --- | --- | --- |
| Real Gateway, 2,560 MiB heap | Heap OOM at 100.3 s | Survived the six-minute window; clean shutdown |
| Sampled catalog allocations under `resolveRequestOptions` → `structuredClone` | 2.248 GB | 5.48 MB |
| Post-startup heap, 150–360 s | Process already terminated | Bounded at 377–566 MiB |
| Complete startup, separate 6,144 MiB control without profiling | 98.34 s | 93.83 s |
| HTTP listening, same startup control | 50.52 s | 49.56 s |

The larger-heap startup control lets the baseline complete startup rather than comparing a successful candidate against an OOM.

- Real `sessions.catalog.list` Gateway RPCs returned exactly the three expected native session IDs for agents `agent000`, `agent001`, and `agent738`.
- Exact-head live gate: a real OpenAI `gpt-5.4-mini` turn through the candidate Gateway's Codex harness returned `CATALOG_LIVE_OK` on the 739-agent profile (5.449 s). Its temporary read-only credential file and container were removed.
- Regression failed on baseline: four fleet config clones instead of one across multiple agents/homes. It passes on the candidate and also checks reload allocation isolation; the regression itself took 5 ms.
- All 38 focused tests passed across `session-catalog-listing-cache.test.ts`, `session-catalog-request-lifetime.test.ts`, `session-catalog-homes.test.ts`, and `session-catalog-backoff.test.ts` (38.67 s wall).
- Standalone `pnpm test extensions/codex/src/session-catalog-listing-cache.test.ts --maxWorkers=1` passed (32.61 s wall, including runner preparation).
- Built and exercised the real candidate runtime with `pnpm build`. Broader static and project-wide validation is left to CI.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit fd01246)

* fix(telegram): preserve queued preview writer authority (#160137)

* fix(telegram): preserve queued preview writer authority

Forward-port the Telegram preview correction from f488a8c. Both preview paths retain current-writer authority through the account scheduler and network admission.

WIP: the regression failed before the repair and all 86 focused tests pass. Full changed-check completion and independent review remain pending under the work-order time budget.

Co-authored-by: Ayaan Zaidi <[email protected]>

* docs(telegram): scope the preview authority note to guarded updates

---------

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit a8907e3)

* fix(telegram): keep empty binding archive failures from blocking updates (#162290)

Follow-up to #161832: when archiving a verified-empty retired Telegram bindings file fails (for example the .migrated target already exists), the migration records a recoverable warning instead of refusing the update; non-empty or uncertain sources keep the preservation refusal. Sanitized refusal messages keep their diagnostic text.

Refs #161795

Thanks @ericcaiwx-star for the base fix in #161832.

(cherry picked from commit 1b9d7e7)

* fix(sandbox): sessions fail with EACCES after skills refresh on read-only installs (#162304)

* fix(sandbox): keep synced skill copies removable on read-only installs

Sandbox skill sync copied bundled skills with fs.cp, which keeps source
modes. From a read-only install every copied directory became 0555, so the
next full re-sync (skills version bump or Gateway restart) failed with
EACCES unlinking skills/<skill>/SKILL.md, and library-pinned sessions
failed every turn.

Copied directories are now made owner-writable (file modes unchanged), and
removal repairs legacy read-only trees inside the synced child before one
retry. The repair stays inside the skills root and never follows symlinks.
The Claude CLI skills-plugin copy fallback uses the same helper.

* fix(sandbox): classify skill removal errors without a type assertion

(cherry picked from commit be93e85)

* fix(doctor): share plugin registries across agents in the tool-schema check (#162394)

doctor --fix heap-OOMed on a 739-agent state: the runtime tool-schema check resolved a model per agent workspace, and every plugin-load cache context cloned the full runtime config and retained a registry per workspace (516 MB of config clones at 2.4 GB heap). The loader now defers config capture until a cache miss and shares prepared provider registrations within a captured config generation for agents with matching configuration and plugin sources; a reentrant load during capture joins the in-flight load instead of registering twice. 300 synthetic agents: config clones 1,802 -> 3, registries 300 -> 1, peak RSS 1.25 GB -> 0.88 GB.

Closes #161869

(cherry picked from commit e304e4f)

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Vito Cappello <[email protected]>
Co-authored-by: VACInc <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
Co-authored-by: Eric Cai <[email protected]>
RomneyDa added a commit that referenced this pull request Oct 1, 2026
* fix: preserve plugin settings through update recovery (#160344)

Keep incompatible local plugin configuration intact and complete deferred migration confirmation after unchanged package convergence. Use completion receipts to clear obsolete retry warnings without rewriting update history.

Fixes #159477. Thanks @EndeavorPioneer for the recovery report.

(cherry picked from commit 8e66b0b)

* fix: prevent duplicate Gateways during container onboarding (#160193)

* fix: prevent duplicate Gateways during container onboarding

* fix: keep QA cron controls scoped to the child

Drop inherited parent cron suppression while preserving explicit child runtime
settings. Cover the failing inheritance contract at the environment owner.

Await node-list RPC responses after acknowledged rename and reconnect events
without racing the existing RPC deadline against a separate polling timeout.

(cherry picked from commit 54b1b1b)

* fix: refuse incompatible Windows 9.4 schema upgrades (#160718)

* fix: refuse incompatible Windows 9.4 schema upgrades

Refuse shared-state migration during the shipped Windows 9.4 raw Doctor preflight while its recorded updater drivers have not positively stopped. Keep the existing delegated Doctor and 9.2 publication paths unchanged. Split manual recovery text so the shipped canary retains the reason and commands within its per-line capture limit. This contains the old callback failure; it does not complete automatic 9.4 updates.

* fix: refuse legacy Windows migration during package staging

* fix(update): load package lifecycle guard only at runtime

(cherry picked from commit 0703c21)

* fix(anthropic): prevent stuck turns after background Bash completes (#161260)

* fix(anthropic): release backgrounded Bash hold on task-notification result

* fix(anthropic): settle background replies without stalled or prematurely closed turns

Keep native Bash, agent, and workflow completions attached until consumed. Correlate queued and inline acknowledgements, preserve failure retirement, and distinguish automatic Bash timeouts from explicit background requests using authorized input. Add transport regressions; verify real Claude producer ordering and patched warm-session reuse.

Co-authored-by: VACInc <[email protected]>

---------

Co-authored-by: VACInc <[email protected]>
(cherry picked from commit 38dd3c2)

* fix: preserve maintenance leases during SQLite contention (#160702)

(cherry picked from commit 3328283)

* fix(gateway): preserve proxy policy in local TLS health probes (#161946)

(cherry picked from commit 649b19f)

* fix(telegram): prevent empty retired bindings from blocking updates (#161832)

* test(telegram): cover empty retired bindings migration

* test(doctor): cover empty Telegram migration receipt

* fix(telegram): archive verified empty retired bindings

Co-authored-by: ericcaiwx-star <[email protected]>
(cherry picked from commit 646ac9a)

* fix(doctor): keep session repair iterative on deep canonical owner chains (#162321)

Doctor's session-repair step overflowed the stack (RangeError: Maximum call stack size exceeded) on large but healthy agent databases during 2026.9.7 update activation: canonical-owner resolution followed canonicalOwnerSessionKey alias chains recursively, and row-count-sized spreads sat on the same path. Resolution is now iterative with the same terminal-owner, missing-owner, and cycle outcomes, and the spreads are linear reductions with unchanged empty-input behavior. A healthy 12,000-owner / 200,000-event fixture fails pre-fix and passes post-fix; the published-driver upgrade preserved transcript bytes.

Closes #161979

(cherry picked from commit 9fb7ba2)

* fix(launcher): keep the Node compile-cache path short on Windows (#162841)

2026.9.7 lengthened the compile-cache marker from <mtime>-<size> to build-<buildId>, which pushed cache paths on Windows into the directory-length window where Node 24's module.enableCompileCache() never returns (nodejs/node#66438); every OpenClaw process start could then spin at full CPU. The shared cache owner now uses a 16-character hash of the full build id as the marker, refuses Windows cache paths over 200 characters with a recorded warning (cache off for that process), and no longer propagates an unsafe inherited cache path to children. Legacy namespace handling and POSIX behavior are unchanged; native Windows/Node 24.18 completes the packaged CLI with a 220-character TEMP in 2.4 s.

Closes #162821

(cherry picked from commit 6e987af)

* fix(codex): prevent Gateway heap exhaustion with large agent fleets (#162912)

Closes #162802

## What Problem This Solves

Fixes Gateway heap exhaustion during Codex session discovery on large agent fleets. Thanks to @609NFT for the report and allocation profiles.

## User Impact

Large fleets can finish startup and retain their native Codex session catalog without retaining a whole fleet configuration for every agent/home pair. No schema, stored-data, configuration, or catalog-output changes are required.

## Why This Change Was Made

The existing config-identity cache now owns one captured configuration per generation. Agent/home entries keep their separate directories and cloned connection options, but share that captured configuration. Config reload isolation and source-specific backoff remain unchanged.

No overlap with Pash/Sarah changes.

Codex source inspection: `codex-rs/app-server/src/request_processors/thread_processor.rs:2524–2608` in the sibling Codex checkout confirms that `thread/list` consumes pagination and filter parameters; the fleet configuration capture being repaired belongs to OpenClaw, not the native listing protocol.

## Evidence

Compared baseline `7ef388bac8f607eb03510189922d1c6a4d786b52` with candidate `f0ae922f60922f2b357bc3d5af22a2142799fbe0` in isolated Linux arm64 Docker containers, Node 24.21.0. The synthetic profile contained 739 agents, eight explicit Codex homes, and three native sessions (380,439 bytes of configuration).

| Check | Baseline | Candidate |
| --- | --- | --- |
| Real Gateway, 2,560 MiB heap | Heap OOM at 100.3 s | Survived the six-minute window; clean shutdown |
| Sampled catalog allocations under `resolveRequestOptions` → `structuredClone` | 2.248 GB | 5.48 MB |
| Post-startup heap, 150–360 s | Process already terminated | Bounded at 377–566 MiB |
| Complete startup, separate 6,144 MiB control without profiling | 98.34 s | 93.83 s |
| HTTP listening, same startup control | 50.52 s | 49.56 s |

The larger-heap startup control lets the baseline complete startup rather than comparing a successful candidate against an OOM.

- Real `sessions.catalog.list` Gateway RPCs returned exactly the three expected native session IDs for agents `agent000`, `agent001`, and `agent738`.
- Exact-head live gate: a real OpenAI `gpt-5.4-mini` turn through the candidate Gateway's Codex harness returned `CATALOG_LIVE_OK` on the 739-agent profile (5.449 s). Its temporary read-only credential file and container were removed.
- Regression failed on baseline: four fleet config clones instead of one across multiple agents/homes. It passes on the candidate and also checks reload allocation isolation; the regression itself took 5 ms.
- All 38 focused tests passed across `session-catalog-listing-cache.test.ts`, `session-catalog-request-lifetime.test.ts`, `session-catalog-homes.test.ts`, and `session-catalog-backoff.test.ts` (38.67 s wall).
- Standalone `pnpm test extensions/codex/src/session-catalog-listing-cache.test.ts --maxWorkers=1` passed (32.61 s wall, including runner preparation).
- Built and exercised the real candidate runtime with `pnpm build`. Broader static and project-wide validation is left to CI.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit fd01246)

* fix(telegram): preserve queued preview writer authority (#160137)

* fix(telegram): preserve queued preview writer authority

Forward-port the Telegram preview correction from f488a8c. Both preview paths retain current-writer authority through the account scheduler and network admission.

WIP: the regression failed before the repair and all 86 focused tests pass. Full changed-check completion and independent review remain pending under the work-order time budget.

Co-authored-by: Ayaan Zaidi <[email protected]>

* docs(telegram): scope the preview authority note to guarded updates

---------

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit a8907e3)

* fix(telegram): keep empty binding archive failures from blocking updates (#162290)

Follow-up to #161832: when archiving a verified-empty retired Telegram bindings file fails (for example the .migrated target already exists), the migration records a recoverable warning instead of refusing the update; non-empty or uncertain sources keep the preservation refusal. Sanitized refusal messages keep their diagnostic text.

Refs #161795

Thanks @ericcaiwx-star for the base fix in #161832.

(cherry picked from commit 1b9d7e7)

* fix(sandbox): sessions fail with EACCES after skills refresh on read-only installs (#162304)

* fix(sandbox): keep synced skill copies removable on read-only installs

Sandbox skill sync copied bundled skills with fs.cp, which keeps source
modes. From a read-only install every copied directory became 0555, so the
next full re-sync (skills version bump or Gateway restart) failed with
EACCES unlinking skills/<skill>/SKILL.md, and library-pinned sessions
failed every turn.

Copied directories are now made owner-writable (file modes unchanged), and
removal repairs legacy read-only trees inside the synced child before one
retry. The repair stays inside the skills root and never follows symlinks.
The Claude CLI skills-plugin copy fallback uses the same helper.

* fix(sandbox): classify skill removal errors without a type assertion

(cherry picked from commit be93e85)

* fix(doctor): share plugin registries across agents in the tool-schema check (#162394)

doctor --fix heap-OOMed on a 739-agent state: the runtime tool-schema check resolved a model per agent workspace, and every plugin-load cache context cloned the full runtime config and retained a registry per workspace (516 MB of config clones at 2.4 GB heap). The loader now defers config capture until a cache miss and shares prepared provider registrations within a captured config generation for agents with matching configuration and plugin sources; a reentrant load during capture joins the in-flight load instead of registering twice. 300 synthetic agents: config clones 1,802 -> 3, registries 300 -> 1, peak RSS 1.25 GB -> 0.88 GB.

Closes #161869

(cherry picked from commit e304e4f)

* fix(release): carry 2026.9.8 CI exceptions

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Vito Cappello <[email protected]>
Co-authored-by: VACInc <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
Co-authored-by: Eric Cai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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