Skip to content

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

Merged
steipete merged 3 commits into
openclaw:mainfrom
ericcaiwx-star:codex/fix-161795-empty-telegram-bindings
Oct 1, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
ericcaiwx-star:codex/fix-161795-empty-telegram-bindings

Conversation

@ericcaiwx-star

@ericcaiwx-star ericcaiwx-star commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #161795

What Problem This Solves

An npm-managed upgrade from OpenClaw 2026.9.6 can stop activation when the state directory retains an empty version-1 Telegram thread-bindings file. Doctor currently treats that no-op file like unresolved legacy state, refuses plugin-doctor-state, and can leave the managed Gateway stopped after newer state migrations have already run.

User Impact

Doctor now archives a verified empty retired Telegram thread-bindings file and allows activation to continue. Files that may contain user state remain blocking and untouched.

What Changed

  • Recognize only a regular thread-bindings-*.json file whose bytes parse as JSON and exactly represent version 1 with an empty bindings array.
  • Archive that verified no-op source through the shared migration helper, preserving the original bytes in .migrated.
  • Keep nonempty, malformed, symlinked, duplicate-key, escaped-key, and extra-field sources on the existing preservation/refusal path.
  • Add a real Doctor-entry integration test and document the safety boundary.

Safety Boundary

The archive path intentionally accepts only the two literal keys version and bindings, in either order, with no additional fields. Exact key spelling keeps duplicate or Unicode-escaped property names in the uncertain path. lstat also excludes symlinks. Anything outside that narrow shape is preserved for operator review.

Evidence

Base: 8c9040c624d932f665e33f506781c5badee18afa
Candidate: 57240e2aa21a6110b6b6ba40ea244ea7e5e90a3c

Regression proof

  • Pre-fix on the base commit:
    • pnpm test extensions/telegram/src/state-migrations.test.ts --maxWorkers=1 -t 'archives a verified empty version-1 thread bindings file'
    • Exit 1: the exact empty file still produced the blocking preservation warning.
  • Post-fix on the candidate commit:
    • The same focused command exits 0.
    • Full extensions/telegram/src/state-migrations.test.ts: 7 tests passed; Vitest duration 756 ms (1.45 s wrapper wall time).
    • Full src/infra/state-migrations.caller-mode.plugin-execution.test.ts: 14 tests passed; Vitest duration 34.97 s (37.41 s wrapper wall time). The new real Doctor-entry case took 10.071 s.
  • The Doctor-entry test was also run at the test-only commit before production code; it failed with plugin-doctor-state outcome refused, then passed at the candidate commit with a completed receipt and byte-exact archive.

Published updater proof

A candidate tarball was built from the exact candidate commit and verified through its embedded dist/build-info.json.

  • Candidate tarball SHA-256: 9a6ec7de49b5d1af71b1706f560301ed3c6242a20274669f628ed7a650989612
  • Published driver: [email protected]
  • Candidate package version: 2026.9.7
  • Environment: two task-owned temporary npm prefixes and copied synthetic state directories; no production state or credentials.

Results:

Cell Updater exit Source after update Archive after update Bytes Refusal
Exact {"version":1,"bindings":[]} 0 absent present exact original bytes no
Valid nonempty version-1 bindings control 1 present absent exact original bytes yes, Preserved retired Telegram JSON state

Both cells installed the candidate package through the published 2026.9.6 updater; neither timed out.

Broader verification

  • pnpm test:extension telegram: passed all 52 database-worker chunks and 13 extension chunks.
  • node scripts/check-changed.mjs --base 8c9040c624d932f665e33f506781c5badee18afa -- <four changed files>: exit 0, including formatting, line-cap ratchets, Doctor contract closure tests, core and extension type graphs, lint, dead-code scans, database-first guards, and import-cycle checks.
  • Final AutoReview (P0-P2): no actionable findings; overall verdict patch is correct with confidence 0.82.
  • git diff --check: passed.

Patch Surface

  • Production: +49 / -8 lines
  • Tests: +75 / -0 lines
  • Docs: +4 / -0 lines
  • No configuration, environment-variable, dependency, or SQLite schema changes

@clawsweeper

clawsweeper Bot commented Sep 30, 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 channel: telegram Channel integration: telegram size: XS labels Sep 30, 2026
@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 30, 2026
@clawsweeper

clawsweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 30, 2026, 8:54 PM ET / October 1, 2026, 00:54 UTC (Revision 4).

ClawSweeper review

What this changes

The Telegram plugin’s Doctor migration archives a verified empty retired thread-bindings file so an update can continue, while preserving uncertain files and documenting the rule.

Merge readiness

✅ Ready for maintainer review

This fix is still needed: current main and the latest release refuse the reported empty Telegram bindings file. The branch has a narrow archive rule, Doctor coverage, and contributor-reported proof through the published updater; I found no actionable patch defect.

Priority: P0
Reviewed head: 57240e2aa21a6110b6b6ba40ea244ea7e5e90a3c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair has strong reported upgrade proof and useful boundary coverage, with no actionable patch finding identified.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The changed Telegram migration was exercised through Doctor during the contributor’s reported published 2026.9.6 updater run: the candidate archived the existing empty source byte-exactly and continued, while a nonempty control stayed in place and refused. That existing-state run also supports migration compatibility; this review did not independently execute it.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The changed Telegram migration was exercised through Doctor during the contributor’s reported published 2026.9.6 updater run: the candidate archived the existing empty source byte-exactly and continued, while a nonempty control stayed in place and refused. That existing-state run also supports migration compatibility; this review did not independently execute it.
Evidence reviewed 8 items Introduced behavior: The introduced Telegram migration checks for a regular file and exact empty version-1 JSON shape before using the existing archive helper; all other matching sources retain warnings.
Current-main gap: Fetched main still turns every matching retired Telegram source into a warning and has no empty-file archive path.
Latest-release gap: The supplied v2026.9.7 release commit has the same blanket-warning behavior; the PR fix is not in that release.
Findings None None.
Security None None.

How this fits together

During an update, Doctor asks plugins to inspect retired state files before Gateway activation. The Telegram migration returns changes or blocking warnings, which Doctor records in an update receipt.

flowchart LR
  A[Published updater] --> B[Doctor migration]
  B --> C[Retired Telegram file]
  C --> D{Verified empty?}
  D -->|Yes| E[Archive original bytes]
  D -->|No| F[Preserve and warn]
  E --> G[Completed receipt]
  F --> H[Refusal receipt]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +41, Tests +75, Docs +4. Total +120 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 49 8 +41
Tests 2 75 0 +75
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 128 8 +120

Review metrics

Metric Value Why it matters
Production versus test growth production net +41 lines; tests +75 lines The production growth implements a bounded legacy-state check, with distinct migration and Doctor-entry coverage.
Doctor-entry test cost 10.071 s for the new case The PR body reports the cost of the test that covers the activation receipt beyond the plugin-level checks.

Stored data model

Persistent data-model change detected: migration/backfill/repair: extensions/telegram/src/state-migrations.ts, serialized state: extensions/telegram/src/state-migrations.ts, unknown-data-model-change: extensions/telegram/src/state-migrations.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #161795
Summary: The linked open issue reports the same empty-file upgrade refusal addressed by this PR.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep the narrow Doctor archive rule and byte-preserving archive behavior, while leaving uncertain files on the existing refusal path.

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

Yes. A retained empty version-1 bindings file follows a precise Doctor refusal path on current main; the contributor reports a pre-fix failure and published-updater after-fix run, though this review did not execute them.

Is this the best way to solve the issue?

Yes. Handling the verified no-op in Telegram’s existing migration owner is narrower than weakening Doctor’s refusal rule for other retired state.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P0: The linked report documents a managed update that left the Gateway stopped and required technical recovery.
  • merge-risk: 🚨 compatibility: The patch changes upgrade handling for a persisted legacy file; exact-byte archival and a nonempty-file refusal control bound that risk.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The changed Telegram migration was exercised through Doctor during the contributor’s reported published 2026.9.6 updater run: the candidate archived the existing empty source byte-exactly and continued, while a nonempty control stayed in place and refused. That existing-state run also supports migration compatibility; this review did not independently execute it.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed Telegram migration was exercised through Doctor during the contributor’s reported published 2026.9.6 updater run: the candidate archived the existing empty source byte-exactly and continued, while a nonempty control stayed in place and refused. That existing-state run also supports migration compatibility; this review did not independently execute it.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: 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 (3 earlier review cycles)
  • reviewed 2026-09-30T11:09:04.761Z sha 08b2357 :: needs real behavior proof before merge. :: [P1] Implement the migration required by the new archive assertion
  • reviewed 2026-09-30T12:24:23.874Z sha 57240e2 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-30T12:45:01.960Z sha 57240e2 :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S and removed size: XS labels Sep 30, 2026
@clawsweeper clawsweeper Bot added 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. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 30, 2026
@ericcaiwx-star
ericcaiwx-star marked this pull request as ready for review September 30, 2026 12:20
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 30, 2026
@steipete

steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 646ac9a into openclaw:main Oct 1, 2026
210 of 212 checks passed
@steipete

steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

steipete added 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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 1, 2026
…penclaw#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]>
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
…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)
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. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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.

[Bug]: Empty legacy Telegram bindings block 2026.9.6 -> 2026.9.7 activation and leave Gateway stopped

2 participants